Sync with the trunk

git-svn-id: https://svn.apache.org/repos/asf/openoffice/branches/ia2@1541833 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/main/accessibility/inc/accessibility/extended/accessiblelistbox.hxx b/main/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
index 404ecb4..a313c82 100644
--- a/main/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
+++ b/main/accessibility/inc/accessibility/extended/accessiblelistbox.hxx
@@ -30,14 +30,16 @@
 #include <vcl/vclevent.hxx>
 #include <toolkit/awt/vclxaccessiblecomponent.hxx>
 
+#include <map>
 
 // class AccessibleListBox -----------------------------------------------
 
 class SvTreeListBox;
-
+class SvLBoxEntry;
 //........................................................................
 namespace accessibility
 {
+	class AccessibleListBoxEntry;
 //........................................................................
 
 	typedef ::cppu::ImplHelper2<  ::com::sun::star::accessibility::XAccessible
@@ -65,6 +67,8 @@
 		virtual void	FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
 
 		SvTreeListBox*	getListBox() const;
+		
+		void 			RemoveChildEntries(SvLBoxEntry*);
 
 	public:
 		/** OAccessibleBase needs a valid view
@@ -111,6 +115,19 @@
 		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 );
+
 	};
 
 //........................................................................
diff --git a/main/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx b/main/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx
index 330d884..04e09b3 100644
--- a/main/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx
+++ b/main/accessibility/inc/accessibility/extended/accessiblelistboxentry.hxx
@@ -35,7 +35,15 @@
 #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>
@@ -59,7 +67,7 @@
 //........................................................................
 
 // class AccessibleListBoxEntry ------------------------------------------
-
+/*
 	typedef ::cppu::WeakAggComponentImplHelper8< ::com::sun::star::accessibility::XAccessible
 												, ::com::sun::star::accessibility::XAccessibleContext
 												, ::com::sun::star::accessibility::XAccessibleComponent
@@ -68,7 +76,17 @@
 												, ::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
@@ -81,6 +99,8 @@
 		/** The treelistbox control */
 		SvTreeListBox*						m_pListBox;
 		::std::deque< sal_Int32 >			m_aEntryPath;
+		SvLBoxEntry* 						m_pSvLBoxEntry;	// IA2 CWS. Needed for focused item...
+		
 
 	protected:
         /// client id in the AccessibleEventNotifier queue
@@ -99,6 +119,8 @@
 		Rectangle				GetBoundingBoxOnScreen() throw ( ::com::sun::star::lang::DisposedException );
     	void 					EnsureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
 
+		void	NotifyAccessibleEvent( sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _aOldValue, const ::com::sun::star::uno::Any& _aNewValue );
+
 	protected:
 		virtual ~AccessibleListBoxEntry();
 
@@ -126,6 +148,9 @@
 		AccessibleListBoxEntry(	SvTreeListBox& _rListBox, SvLBoxEntry* _pEntry,
 								const ::com::sun::star::uno::Reference<
 									::com::sun::star::accessibility::XAccessible >& _xParent );
+									
+		SvLBoxEntry* GetSvLBoxEntry() const { return m_pSvLBoxEntry; }
+									
 
 	protected:
 		// XTypeProvider
@@ -206,9 +231,15 @@
 		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();
 	};
 
 //........................................................................
diff --git a/main/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx b/main/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
index 45a9aeb..35fe521 100644
--- a/main/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
+++ b/main/accessibility/inc/accessibility/extended/accessibletablistboxtable.hxx
@@ -42,6 +42,8 @@
 {
 private:
 	SvHeaderTabListBox*		m_pTabListBox;
+	
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >  m_xCurChild;
 
 	void					ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
 	DECL_LINK(      		WindowEventListener, VclSimpleEvent* );
diff --git a/main/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx b/main/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
index a3f99ec..f1903cc 100644
--- a/main/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
+++ b/main/accessibility/inc/accessibility/extended/textwindowaccessibility.hxx
@@ -52,6 +52,22 @@
 #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>
@@ -578,7 +594,9 @@
     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();
@@ -630,6 +648,9 @@
     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 );
 
diff --git a/main/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx b/main/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx
index 27acbef..44fd7b6 100644
--- a/main/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx
+++ b/main/accessibility/inc/accessibility/helper/IComboListBoxHelper.hxx
@@ -42,6 +42,7 @@
 		virtual Rectangle		GetBoundingRectangle( sal_uInt16 nItem ) const = 0;
 		virtual Rectangle		GetWindowExtentsRelative( Window* pRelativeWindow ) = 0;
 		virtual sal_Bool        	IsActive() const = 0;
+		virtual sal_Bool        IsEnabled() const = 0;
 		virtual sal_Bool			IsEntryVisible( sal_uInt16 nPos ) const = 0;
 		virtual sal_uInt16			GetDisplayLineCount() const = 0;
 		virtual void            GetMaxVisColumnsAndLines( sal_uInt16& rnCols, sal_uInt16& rnLines ) const = 0;
diff --git a/main/accessibility/inc/accessibility/helper/accessiblestrings.hrc b/main/accessibility/inc/accessibility/helper/accessiblestrings.hrc
index 314e97d..ca08ccb 100644
--- a/main/accessibility/inc/accessibility/helper/accessiblestrings.hrc
+++ b/main/accessibility/inc/accessibility/helper/accessiblestrings.hrc
@@ -39,7 +39,18 @@
 #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 )
diff --git a/main/accessibility/inc/accessibility/helper/listboxhelper.hxx b/main/accessibility/inc/accessibility/helper/listboxhelper.hxx
index bf8532f..a7fb5ed 100644
--- a/main/accessibility/inc/accessibility/helper/listboxhelper.hxx
+++ b/main/accessibility/inc/accessibility/helper/listboxhelper.hxx
@@ -90,6 +90,11 @@
 		return m_aComboListBox.IsActive();
 	}
 	// -----------------------------------------------------------------------------
+    virtual sal_Bool        	IsEnabled() const
+	{
+		return m_aComboListBox.IsEnabled();
+	}
+	// -----------------------------------------------------------------------------
 	virtual sal_Bool			IsEntryVisible( sal_uInt16 nPos ) const
 	{
 		sal_uInt16 nTopEntry = m_aComboListBox.GetTopEntry();
diff --git a/main/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx b/main/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx
index d11cbc7..36c2699 100644
--- a/main/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx
+++ b/main/accessibility/inc/accessibility/standard/accessiblemenubasecomponent.hxx
@@ -109,6 +109,8 @@
     virtual sal_Bool		IsHighlighted();
     sal_Bool                IsChildHighlighted();
 
+	virtual sal_Bool 		IsMenuHideDisabledEntries();
+
 	void					SelectChild( sal_Int32 i );
 	void					DeSelectAll();
 	sal_Bool				IsChildSelected( sal_Int32 i );
diff --git a/main/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx b/main/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx
index 8a54d3d..9e4b889 100644
--- a/main/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx
+++ b/main/accessibility/inc/accessibility/standard/accessiblemenuitemcomponent.hxx
@@ -52,6 +52,8 @@
     ::rtl::OUString			GetAccessibleName();
     void					SetItemText( const ::rtl::OUString& sItemText );
     ::rtl::OUString			GetItemText();
+	
+	virtual sal_Bool 		IsMenuHideDisabledEntries();
 
     virtual void			FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
 
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx
index 5e58728..c0b0841 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessiblebox.hxx
@@ -30,13 +30,17 @@
 #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;
 
@@ -129,7 +133,22 @@
     */
 	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.
@@ -170,6 +189,8 @@
 	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.
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx
index 4ce4342..073ea43 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessiblelist.hxx
@@ -76,6 +76,7 @@
     /** 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
@@ -143,7 +144,14 @@
 	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;
@@ -155,7 +163,7 @@
 	sal_uInt16		m_nLastSelectedPos;
 	bool		m_bDisableProcessEvent;
 	bool		m_bVisible;
-
+	sal_uInt16	m_nCurSelectedPos;
 	
 
     /// The currently selected item.
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx
index e2cd2b7..d3573d4 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessiblelistitem.hxx
@@ -91,9 +91,9 @@
 		@param	_aNewValue
 			is the new value
 	*/
-	void 					NotifyAccessibleEvent(	sal_Int16 _nEventId,
+	/*void 					NotifyAccessibleEvent(	sal_Int16 _nEventId,
 													const ::com::sun::star::uno::Any& _aOldValue,
-													const ::com::sun::star::uno::Any& _aNewValue );
+													const ::com::sun::star::uno::Any& _aNewValue );*/
 
 protected:
 	virtual ~VCLXAccessibleListItem();
@@ -119,6 +119,7 @@
 							sal_Int32 _nIndexInParent,
 							const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& _xParent );
 
+	void 					NotifyAccessibleEvent(	sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _aOldValue, const ::com::sun::star::uno::Any& _aNewValue );
 
 	inline sal_Bool			IsSelected() const { return m_bSelected; }
 	void					SetSelected( sal_Bool _bSelected );
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx
index 061d771..ca2177c 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessiblemenu.hxx
@@ -76,6 +76,9 @@
 	virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
 	virtual ::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);
 	virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleAction
+	virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
 };
 
 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLEMENU_HXX
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx
index 90937a6..48ec08a 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessibleradiobutton.hxx
@@ -31,7 +31,7 @@
 #endif
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
 
-#ifndef _CPPUHELPER_IMPLBASE2_HXX
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
 #include <cppuhelper/implbase2.hxx>
 #endif
 
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx
index 7c9de74..f95d690 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessiblescrollbar.hxx
@@ -77,6 +77,10 @@
 	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);
+
+	// XAccessibleContext
+	::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
+
 };
 
 #endif // ACCESSIBILITY_STANDARD_VCLXACCESSIBLESCROLLBAR_HXX
diff --git a/main/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx b/main/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
index ac89424..f2847cd 100644
--- a/main/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
+++ b/main/accessibility/inc/accessibility/standard/vclxaccessibletoolboxitem.hxx
@@ -34,7 +34,7 @@
 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
-#ifndef _CPPUHELPER_IMPLBASE4_HXX
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
 #include <cppuhelper/implbase4.hxx>
 #endif
 #include <comphelper/accessibletexthelper.hxx>
diff --git a/main/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx b/main/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
index e6b2e94..61e24c1 100644
--- a/main/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
+++ b/main/accessibility/source/extended/AccessibleBrowseBoxHeaderCell.cxx
@@ -65,7 +65,7 @@
 		// 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/main/accessibility/source/extended/accessibleeditbrowseboxcell.cxx b/main/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
index de3436c..a92b233 100644
--- a/main/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
+++ b/main/accessibility/source/extended/accessibleeditbrowseboxcell.cxx
@@ -130,13 +130,15 @@
 		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/main/accessibility/source/extended/accessibleiconchoicectrl.cxx b/main/accessibility/source/extended/accessibleiconchoicectrl.cxx
index f2e0768..7d97b51 100644
--- a/main/accessibility/source/extended/accessibleiconchoicectrl.cxx
+++ b/main/accessibility/source/extended/accessibleiconchoicectrl.cxx
@@ -79,11 +79,36 @@
                     // 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 @@
 							uno::Any aOldValue, aNewValue;
 							aNewValue <<= xChild;
 							NotifyAccessibleEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aOldValue, aNewValue );
+							NotifyAccessibleEvent( AccessibleEventId::SELECTION_CHANGED, aOldValue, aNewValue );
 						}
 					}
 					break;
@@ -190,7 +216,8 @@
 	// -----------------------------------------------------------------------------
 	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/main/accessibility/source/extended/accessibleiconchoicectrlentry.cxx b/main/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
index 58a673c..96b2986 100644
--- a/main/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
+++ b/main/accessibility/source/extended/accessibleiconchoicectrlentry.cxx
@@ -351,7 +351,8 @@
 	// -----------------------------------------------------------------------------
 	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/main/accessibility/source/extended/accessiblelistbox.cxx b/main/accessibility/source/extended/accessiblelistbox.cxx
index 3befa3c..41e50ac 100644
--- a/main/accessibility/source/extended/accessiblelistbox.cxx
+++ b/main/accessibility/source/extended/accessiblelistbox.cxx
@@ -89,19 +89,25 @@
 			{
 				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;
 				}
@@ -112,17 +118,104 @@
                     // 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 @@
                             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 @@
 	{
 		::osl::MutexGuard aGuard( m_aMutex );
 
+		m_mapEntry.clear();
 		VCLXAccessibleComponent::disposing();
 	    m_xParent = NULL;
 	}
@@ -258,7 +409,9 @@
 		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 @@
 		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)
@@ -355,17 +553,20 @@
     	::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)
@@ -388,7 +589,9 @@
 
 			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/main/accessibility/source/extended/accessiblelistboxentry.cxx b/main/accessibility/source/extended/accessiblelistboxentry.cxx
index dc939b0..d8267cb 100644
--- a/main/accessibility/source/extended/accessiblelistboxentry.cxx
+++ b/main/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 @@
 	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 @@
 		AccessibleListBoxEntry_BASE	( m_aMutex ),
 		ListBoxAccessibleBase( _rListBox ),
 
+		m_pSvLBoxEntry  ( _pEntry ),
         m_nClientId     ( 0 ),
 		m_aParent		( _xParent )
 
@@ -109,6 +114,19 @@
         	dispose();
 		}
 	}
+	
+	// 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 @@
 	{
 		::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 @@
 		::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 @@
 				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 @@
     	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 @@
 		::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 @@
 
 		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 @@
     	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 @@
 		::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 @@
 		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 @@
 		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 @@
 		::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 @@
 
 		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/main/accessibility/source/extended/accessibletablistboxtable.cxx b/main/accessibility/source/extended/accessibletablistboxtable.cxx
index f4eede9..4080a92 100644
--- a/main/accessibility/source/extended/accessibletablistboxtable.cxx
+++ b/main/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 @@
 					}
 					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/main/accessibility/source/extended/textwindowaccessibility.cxx b/main/accessibility/source/extended/textwindowaccessibility.cxx
index bdbf9d2..1ac7816 100644
--- a/main/accessibility/source/extended/textwindowaccessibility.cxx
+++ b/main/accessibility/source/extended/textwindowaccessibility.cxx
@@ -41,6 +41,8 @@
 
 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 @@
         // 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 @@
         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 @@
 		{
 			// #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 @@
     }
     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 @@
             ::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 @@
                         ::css::uno::makeAny(
                             ::css::accessibility::AccessibleStateType::
                             FOCUSED));
-            }
+			*/
             break;
         }
     case VCLEVENT_WINDOW_LOSEFOCUS:
@@ -1647,7 +1807,24 @@
             ::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 @@
                             FOCUSED),
                         ::css::uno::Any());
             }
+			*/
             break;
         }
     }
@@ -2007,6 +2185,124 @@
     }
 }
 
+::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 @@
         ::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 @@
     }
     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 @@
     // notify selection changes
     notifySelectionChange( nFirst1, nLast1 );
     notifySelectionChange( nFirst2, nLast2 );
-
+	*/
     m_nSelectionFirstPara = nNewFirstPara;
     m_nSelectionFirstPos = nNewFirstPos;
     m_nSelectionLastPara = nNewLastPara;
diff --git a/main/accessibility/source/helper/accessiblestrings.src b/main/accessibility/source/helper/accessiblestrings.src
index d030161..29aac3c 100644
--- a/main/accessibility/source/helper/accessiblestrings.src
+++ b/main/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 @@
 	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/main/accessibility/source/helper/characterattributeshelper.cxx b/main/accessibility/source/helper/characterattributeshelper.cxx
index 4e31a52..b07325a 100644
--- a/main/accessibility/source/helper/characterattributeshelper.cxx
+++ b/main/accessibility/source/helper/characterattributeshelper.cxx
@@ -35,6 +35,8 @@
 
 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 @@
     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/main/accessibility/source/standard/accessiblemenubasecomponent.cxx b/main/accessibility/source/standard/accessiblemenubasecomponent.cxx
index f2600a0..099e851 100644
--- a/main/accessibility/source/standard/accessiblemenubasecomponent.cxx
+++ b/main/accessibility/source/standard/accessiblemenubasecomponent.cxx
@@ -134,15 +134,20 @@
 {
 	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 @@
 }
 
 // -----------------------------------------------------------------------------
+
+sal_Bool OAccessibleMenuBaseComponent::IsMenuHideDisabledEntries() 
+{
+	return sal_False;
+}
+
diff --git a/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx b/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx
index 5f95dba..3abf2de 100644
--- a/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx
+++ b/main/accessibility/source/standard/accessiblemenuitemcomponent.cxx
@@ -208,6 +208,18 @@
 		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,18 +252,19 @@
 
 void OAccessibleMenuItemComponent::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
 {
-	if ( IsEnabled() )
+	sal_Bool bEnabled = IsEnabled();
+	if ( bEnabled )
     {
         rStateSet.AddState( AccessibleStateType::ENABLED );
         rStateSet.AddState( AccessibleStateType::SENSITIVE );
     }
 
     if ( IsVisible() )
-    {
-        rStateSet.AddState( AccessibleStateType::VISIBLE );
-        rStateSet.AddState( AccessibleStateType::SHOWING );
-    }
-
+	{		
+		rStateSet.AddState( AccessibleStateType::SHOWING );
+		if( !IsMenuHideDisabledEntries() || bEnabled )
+			rStateSet.AddState( AccessibleStateType::VISIBLE );
+	}
     rStateSet.AddState( AccessibleStateType::OPAQUE );
 }
 
@@ -497,3 +510,23 @@
 }
 
 // -----------------------------------------------------------------------------
+
+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/main/accessibility/source/standard/vclxaccessiblebox.cxx b/main/accessibility/source/standard/vclxaccessiblebox.cxx
index ef84090..69b9d36 100644
--- a/main/accessibility/source/standard/vclxaccessiblebox.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblebox.cxx
@@ -116,11 +116,98 @@
 {
 	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 @@
             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 @@
 
 		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 @@
                 }
             }
             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 @@
                 {
                     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 @@
     // 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 @@
 
     // 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 @@
 	::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 @@
 	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/main/accessibility/source/standard/vclxaccessiblebutton.cxx b/main/accessibility/source/standard/vclxaccessiblebutton.cxx
index 32de93b..ffaf0e3 100644
--- a/main/accessibility/source/standard/vclxaccessiblebutton.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblebutton.cxx
@@ -103,6 +103,16 @@
 
 		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 @@
 	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/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx b/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx
index 8f8cc9c..c222b95 100644
--- a/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblecheckbox.cxx
@@ -238,7 +238,13 @@
 	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/main/accessibility/source/standard/vclxaccessiblelist.cxx b/main/accessibility/source/standard/vclxaccessiblelist.cxx
index 9eb11f7..dd7aed5 100644
--- a/main/accessibility/source/standard/vclxaccessiblelist.cxx
+++ b/main/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 @@
 	  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 @@
         }
     }
     UpdateVisibleLineCount();
+	m_nCurSelectedPos=m_pListBoxHelper->GetSelectEntryPos();
 
 	sal_uInt16 nCount = static_cast<sal_uInt16>(getAccessibleChildCount());
 	m_aAccessibleChildren.reserve(nCount);
@@ -188,6 +196,218 @@
 	}
 }
 // -----------------------------------------------------------------------------
+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 @@
 		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 @@
                 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);
+	            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; 
 
-				NotifyAccessibleEvent(	AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
-										aOldValue,
-										aNewValue );
+						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 @@
             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 @@
 		// 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 @@
 		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 @@
 
 void VCLXAccessibleList::HandleChangedItemList (bool bItemInserted, sal_Int32 nIndex)
 {
+	// IAccessible2 implementation 2009
+	/*
     if ( !bItemInserted )
 	{
 		if ( nIndex == -1 ) // special handling here
@@ -368,7 +625,8 @@
 	}
 	else
 		getAccessibleChild(nIndex);
-
+	*/	
+	clearItems();	
     NotifyAccessibleEvent (
         AccessibleEventId::INVALIDATE_ALL_CHILDREN,
         Any(), Any());
@@ -600,6 +858,7 @@
 		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 @@
 					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 @@
 			}
 		}
 	}
-
-    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 @@
 			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 @@
 			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/main/accessibility/source/standard/vclxaccessiblelistitem.cxx b/main/accessibility/source/standard/vclxaccessiblelistitem.cxx
index f0190cf..e52fde1 100644
--- a/main/accessibility/source/standard/vclxaccessiblelistitem.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblelistitem.cxx
@@ -317,9 +317,15 @@
 	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/main/accessibility/source/standard/vclxaccessiblemenu.cxx b/main/accessibility/source/standard/vclxaccessiblemenu.cxx
index d8be8c1..386ac83 100644
--- a/main/accessibility/source/standard/vclxaccessiblemenu.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblemenu.cxx
@@ -249,3 +249,14 @@
 }
 
 // -----------------------------------------------------------------------------
+
+::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/main/accessibility/source/standard/vclxaccessiblemenuitem.cxx b/main/accessibility/source/standard/vclxaccessiblemenuitem.cxx
index 4914f08..2b9262d 100644
--- a/main/accessibility/source/standard/vclxaccessiblemenuitem.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblemenuitem.cxx
@@ -191,8 +191,19 @@
 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 @@
 
 	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/main/accessibility/source/standard/vclxaccessibleradiobutton.cxx b/main/accessibility/source/standard/vclxaccessibleradiobutton.cxx
index 369f5b7..a2e492e 100644
--- a/main/accessibility/source/standard/vclxaccessibleradiobutton.cxx
+++ b/main/accessibility/source/standard/vclxaccessibleradiobutton.cxx
@@ -197,8 +197,7 @@
 
 	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/main/accessibility/source/standard/vclxaccessiblescrollbar.cxx b/main/accessibility/source/standard/vclxaccessiblescrollbar.cxx
index 2ec8e26..0e62987 100644
--- a/main/accessibility/source/standard/vclxaccessiblescrollbar.cxx
+++ b/main/accessibility/source/standard/vclxaccessiblescrollbar.cxx
@@ -88,7 +88,8 @@
 	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 @@
 }
 
 // -----------------------------------------------------------------------------
+
+// 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/main/accessibility/source/standard/vclxaccessibletabcontrol.cxx b/main/accessibility/source/standard/vclxaccessibletabcontrol.cxx
index ad7ffbb..2929920 100644
--- a/main/accessibility/source/standard/vclxaccessibletabcontrol.cxx
+++ b/main/accessibility/source/standard/vclxaccessibletabcontrol.cxx
@@ -81,7 +81,8 @@
 
 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/main/accessibility/source/standard/vclxaccessibletextcomponent.cxx b/main/accessibility/source/standard/vclxaccessibletextcomponent.cxx
index 46015cd..3c34166 100644
--- a/main/accessibility/source/standard/vclxaccessibletextcomponent.cxx
+++ b/main/accessibility/source/standard/vclxaccessibletextcomponent.cxx
@@ -189,10 +189,62 @@
 
     if ( GetWindow() )
     {
-        Font aFont = GetWindow()->GetControlFont();
-        sal_Int32 nBackColor = GetWindow()->GetControlBackground().GetColor();
-        sal_Int32 nColor = GetWindow()->GetControlForeground().GetColor();
-        ::std::auto_ptr< CharacterAttributesHelper > pHelper( new CharacterAttributesHelper( aFont, nBackColor, nColor ) );
+		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/main/accessibility/source/standard/vclxaccessibletoolbox.cxx b/main/accessibility/source/standard/vclxaccessibletoolbox.cxx
index bef15c5..6c245d3 100644
--- a/main/accessibility/source/standard/vclxaccessibletoolbox.cxx
+++ b/main/accessibility/source/standard/vclxaccessibletoolbox.cxx
@@ -208,7 +208,7 @@
 	{
 		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::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 @@
                 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 @@
 	// 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/main/accessibility/source/standard/vclxaccessibletoolboxitem.cxx b/main/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
index 101b6a5..cf231cb 100644
--- a/main/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
+++ b/main/accessibility/source/standard/vclxaccessibletoolboxitem.cxx
@@ -97,6 +97,10 @@
 			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 @@
 //				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::SetChecked( sal_Bool _bCheck )
 {
+	if( m_nRole	== AccessibleRole::PANEL)
+		return;
 	if ( m_bIsChecked != _bCheck )
 	{
 		Any aOldValue;
@@ -370,11 +388,19 @@
 {
 	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 @@
 	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 @@
 	if ( m_pToolBox )
 		aValue <<= (sal_Int32)m_pToolBox->IsItemChecked( m_nItemId );
 
+	if( m_nRole == AccessibleRole::PANEL )
+		aValue <<= (sal_Int32)0;
 	return aValue;
 }
 // -----------------------------------------------------------------------------
diff --git a/main/chart2/source/controller/accessibility/AccessibleBase.cxx b/main/chart2/source/controller/accessibility/AccessibleBase.cxx
index fa99993..dbf7b4e 100644
--- a/main/chart2/source/controller/accessibility/AccessibleBase.cxx
+++ b/main/chart2/source/controller/accessibility/AccessibleBase.cxx
@@ -651,7 +651,9 @@
 sal_Int16 SAL_CALL AccessibleBase::getAccessibleRole()
     throw (RuntimeException)
 {
-    return AccessibleRole::LIST_ITEM; // #i73747# role SHAPE seems more appropriate, but is not read
+	//IAccessibility2 Implementation 2009-----
+    return AccessibleRole::SHAPE/*LIST_ITEM*/; // #i73747# role SHAPE seems more appropriate, but is not read
+	//-----IAccessibility2 Implementation 2009
 }
 
 Reference< XAccessibleRelationSet > SAL_CALL AccessibleBase::getAccessibleRelationSet()
diff --git a/main/chart2/source/controller/dialogs/tp_DataSource.cxx b/main/chart2/source/controller/dialogs/tp_DataSource.cxx
index 2ae5f0f..21ee6cf 100644
--- a/main/chart2/source/controller/dialogs/tp_DataSource.cxx
+++ b/main/chart2/source/controller/dialogs/tp_DataSource.cxx
@@ -69,10 +69,13 @@
 String lcl_GetRoleLBEntry(
     const OUString & rRole, const OUString & rRange )
 {
-    String aEntry( rRole );
-    aEntry += '\t';
-    aEntry += String(
-        ::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
+//IAccessibility2 Implementation 2009-----
+    //String aEntry( rRole );
+    //aEntry += '\t';
+    //aEntry += String(
+    //    ::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
+    String aEntry(::chart::DialogModel::ConvertRoleFromInternalToUI( rRole ));
+	//-----IAccessibility2 Implementation 2009
     aEntry += '\t';
     aEntry += String( rRange );
 
@@ -139,10 +142,12 @@
     return aResult;
 }
 
+//IAccessibility2 Implementation 2009-----
 static long lcl_pRoleListBoxTabs[] =
-	{	3,        // Number of Tabs
-		0, 0, 75
+	{	2,        // Number of Tabs
+		0, 75
 	};
+//-----IAccessibility2 Implementation 2009
 
 void lcl_ShowChooserButton(
     ::chart::RangeSelectionButton & rChooserButton,
diff --git a/main/cui/source/customize/cfg.cxx b/main/cui/source/customize/cfg.cxx
index 7012341..86c5371 100644
--- a/main/cui/source/customize/cfg.cxx
+++ b/main/cui/source/customize/cfg.cxx
@@ -1662,7 +1662,7 @@
     aDescriptionField.SetControlBackground( GetSettings().GetStyleSettings().GetDialogColor() );
     aDescriptionField.SetAutoScroll( sal_True );
     aDescriptionField.EnableCursor( sal_False );
-
+	//IAccessibility2 Implementation 2009-----
 	aMoveUpButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_UP)));
 	aMoveDownButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_DOWN)));
 	aMoveUpButton.SetAccessibleRelationMemberOf(&aContentsSeparator);
@@ -1671,6 +1671,7 @@
 	aModifyTopLevelButton.SetAccessibleRelationMemberOf(&aTopLevelSeparator);
 	aAddCommandsButton.SetAccessibleRelationMemberOf(&aContentsSeparator);
 	aModifyCommandButton.SetAccessibleRelationMemberOf(&aContentsSeparator);
+	//-----IAccessibility2 Implementation 2009
 }
 
 SvxConfigPage::~SvxConfigPage()
@@ -2929,9 +2930,10 @@
 		LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
 	aMoveDownButton.SetClickHdl	(
 		LINK( this, SvxMainMenuOrganizerDialog, MoveHdl) );
-
+	//IAccessibility2 Implementation 2009-----
 	aMoveUpButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_UP)));
 	aMoveDownButton.SetAccessibleName(String(CUI_RES(BUTTON_STR_DOWN)));
+	//-----IAccessibility2 Implementation 2009
 }
 
 IMPL_LINK(SvxMainMenuOrganizerDialog, ModifyHdl, Edit*, pEdit)
diff --git a/main/cui/source/customize/cfg.src b/main/cui/source/customize/cfg.src
index a1456fd..2bb1bac 100644
--- a/main/cui/source/customize/cfg.src
+++ b/main/cui/source/customize/cfg.src
@@ -822,7 +822,7 @@
 {
 	Text [ en-US ] = "Rename Toolbar";
 };
-
+//IAccessibility2 Implementation 2009-----
 String BUTTON_STR_UP
 {
 	Text [ en-US ] = "Up";
@@ -831,4 +831,5 @@
 {
 	Text [ en-US ] = "Down";
 };
+//-----IAccessibility2 Implementation 2009
 
diff --git a/main/cui/source/customize/macropg.cxx b/main/cui/source/customize/macropg.cxx
index b367e42..78e5885 100644
--- a/main/cui/source/customize/macropg.cxx
+++ b/main/cui/source/customize/macropg.cxx
@@ -166,6 +166,9 @@
     maHeaderBar( this, WB_BUTTONSTYLE | WB_BOTTOMBORDER )
 {
     maListBox.SetHelpId( HID_MACRO_HEADERTABLISTBOX );
+
+	// enable the cell focus to show visible focus
+	maListBox.EnableCellFocus();
 }
 
 _HeaderTabListBox::~_HeaderTabListBox()
diff --git a/main/cui/source/dialogs/cuigrfflt.cxx b/main/cui/source/dialogs/cuigrfflt.cxx
index f5af0b4..47cb390 100644
--- a/main/cui/source/dialogs/cuigrfflt.cxx
+++ b/main/cui/source/dialogs/cuigrfflt.cxx
@@ -535,7 +535,8 @@
 	maCbxInvert.Check( bInvert );
 	maCbxInvert.SetToggleHdl( GetModifyHdl() );
 
-	maMtrThreshold.GrabFocus();
+	// IAccessibility2 Implementation 2009
+	// maMtrThreshold.GrabFocus();
 }
 
 // -----------------------------------------------------------------------------
@@ -595,7 +596,8 @@
 	maMtrSepia.SetValue( nSepiaPercent );
 	maMtrSepia.SetModifyHdl( GetModifyHdl() );
 
-	maMtrSepia.GrabFocus();
+	// IAccessibility2 Implementation 2009
+	// maMtrSepia.GrabFocus();
 }
 
 // -----------------------------------------------------------------------------
@@ -646,7 +648,9 @@
     maNumPoster.SetLast( rGraphic.GetBitmapEx().GetBitCount() );
 	maNumPoster.SetValue( nPosterCount );
 	maNumPoster.SetModifyHdl( GetModifyHdl() );
-	maNumPoster.GrabFocus();
+
+	// IAccessibility2 Implementation 2009
+	// maNumPoster.GrabFocus();
 }
 
 // -----------------------------------------------------------------------------
diff --git a/main/cui/source/dialogs/iconcdlg.cxx b/main/cui/source/dialogs/iconcdlg.cxx
index baebc89..79a64bb 100644
--- a/main/cui/source/dialogs/iconcdlg.cxx
+++ b/main/cui/source/dialogs/iconcdlg.cxx
@@ -456,6 +456,11 @@
 	ActivatePageImpl( );
     if(bInvalidate)
         Invalidate();
+
+	// IA2 CWS. MT: I guess we want the event now, and not in Paint()?
+	IconChoicePageData* pData = GetPageData ( mnCurrentPageId );
+	if(pData)
+		ShowPageImpl ( pData );
 }
 
 /**********************************************************************
diff --git a/main/cui/source/inc/cuicharmap.hxx b/main/cui/source/inc/cuicharmap.hxx
index 6cb8bc9..35e01fa 100644
--- a/main/cui/source/inc/cuicharmap.hxx
+++ b/main/cui/source/inc/cuicharmap.hxx
@@ -82,7 +82,12 @@
 friend class SvxCharacterMap;
     SfxModalDialog* mpDialog;
 
+    FixedText       aFontText;
+    ListBox         aFontLB;
+    FixedText       aSubsetText;
+    ListBox         aSubsetLB;
     SvxShowCharSet  aShowSet;
+    FixedText       aSymbolText;
     SvxShowText     aShowText;
 //    SvxShowText     aShowShortcut;
     OKButton        aOKBtn;
@@ -90,11 +95,6 @@
     HelpButton      aHelpBtn;
     PushButton      aDeleteBtn;
 //    PushButton		aAssignBtn;
-    FixedText       aFontText;
-    ListBox         aFontLB;
-    FixedText       aSubsetText;
-    ListBox         aSubsetLB;
-    FixedText       aSymbolText;
     SvxShowText     aShowChar;
     FixedText       aCharCodeText;
 //	FixedText		aAssignText;
diff --git a/main/cui/source/inc/headertablistbox.hxx b/main/cui/source/inc/headertablistbox.hxx
index 627c808..89fb186 100644
--- a/main/cui/source/inc/headertablistbox.hxx
+++ b/main/cui/source/inc/headertablistbox.hxx
@@ -31,8 +31,8 @@
 class _HeaderTabListBox : public Control
 {
 private:
-	SvHeaderTabListBox			maListBox;
 	HeaderBar					maHeaderBar;
+	SvHeaderTabListBox			maListBox;
 protected:
 	DECL_LINK( HeaderEndDrag_Impl, HeaderBar* );
 	virtual long				Notify( NotifyEvent& rNEvt );
diff --git a/main/cui/source/tabpages/autocdlg.cxx b/main/cui/source/tabpages/autocdlg.cxx
index 0906dbc..1ce1b2d 100644
--- a/main/cui/source/tabpages/autocdlg.cxx
+++ b/main/cui/source/tabpages/autocdlg.cxx
@@ -2052,12 +2052,12 @@
 
     sStandard(CUI_RES(ST_STANDARD))
 {
-	aSglStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_STD) ) );
-	aDblStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_STD) ) );
-	aStartQuotePB.SetAccessibleName( String(CUI_RES(STR_PB_DBL_START) ));
-	aEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_END) ));
-	aSglStartQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_START) ));
-	aSglEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_END) ) );
+	//aSglStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_STD) ) );
+	//aDblStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_STD) ) );
+	//aStartQuotePB.SetAccessibleName( String(CUI_RES(STR_PB_DBL_START) ));
+	//aEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_END) ));
+	//aSglStartQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_START) ));
+	//aSglEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_END) ) );
 
 	FreeResource();
 	
@@ -2100,6 +2100,15 @@
 	aDblStandardPB.SetClickHdl(LINK(this, 	OfaQuoteTabPage, StdQuoteHdl));
 	aSglStandardPB.SetClickHdl(LINK(this, 	OfaQuoteTabPage, StdQuoteHdl));
 
+	//IAccessibility2 Implementation 2009-----
+	// Move down from the position before FreeResource() 
+	// For lost help ID issue
+	aSglStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_STD) ) );
+	aDblStandardPB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_STD) ) );
+	aStartQuotePB.SetAccessibleName( String(CUI_RES(STR_PB_DBL_START) ));
+	aEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_DBL_END) ));
+	aSglStartQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_START) ));
+	aSglEndQuotePB.SetAccessibleName(String(CUI_RES(STR_PB_SGL_END) ) );
 	aSglStartQuotePB.SetAccessibleRelationLabeledBy( &aSglStartQuoteFT );
 	aSglEndQuotePB.SetAccessibleRelationLabeledBy( &aSglEndQuoteFT );
 	aSglStartQuotePB.SetAccessibleRelationMemberOf( &aSingleFL );
diff --git a/main/cui/source/tabpages/autocdlg.src b/main/cui/source/tabpages/autocdlg.src
index 5b21a73..cef73a3 100644
--- a/main/cui/source/tabpages/autocdlg.src
+++ b/main/cui/source/tabpages/autocdlg.src
@@ -493,6 +493,30 @@
     {
         Text [ en-US ] = "Delete words with two initial capitals" ;
 	};
+	String STR_PB_SGL_STD
+    {
+        Text [ en-US ] = "Single quotes default" ;
+	};
+	String STR_PB_DBL_STD
+    {
+        Text [ en-US ] = "Double quotes default" ;
+	};
+	String STR_PB_SGL_START
+    {
+        Text [ en-US ] = "Start quote of single quotes" ;
+	};
+	String STR_PB_DBL_START
+    {
+        Text [ en-US ] = "Start quote of double quotes" ;
+	};
+	String STR_PB_SGL_END
+    {
+        Text [ en-US ] = "End quote of single quotes" ;
+	};
+	String STR_PB_DBL_END
+    {
+        Text [ en-US ] = "End quote of double quotes" ;
+	};
 };
 /**************************************************************************/
 /*                                                                        */
@@ -661,30 +685,6 @@
     {
         Text [ en-US ] = "Default" ;
 	};
-	String STR_PB_SGL_STD
-    {
-        Text [ en-US ] = "Single quotes default" ;
-	};
-	String STR_PB_DBL_STD
-    {
-        Text [ en-US ] = "Double quotes default" ;
-	};
-	String STR_PB_SGL_START
-    {
-        Text [ en-US ] = "Start quote of single quotes" ;
-	};
-	String STR_PB_DBL_START
-    {
-        Text [ en-US ] = "Start quote of double quotes" ;
-	};
-	String STR_PB_SGL_END
-    {
-        Text [ en-US ] = "End quote of single quotes" ;
-	};
-	String STR_PB_DBL_END
-    {
-        Text [ en-US ] = "End quote of double quotes" ;
-	};
 };
 
 /**************************************************************************/
diff --git a/main/cui/source/tabpages/connect.hrc b/main/cui/source/tabpages/connect.hrc
index 42c069f..67aaebc 100644
--- a/main/cui/source/tabpages/connect.hrc
+++ b/main/cui/source/tabpages/connect.hrc
@@ -39,3 +39,5 @@
 #define FT_TYPE 8
 #define LB_TYPE 1
 #define CTL_PREVIEW 1
+//IAccessibility2 Implementation 2009-----
+#define STR_EXAMPLE 1
diff --git a/main/cui/source/tabpages/tabarea.src b/main/cui/source/tabpages/tabarea.src
index 7081bf8..191bec3 100644
--- a/main/cui/source/tabpages/tabarea.src
+++ b/main/cui/source/tabpages/tabarea.src
@@ -875,6 +875,9 @@
         Pos = MAP_APPFONT ( 12 , 25  ) ;
 		Size = MAP_APPFONT ( 72 , 72 ) ;
 		TabStop = TRUE ;
+		//IAccessibility2 Implementation 2009-----
+		Text [ en-US ] = "Pattern Editor";
+		//-----IAccessibility2 Implementation 2009
 	};
     FixedText FT_COLOR
 	{
@@ -1316,12 +1319,18 @@
         Border = TRUE;
         Pos = MAP_APPFONT ( 157 , 14  ) ;
         Size = MAP_APPFONT ( 34 , 25 ) ;
+        // IAccessibility2 implementation 2009. ------
+		Text [ en-US ] = "Old Color" ;
+		// ------ IAccessibility2 implementation 2009.
 	};
 	Control CTL_PREVIEW_NEW
 	{
         Border = TRUE;
         Pos = MAP_APPFONT ( 157, 39  ) ;
         Size = MAP_APPFONT ( 34 , 25 ) ;
+        // IAccessibility2 implementation 2009. ------
+        Text [ en-US ] = "New Color" ;
+        // ------ IAccessibility2 implementation 2009.
 	};
     ListBox LB_COLORMODEL
 	{
diff --git a/main/cui/source/tabpages/tparea.cxx b/main/cui/source/tabpages/tparea.cxx
index 748cf99..208949f 100644
--- a/main/cui/source/tabpages/tparea.cxx
+++ b/main/cui/source/tabpages/tparea.cxx
@@ -2213,6 +2213,11 @@
 	aMtrFldYOffset.Show();
     aFlPosition.Show();
 	aRbtRow.Show();
+//IAccessible2 Implementation 2009-----
+	//Solution:Check one when initializing.
+	if(!aRbtRow.IsChecked()&&!aRbtColumn.IsChecked())
+	        aRbtRow.Check();
+//-----IAccessible2 Implementation 2009
 	aRbtColumn.Show();
 	aMtrFldOffset.Show();
     aFlOffset.Show();
diff --git a/main/curl/curl-7.19.7_win.patch b/main/curl/curl-7.19.7_win.patch
index 3f08fd2..bc59433 100644
--- a/main/curl/curl-7.19.7_win.patch
+++ b/main/curl/curl-7.19.7_win.patch
@@ -1,19 +1,19 @@
---- misc/curl-7.19.7/lib/Makefile.vc9	2009-11-04 13:35:39.000000000 +0100

-+++ misc/build/curl-7.19.7/lib/Makefile.vc9	2009-11-18 12:32:57.234375000 +0100

-@@ -46,13 +46,13 @@

- # Stem for static libs and DLLs

- #

- LIB_NAME       = libcurl

--LIB_NAME_DEBUG = libcurld

-+LIB_NAME_DEBUG = libcurl

- 

- #

- # Stem for DLL import libs

- #

--IMPLIB_NAME       = libcurl_imp

--IMPLIB_NAME_DEBUG = libcurld_imp

-+IMPLIB_NAME       = libcurl

-+IMPLIB_NAME_DEBUG = libcurl

- 

- !IFNDEF OPENSSL_PATH

- OPENSSL_PATH   = ../../openssl-0.9.8g

+--- misc/curl-7.19.7/lib/Makefile.vc9	2009-11-04 13:35:39.000000000 +0100
++++ misc/build/curl-7.19.7/lib/Makefile.vc9	2009-11-18 12:32:57.234375000 +0100
+@@ -46,13 +46,13 @@
+ # Stem for static libs and DLLs
+ #
+ LIB_NAME       = libcurl
+-LIB_NAME_DEBUG = libcurld
++LIB_NAME_DEBUG = libcurl
+ 
+ #
+ # Stem for DLL import libs
+ #
+-IMPLIB_NAME       = libcurl_imp
+-IMPLIB_NAME_DEBUG = libcurld_imp
++IMPLIB_NAME       = libcurl
++IMPLIB_NAME_DEBUG = libcurl
+ 
+ !IFNDEF OPENSSL_PATH
+ OPENSSL_PATH   = ../../openssl-0.9.8g
diff --git a/main/default_images/svx/res/symphony/  b/main/default_images/svx/res/symphony/ 
new file mode 100755
index 0000000..263af5d
--- /dev/null
+++ b/main/default_images/svx/res/symphony/ 
Binary files differ
diff --git a/main/editeng/inc/editeng/AccessibleEditableTextPara.hxx b/main/editeng/inc/editeng/AccessibleEditableTextPara.hxx
index 565ff38..d41730b 100644
--- a/main/editeng/inc/editeng/AccessibleEditableTextPara.hxx
+++ b/main/editeng/inc/editeng/AccessibleEditableTextPara.hxx
@@ -373,6 +373,13 @@
         /// Check whether 0<=nStart<=n and 0<=nEnd<=n
         void CheckRange( sal_Int32 nStart, sal_Int32 nEnd ) SAL_THROW((::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException));
 
+//IAccessibility2 Implementation 2009-----
+		void _correctValues( const sal_Int32 nIndex, ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues );
+	 	sal_Int32 SkipField(sal_Int32 nIndex, sal_Bool bForward);
+	 // get overlapped field, extend return string. Only extend forward for now
+		sal_Bool ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment );
+		String GetFieldTypeNameAtIndex(sal_Int32 nIndex);
+//-----IAccessibility2 Implementation 2009
         // the paragraph index in the edit engine (guarded by solar mutex)
         sal_Int32	mnParagraphIndex;
 
@@ -400,6 +407,14 @@
 
         /// Our listeners (guarded by maMutex)
         int mnNotifierClientId;
+	//IAccessibility2 Implementation 2009-----
+public:
+		void SetParagraphBackColorAccessible(const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > & ref)
+		{ m_xAccInfo = ref ;}		
+private:
+		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > m_xAccInfo;
+        //virtual sal_Bool IsShapeParaFocusable( );
+	//-----IAccessibility2 Implementation 2009
 
         // --> OD 2006-01-11 #i27138#
         // the paragraph manager, which created this instance - is NULL, if
diff --git a/main/editeng/inc/editeng/AccessibleSvxFindReplaceDialog.hxx b/main/editeng/inc/editeng/AccessibleSvxFindReplaceDialog.hxx
new file mode 100644
index 0000000..3e913ee
--- /dev/null
+++ b/main/editeng/inc/editeng/AccessibleSvxFindReplaceDialog.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************

+*

+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

+*

+*  Copyright IBM Corporation 2010.

+* Copyright 2000, 2010 Oracle and/or its affiliates.

+*

+* OpenOffice.org - a multi-platform office productivity suite

+*

+* This file is part of OpenOffice.org.

+*

+* OpenOffice.org is free software: you can redistribute it and/or modify

+* it under the terms of the GNU Lesser General Public License version 3

+* only, as published by the Free Software Foundation.

+*

+* OpenOffice.org is distributed in the hope that it will be useful,

+* but WITHOUT ANY WARRANTY; without even the implied warranty of

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+* GNU Lesser General Public License version 3 for more details

+* (a copy is included in the LICENSE file that accompanied this code).

+*

+* You should have received a copy of the GNU Lesser General Public License

+* version 3 along with OpenOffice.org.  If not, see

+* <http://www.openoffice.org/license.html>

+* for a copy of the LGPLv3 License.

+*

+************************************************************************/

+#ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
+#define _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#include <toolkit/awt/vclxwindow.hxx>
+#endif
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#endif
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+#include <toolkit/awt/vclxwindows.hxx>
+#endif
+
+
+class VCLXAccessibleSvxFindReplaceDialog : public VCLXAccessibleComponent
+{
+public:
+	VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow);
+	virtual ~VCLXAccessibleSvxFindReplaceDialog();
+	virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+	// XServiceInfo
+	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+class VCLXSvxFindReplaceDialog : public VCLXDialog
+{
+public:
+	VCLXSvxFindReplaceDialog(Window* pSplDlg)
+	{
+		SetWindow(pSplDlg);
+	}
+	virtual ~VCLXSvxFindReplaceDialog()
+	{};
+private:	
+    virtual ::com::sun::star::uno::Reference<
+        ::com::sun::star::accessibility::XAccessibleContext >  CreateAccessibleContext()
+	{
+		return new VCLXAccessibleSvxFindReplaceDialog(this);		 
+	}
+};
+#endif // _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
diff --git a/main/editeng/inc/editeng/editdata.hxx b/main/editeng/inc/editeng/editdata.hxx
index c324e70..65a4b1b 100644
--- a/main/editeng/inc/editeng/editdata.hxx
+++ b/main/editeng/inc/editeng/editdata.hxx
@@ -363,7 +363,10 @@
     EE_NOTIFY_INPUT_START,
 
     /// Denotes the end of a high-level action triggered by a key press
-    EE_NOTIFY_INPUT_END
+    EE_NOTIFY_INPUT_END,
+//IAccessibility2 Implementation 2009-----
+	EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA
+//-----IAccessibility2 Implementation 2009
 };
 
 struct EENotify
diff --git a/main/editeng/inc/editeng/editeng.hxx b/main/editeng/inc/editeng/editeng.hxx
index 44df410..a6afcc0 100644
--- a/main/editeng/inc/editeng/editeng.hxx
+++ b/main/editeng/inc/editeng/editeng.hxx
@@ -108,6 +108,9 @@
 #define GETATTRIBS_CHARATTRIBS  (sal_uInt8)0x04
 #define GETATTRIBS_ALL          (sal_uInt8)0xFF
 
+//IAccessibility2 Implementation 2009-----
+class SdrObject;
+//-----IAccessibility2 Implementation 2009
 class EDITENG_DLLPUBLIC EditEngine
 {
 	friend class EditView;
@@ -145,6 +148,9 @@
 
 	void			SetUpdateMode( sal_Bool bUpdate );
 	sal_Bool			GetUpdateMode() const;
+	//IAccessible2 migration fix
+	void					SetUpdateModeForAcc( sal_Bool bUp);
+	sal_Bool				GetUpdateModeForAcc( ) const;
 
 	void			SetBackgroundColor( const Color& rColor );
 	Color			GetBackgroundColor() const;
@@ -469,7 +475,9 @@
 	static void		ImportBulletItem( SvxNumBulletItem& rNumBullet, sal_uInt16 nLevel, const SvxBulletItem* pOldBullet, const SvxLRSpaceItem* pOldLRSpace );
 	static sal_Bool 	IsPrintable( sal_Unicode c ) { return ( ( c >= 32 ) && ( c != 127 ) ); }
     static sal_Bool     HasValidData( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& rTransferable );
-
+	//IAccessibility2 Implementation 2009-----
+	virtual SdrObject* GetCurTextObj() { return NULL; }
+	//-----IAccessibility2 Implementation 2009
 	/** sets a link that is called at the beginning of a drag operation at an edit view */
 	void			SetBeginDropHdl( const Link& rLink );
 	Link			GetBeginDropHdl() const;
diff --git a/main/editeng/inc/editeng/editrids.hrc b/main/editeng/inc/editeng/editrids.hrc
index 38c57db..7816fed 100644
--- a/main/editeng/inc/editeng/editrids.hrc
+++ b/main/editeng/inc/editeng/editrids.hrc
@@ -373,8 +373,10 @@
 #define RID_STR_WORD						(RID_EDIT_START + 313)
 #define RID_SVXSTR_A11Y_IMAGEBULLET_DESCRIPTION	(RID_EDIT_START + 314)
 #define RID_SVXSTR_A11Y_IMAGEBULLET_NAME		(RID_EDIT_START + 315)
+#define RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION	(RID_EDIT_START + 316)
+#define RID_SVXSTR_A11Y_PARAGRAPH_NAME			(RID_EDIT_START + 317)
 
-#if 315 > (RID_EDIT_END-RID_EDIT_START)
+#if 317 > (RID_EDIT_END-RID_EDIT_START)
 #error Resource-Ueberlauf in #line, #file
 #endif
 
diff --git a/main/editeng/inc/editeng/editview.hxx b/main/editeng/inc/editeng/editview.hxx
index 35ab892..c61709a 100644
--- a/main/editeng/inc/editeng/editview.hxx
+++ b/main/editeng/inc/editeng/editview.hxx
@@ -219,6 +219,10 @@
 
 	sal_Bool			IsCursorAtWrongSpelledWord( sal_Bool bMarkIfWrong = sal_False );
 	sal_Bool			IsWrongSpelledWordAtPos( const Point& rPosPixel, sal_Bool bMarkIfWrong = sal_False );
+	//IAccessibility2 Implementation 2009-----
+    	sal_Bool IsShapeParaFocusable( ) ;
+    sal_Bool WrongSpelledBreakPara(sal_Int32 nPara,sal_uInt16& nStartIndex, sal_uInt16& nEndIndex,sal_Int32 nIndex);
+	//-----IAccessibility2 Implementation 2009
 	void			SpellIgnoreWord();
 	void			ExecuteSpellPopup( const Point& rPosPixel, Link* pCallBack = 0 );
 
diff --git a/main/editeng/inc/editeng/splwrap.hxx b/main/editeng/inc/editeng/splwrap.hxx
index ae26b6c..142ea1f 100644
--- a/main/editeng/inc/editeng/splwrap.hxx
+++ b/main/editeng/inc/editeng/splwrap.hxx
@@ -39,7 +39,8 @@
 }}}}
 
 class Window;
-
+//IAccessibility2 Impplementaton 2009-----
+class SdrObject;
 // misc functions ---------------------------------------------------------------
 
 void EDITENG_DLLPUBLIC SvxPrepareAutoCorrect( String &rOldText, String &rNewText );
@@ -61,6 +62,8 @@
 		::com::sun::star::linguistic2::XSpellChecker1 > xSpell;
 	::com::sun::star::uno::Reference<
 		::com::sun::star::linguistic2::XHyphenator > 	xHyph;
+//IAccessibility2 Impplementaton 2009-----
+	SdrObject* mpTextObj;
 	sal_uInt16 	nOldLang; 		// Sprache merken, nur bei Aenderung SetLanguage rufen
 	sal_Bool 	bOtherCntnt : 1; // gesetzt => Sonderbereiche zunaechst pruefen
 	sal_Bool 	bDialog		: 1; // Ist pWin der Svx...Dialog?
@@ -151,6 +154,10 @@
 	virtual void AutoCorrect( const String& rAktStr, const String& rNewStr );
 	virtual void InsertHyphen( const sal_uInt16 nPos ); // Hyphen einfuegen
 
+//IAccessibility2 Impplementaton 2009-----
+	void SetCurTextObj( SdrObject* pObj ) { mpTextObj = pObj; }
+	SdrObject* GetCurTextObj() { return mpTextObj; }
+//-----IAccessibility2 Impplementaton 2009
 };
 
 #endif
diff --git a/main/editeng/inc/editeng/unoedhlp.hxx b/main/editeng/inc/editeng/unoedhlp.hxx
index c44f281..1a62bf8 100644
--- a/main/editeng/inc/editeng/unoedhlp.hxx
+++ b/main/editeng/inc/editeng/unoedhlp.hxx
@@ -60,7 +60,17 @@
 	void	SetStartValue( sal_uLong n );
 	void	SetEndValue( sal_uLong n );
 };
-
+//IAccessibility2 Implementation 2009-----
+class SvxEditSourceHintEndPara :public SvxEditSourceHint
+{
+public:
+	TYPEINFO();
+	SvxEditSourceHintEndPara( sal_uInt32 nId )
+		:SvxEditSourceHint(nId) {}
+	SvxEditSourceHintEndPara( sal_uInt32 nId, sal_uInt32 nValue, sal_uInt32 nStart=0, sal_uInt32 nEnd=0 )
+		:SvxEditSourceHint(nId,nValue,nStart){ (void)nEnd; }
+};
+//-----IAccessibility2 Implementation 2009
 /** Helper class for common functionality in edit sources
  */
 class EDITENG_DLLPUBLIC SvxEditSourceHelper
@@ -97,7 +107,10 @@
 
         @return sal_True, if the range has been successfully determined
      */
-    static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex );
+	//IAccessibility2 Implementation 2009-----
+    //static sal_Bool GetAttributeRun( USHORT& nStartIndex, USHORT& nEndIndex, const EditEngine& rEE, USHORT nPara, USHORT nIndex );
+    static sal_Bool GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell=sal_False );
+	//-----IAccessibility2 Implementation 2009
 
     /** Convert point from edit engine to user coordinate space
 
diff --git a/main/editeng/inc/editeng/unoedprx.hxx b/main/editeng/inc/editeng/unoedprx.hxx
index 5ae47c7..3a8c8b3 100644
--- a/main/editeng/inc/editeng/unoedprx.hxx
+++ b/main/editeng/inc/editeng/unoedprx.hxx
@@ -74,9 +74,12 @@
 	virtual OutputDevice*	GetRefDevice() const;
     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
-    virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
-    virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+	//IAccessibility2 Implementation 2009-----
+	virtual void	SetUpdateModeForAcc( sal_Bool bUp);
+	virtual sal_Bool	GetUpdateModeForAcc() const;
+    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
+    virtual sal_uInt16		GetLineCount( sal_uInt16 nPara ) const;
+    virtual sal_uInt16		GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
     virtual sal_uInt16          GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nIndex ) const;
     
diff --git a/main/editeng/inc/editeng/unoedsrc.hxx b/main/editeng/inc/editeng/unoedsrc.hxx
index e0e347c..d384eb8 100644
--- a/main/editeng/inc/editeng/unoedsrc.hxx
+++ b/main/editeng/inc/editeng/unoedsrc.hxx
@@ -219,7 +219,12 @@
         Index of paragraph to query bullet info on
      */
     virtual EBulletInfo     GetBulletInfo( sal_uInt16 nPara ) const = 0;
-
+//IAccessibility2 Implementation 2009-----
+     virtual String       GetNumStr(sal_uInt16) const { return XubString();};
+    //IAccessible2 migration fix
+    virtual void					SetUpdateModeForAcc( sal_Bool ) {};
+	virtual sal_Bool					GetUpdateModeForAcc() const { return sal_True; };
+//-----IAccessibility2 Implementation 2009
     /** Query the bounding rectangle of the given character
 
         @param nPara[0 .. n]
@@ -331,7 +336,10 @@
 
         @return sal_True, if the range has been successfully determined
      */
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+	//IAccessibility2 Implementation 2009-----
+//    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const = 0;
+    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const = 0;
+	//-----IAccessibility2 Implementation 2009
 
     /** Query number of lines in the formatted paragraph
 
@@ -542,6 +550,11 @@
      */
     virtual sal_Bool Paste() = 0;
 
+//IAccessibility2 Implementation 2009-----
+    virtual sal_Bool IsWrongSpelledWordAtPos( sal_Int32, sal_Int32 ) { return sal_False; };
+    virtual sal_Bool IsShapeParaFocusable( ) { return sal_True; };
+    virtual sal_Bool BreakParaWrongList(sal_Int32, sal_uInt16&, sal_uInt16&, sal_Int32){ return sal_False; };
+//-----IAccessibility2 Implementation 2009
 };
 
 #endif
diff --git a/main/editeng/inc/editeng/unofored.hxx b/main/editeng/inc/editeng/unofored.hxx
index 4ae9eb2..ab0093b 100644
--- a/main/editeng/inc/editeng/unofored.hxx
+++ b/main/editeng/inc/editeng/unofored.hxx
@@ -72,7 +72,10 @@
 	virtual OutputDevice*	GetRefDevice() const;
     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+	//IAccessibility2 Implementation 2009-----
+//    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
+	//-----IAccessibility2 Implementation 2009
     virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
     virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
diff --git a/main/editeng/inc/editeng/unoforou.hxx b/main/editeng/inc/editeng/unoforou.hxx
index fa63e54..cfb81d4 100644
--- a/main/editeng/inc/editeng/unoforou.hxx
+++ b/main/editeng/inc/editeng/unoforou.hxx
@@ -93,7 +93,10 @@
 	virtual OutputDevice*	GetRefDevice() const;
     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+	//IAccessibility2 Implementation 2009-----
+//    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
+	//-----IAccessibility2 Implementation 2009
     virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
     virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nPara, sal_uInt16 nLine ) const;
diff --git a/main/editeng/inc/editeng/unotext.hxx b/main/editeng/inc/editeng/unotext.hxx
index 0865693..248721a 100644
--- a/main/editeng/inc/editeng/unotext.hxx
+++ b/main/editeng/inc/editeng/unotext.hxx
@@ -218,7 +218,10 @@
 	virtual OutputDevice*	GetRefDevice() const;
     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+	//IAccessibility2 Implementation 2009-----
+//    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
+    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
+	//-----IAccessibility2 Implementation 2009
     virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
     virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
diff --git a/main/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/main/editeng/source/accessibility/AccessibleEditableTextPara.cxx
index 6cbcc7b..d0159ac 100644
--- a/main/editeng/source/accessibility/AccessibleEditableTextPara.cxx
+++ b/main/editeng/source/accessibility/AccessibleEditableTextPara.cxx
@@ -56,6 +56,7 @@
 #include <editeng/unoprnms.hxx>
 #include <editeng/unoipset.hxx>
 #include <editeng/outliner.hxx>
+#include <svl/intitem.hxx>
 
 //------------------------------------------------------------------------
 //
@@ -75,7 +76,13 @@
 #include "AccessibleHyperlink.hxx"
 
 #include <svtools/colorcfg.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include <algorithm>
+using namespace std;
+#include "editeng.hrc"
+#include <editeng/eerdll.hxx>
+#include <editeng/numitem.hxx>
+//-----IAccessibility2 Implementation 2009
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::beans;
@@ -90,12 +97,14 @@
 
 namespace accessibility
 {
+//IAccessibility2 Implementation 2009-----
 
     const SvxItemPropertySet* ImplGetSvxCharAndParaPropertiesSet()
     {
         // PropertyMap for character and paragraph properties
         static const SfxItemPropertyMapEntry aPropMap[] =
         {
+			SVX_UNOEDIT_OUTLINER_PROPERTIES,
             SVX_UNOEDIT_CHAR_PROPERTIES,
             SVX_UNOEDIT_PARA_PROPERTIES,
             SVX_UNOEDIT_NUMBERING_PROPERTIE,
@@ -215,7 +224,12 @@
         DBG_WARNING( "AccessibleEditableTextPara::implGetParagraphBoundary: only a base implementation, ignoring the index" );
 
         rBoundary.startPos = 0;
-        rBoundary.endPos = GetTextLen();
+	//IAccessibility2 Implementation 2009-----   
+        //rBoundary.endPos = GetTextLen();
+        ::rtl::OUString sText( implGetText() );
+        sal_Int32 nLength = sText.getLength();
+        rBoundary.endPos = nLength;
+	//-----IAccessibility2 Implementation 2009
     }
 
     void AccessibleEditableTextPara::implGetLineBoundary( ::com::sun::star::i18n::Boundary& rBoundary, sal_Int32 nIndex )
@@ -359,13 +373,11 @@
     {
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
 
-        mpEditSource = pEditSource;
-
         WeakBullet::HardRefType aChild( maImageBullet.get() );
         if( aChild.is() )
             aChild->SetEditSource(pEditSource);
 
-        if( !mpEditSource )
+        if( !pEditSource ) 
         {
             // going defunc
             UnSetState( AccessibleStateType::SHOWING );
@@ -375,7 +387,9 @@
 
             Dispose();
         }
-
+//IAccessibility2 Implementation 2009-----
+		mpEditSource = pEditSource; 
+//-----IAccessibility2 Implementation 2009
         // #108900# Init last text content
         try
         {
@@ -751,7 +765,11 @@
             !pStateSet->contains(nStateId) )
         {
             pStateSet->AddState( nStateId );
+//IAccessibility2 Implementation 2009-----
+		// MT: Removed method IsShapeParaFocusable which was introduced with IA2 - basically it was only about figuring out wether or not the window has the focus, should be solved differently
+		// if(IsShapeParaFocusable())
             GotPropertyEvent( uno::makeAny( nStateId ), AccessibleEventId::STATE_CHANGED );
+//-----IAccessibility2 Implementation 2009
         }
     }
 
@@ -806,7 +824,10 @@
         // must provide XAccesibleText by hand, since it comes publicly inherited by XAccessibleEditableText
         if ( rType == ::getCppuType((uno::Reference< XAccessibleText > *)0) )
         {
+	//IAccessibility2 Implementation 2009-----
+			//	uno::Reference< XAccessibleText > aAccText = this;
             uno::Reference< XAccessibleText > aAccText = static_cast< XAccessibleEditableText * >(this);
+	//-----IAccessibility2 Implementation 2009
             aRet <<= aAccText;
         }
         else if ( rType == ::getCppuType((uno::Reference< XAccessibleEditableText > *)0) )
@@ -814,11 +835,13 @@
             uno::Reference< XAccessibleEditableText > aAccEditText = this;
             aRet <<= aAccEditText;
         }
-        else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) )
+	//IAccessibility2 Implementation 2009-----
+	else if ( rType == ::getCppuType((uno::Reference< XAccessibleHypertext > *)0) )
         {
             uno::Reference< XAccessibleHypertext > aAccHyperText = this;
             aRet <<= aAccHyperText;
         }
+	//-----IAccessibility2 Implementation 2009
         else
         {
             aRet = AccessibleTextParaInterfaceBase::queryInterface(rType);
@@ -916,19 +939,67 @@
     ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleDescription() throw (uno::RuntimeException)
     {
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
+	//IAccessibility2 Implementation 2009-----
+        ::vos::OGuard aGuard( Application::GetSolarMutex() );
 
-//        ::vos::OGuard aGuard( Application::GetSolarMutex() );
+        // append first 40 characters from text, or first line, if shorter
+        // (writer takes first sentence here, but that's not supported
+        // from EditEngine)
+        // throws if defunc
+        ::rtl::OUString aLine;
 
-        return ::rtl::OUString();
+        if( getCharacterCount() )
+            aLine = getTextAtIndex(0, AccessibleTextType::LINE).SegmentText;
+
+        // Get the string from the resource for the specified id.
+        String sStr = ::rtl::OUString( String( EditResId (RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION ) ) );
+        String sParaIndex = ::rtl::OUString::valueOf( GetParagraphIndex() );
+		sStr.SearchAndReplace( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "$(ARG)" )),
+                               sParaIndex );
+
+        if( aLine.getLength() > MaxDescriptionLen )
+        {
+            ::rtl::OUString aCurrWord;
+            sal_Int32 i;
+
+            // search backward from MaxDescriptionLen for previous word start
+            for( aCurrWord=getTextAtIndex(MaxDescriptionLen, AccessibleTextType::WORD).SegmentText,
+                     i=MaxDescriptionLen,
+                     aLine=::rtl::OUString();
+                 i>=0;
+                 --i )
+            {
+                if( getTextAtIndex(i, AccessibleTextType::WORD).SegmentText != aCurrWord )
+                {
+                    if( i == 0 )
+                        // prevent completely empty string
+                        aLine = getTextAtIndex(0, AccessibleTextType::WORD).SegmentText;
+                    else
+                        aLine = getTextRange(0, i);
+                }
+            }
+        }
+
+        return ::rtl::OUString( sStr ) + aLine;
+	//-----IAccessibility2 Implementation 2009
     }
 
     ::rtl::OUString SAL_CALL AccessibleEditableTextPara::getAccessibleName() throw (uno::RuntimeException)
     {
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
 
-//        ::vos::OGuard aGuard( Application::GetSolarMutex() );
+        ::vos::OGuard aGuard( Application::GetSolarMutex() );
 
-        return ::rtl::OUString();
+        // throws if defunc
+        sal_Int32 nPara( GetParagraphIndex() );
+
+        // Get the string from the resource for the specified id.
+        String sStr = ::rtl::OUString( String( EditResId (RID_SVXSTR_A11Y_PARAGRAPH_NAME) ) );
+        String sParaIndex = ::rtl::OUString::valueOf( nPara );
+		sStr.SearchAndReplace( String::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( "$(ARG)" )),
+                               sParaIndex );
+
+        return ::rtl::OUString( sStr );
     }
 
     uno::Reference< XAccessibleRelationSet > SAL_CALL AccessibleEditableTextPara::getAccessibleRelationSet() throw (uno::RuntimeException)
@@ -987,7 +1058,18 @@
 
         if( !pStateSet )
             return uno::Reference<XAccessibleStateSet>();
-
+//IAccessibility2 Implementation 2009-----
+		uno::Reference<XAccessibleStateSet> xParentStates;
+		if (getAccessibleParent().is())
+		{
+			uno::Reference<XAccessibleContext> xParentContext = getAccessibleParent()->getAccessibleContext();
+			xParentStates = xParentContext->getAccessibleStateSet();
+		}
+		if (xParentStates.is() && xParentStates->contains(AccessibleStateType::EDITABLE) )
+		{
+			pStateSet->AddState(AccessibleStateType::EDITABLE);
+		}
+//-----IAccessibility2 Implementation 2009
         return uno::Reference<XAccessibleStateSet>( new ::utl::AccessibleStateSetHelper (*pStateSet) );
     }
 
@@ -1209,6 +1291,17 @@
             GetParagraphIndex() == aSelection.nEndPara )
         {
             // caret is always nEndPara,nEndPos
+			//IAccessibility2 Implementation 2009-----
+			EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+			if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND &&
+				aBulletInfo.bVisible && 
+				aBulletInfo.nType != SVX_NUM_BITMAP )
+			{
+				sal_Int32 nBulletLen = aBulletInfo.aText.Len();
+				if( aSelection.nEndPos - nBulletLen >= 0 )
+					return aSelection.nEndPos - nBulletLen;
+			}
+			//-----IAccessibility2 Implementation 2009
             return aSelection.nEndPos;
         }
 
@@ -1234,19 +1327,172 @@
 
         return OCommonAccessibleText::getCharacter( nIndex );
     }
+    //IAccessibility2 Implementation 2009-----
+	static uno::Sequence< ::rtl::OUString > getAttributeNames()
+	{
+		static uno::Sequence< ::rtl::OUString >* pNames = NULL;
+
+		if( pNames == NULL )
+		{
+			uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 21 );
+			::rtl::OUString* pStrings = pSeq->getArray();
+			sal_Int32 i = 0;
+	#define STR(x) pStrings[i++] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(x))
+			//STR("CharBackColor");
+			STR("CharColor");
+	  STR("CharContoured");
+	  STR("CharEmphasis");
+			STR("CharEscapement");
+			STR("CharFontName");
+			STR("CharHeight");
+			STR("CharPosture");
+	  STR("CharShadowed");
+			STR("CharStrikeout");
+			STR("CharUnderline");		
+			STR("CharUnderlineColor");
+			STR("CharWeight");			
+		        STR("NumberingLevel");
+			STR("NumberingRules");
+			STR("ParaAdjust");
+			STR("ParaBottomMargin");
+			STR("ParaFirstLineIndent");
+			STR("ParaLeftMargin");
+			STR("ParaLineSpacing");
+			STR("ParaRightMargin");
+			STR("ParaTabStops");
+	#undef STR
+			DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+			if( i != pSeq->getLength() )
+				pSeq->realloc( i );
+			pNames = pSeq;
+		}
+		return *pNames;
+	}
+//-----IAccessibility2 Implementation 2009
+	struct IndexCompare
+	{
+		const PropertyValue* pValues;
+		IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+		bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+		{
+			return (pValues[a].Name < pValues[b].Name) ? true : false;
+		}
+	};
+
+	String AccessibleEditableTextPara::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
+	{
+		String strFldType;
+        SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+		//For field object info
+		sal_Int32 nParaIndex = GetParagraphIndex();
+		sal_Int32 nAllFieldLen = 0;
+		sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+		EFieldInfo ree;
+		sal_Int32  reeBegin, reeEnd;
+		sal_Int32 nFieldType = -1;
+		for(sal_uInt16 j = 0; j < nField; j++)
+		{
+			ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+			reeBegin  = ree.aPosition.nIndex + nAllFieldLen;
+			reeEnd = reeBegin + ree.aCurrentText.Len();
+			nAllFieldLen += (ree.aCurrentText.Len() - 1);
+			if( reeBegin > nIndex )
+			{
+				break;
+			}
+			if(  nIndex >= reeBegin && nIndex < reeEnd )
+			{
+				nFoundFieldIndex = j;
+				break;
+			}
+		}
+		if( nFoundFieldIndex >= 0  )
+		{
+			// So we get a field, check its type now.
+			nFieldType = ree.pFieldItem->GetField()->GetClassId() ;
+		}
+		switch(nFieldType)
+		{
+		case SVX_DATEFIELD:
+			{
+				const SvxDateField* pDateField = static_cast< const SvxDateField* >(ree.pFieldItem->GetField());
+				if (pDateField)
+				{
+					if (pDateField->GetType() == SVXDATETYPE_FIX)
+						strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date (fixed)"));
+					else if (pDateField->GetType() == SVXDATETYPE_VAR)
+						strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("date (variable)"));
+				}
+			}
+			break;
+		case SVX_PAGEFIELD:
+			strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("page-number"));
+			break;
+		//support the sheet name & pages fields
+		case SVX_PAGESFIELD:
+				strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("page-count"));
+			break;
+		case SVX_TABLEFIELD:
+				strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("sheet-name"));
+			break;
+		//End
+		case SVX_TIMEFIELD:
+			strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time"));
+			break;
+		case SVX_EXT_TIMEFIELD:
+			{
+				const SvxExtTimeField* pTimeField = static_cast< const SvxExtTimeField* >(ree.pFieldItem->GetField());
+				if (pTimeField)
+				{
+					if (pTimeField->GetType() == SVXTIMETYPE_FIX)
+						strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time (fixed)"));
+					else if (pTimeField->GetType() == SVXTIMETYPE_VAR)
+						strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("time (variable)"));
+				}
+			}
+			break;
+		case SVX_AUTHORFIELD:
+			strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("author"));
+			break;
+		case SVX_EXT_FILEFIELD:
+		case SVX_FILEFIELD:
+			strFldType = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("file name"));
+		default:
+			break;
+		}
+		return strFldType;
+	}
 
     uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleEditableTextPara::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     {
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
+	
+		//IAccessibility2 Implementation 2009-----
+		//Skip the bullet range to ingnore the bullet text 
+		SvxTextForwarder& rCacheTF = GetTextForwarder();
+		EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+		if (aBulletInfo.bVisible)
+			nIndex += aBulletInfo.aText.Len();
+		if (nIndex != 0 && nIndex >= getCharacterCount())
+			nIndex = getCharacterCount()-1;
+		//
+		if (nIndex != 0)
+			CheckIndex(nIndex);	// may throw IndexOutOfBoundsException
 
-        CheckIndex(nIndex);	// may throw IndexOutOfBoundsException
-
+		bool bSupplementalMode = false;
+		uno::Sequence< ::rtl::OUString > aPropertyNames = rRequestedAttributes;
+		if (aPropertyNames.getLength() == 0)
+		{
+			bSupplementalMode = true;
+			aPropertyNames = getAttributeNames();
+		}
         // get default attribues...
-        ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( rRequestedAttributes ) );
+        ::comphelper::SequenceAsHashMap aPropHashMap( getDefaultAttributes( aPropertyNames ) );
 
         // ... and override them with the direct attributes from the specific position
-        uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, rRequestedAttributes ) );
+        uno::Sequence< beans::PropertyValue > aRunAttribs( getRunAttributes( nIndex, aPropertyNames ) );
+		//-----IAccessibility2 Implementation 2009
         sal_Int32 nRunAttribs = aRunAttribs.getLength();
         const beans::PropertyValue *pRunAttrib = aRunAttribs.getConstArray();
         for (sal_Int32 k = 0;  k < nRunAttribs;  ++k)
@@ -1294,8 +1540,58 @@
             rRes.Handle = -1;
             rRes.State  = bIsDirectVal ? PropertyState_DIRECT_VALUE : PropertyState_DEFAULT_VALUE;
         }
-
-        return aRes;
+		//IAccessibility2 Implementation 2009-----
+		if( bSupplementalMode )
+		{
+			_correctValues( nIndex, aRes );
+			// NumberingPrefix		
+			nRes = aRes.getLength();
+			aRes.realloc( nRes + 1 );
+			pRes = aRes.getArray();
+			beans::PropertyValue &rRes = pRes[nRes];
+			rRes.Name = rtl::OUString::createFromAscii("NumberingPrefix");
+			::rtl::OUString numStr;
+			if (aBulletInfo.nType != SVX_NUM_CHAR_SPECIAL && aBulletInfo.nType != SVX_NUM_BITMAP)
+				numStr = (::rtl::OUString)aBulletInfo.aText;
+			rRes.Value <<= numStr;
+			rRes.Handle = -1;
+			rRes.State = PropertyState_DIRECT_VALUE;
+			//-----IAccessibility2 Implementation 2009
+			//For field object.
+			String strFieldType = GetFieldTypeNameAtIndex(nIndex);
+			if (strFieldType.Len() > 0)
+			{
+				nRes = aRes.getLength();
+				aRes.realloc( nRes + 1 );
+				pRes = aRes.getArray();
+				beans::PropertyValue &rResField = pRes[nRes];
+				beans::PropertyValue aFieldType;
+				rResField.Name = rtl::OUString::createFromAscii("FieldType");
+				rResField.Value <<= rtl::OUString(strFieldType.ToLowerAscii());
+				rResField.Handle = -1;
+				rResField.State = PropertyState_DIRECT_VALUE;
+        }
+		//sort property values
+		// build sorted index array
+		sal_Int32 nLength = aRes.getLength();
+		const beans::PropertyValue* pPairs = aRes.getConstArray();
+		sal_Int32* pIndices = new sal_Int32[nLength];
+		sal_Int32 i = 0;
+		for( i = 0; i < nLength; i++ )
+			pIndices[i] = i;
+		sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+		// create sorted sequences accoring to index array
+		uno::Sequence<beans::PropertyValue> aNewValues( nLength );
+		beans::PropertyValue* pNewValues = aNewValues.getArray();
+		for( i = 0; i < nLength; i++ )
+		{
+			pNewValues[i] = pPairs[pIndices[i]];
+		}
+		delete[] pIndices;
+		//
+        return aNewValues;
+		}
+		return aRes;
     }
 
     awt::Rectangle SAL_CALL AccessibleEditableTextPara::getCharacterBounds( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
@@ -1350,7 +1646,10 @@
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
 
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+	//IAccessibility2 Implementation 2009-----
+	if ((rPoint.X <= 0) && (rPoint.Y <= 0))
+		return 0;
+	//-----IAccessibility2 Implementation 2009
         sal_uInt16 nPara, nIndex;
 
         // offset from surrounding cell/shape
@@ -1482,7 +1781,277 @@
 
         return OCommonAccessibleText::getTextRange(nStartIndex, nEndIndex);
     }
+//IAccessibility2 Implementation 2009-----
+	void AccessibleEditableTextPara::_correctValues( const sal_Int32 nIndex,
+										   uno::Sequence< PropertyValue >& rValues)
+	{
+		SvxTextForwarder& rCacheTF = GetTextForwarder();
+		sal_Int32 nRes = rValues.getLength();
+		beans::PropertyValue *pRes = rValues.getArray();
+		for (sal_Int32 i = 0;  i < nRes;  ++i)
+		{
+			beans::PropertyValue &rRes = pRes[i];
+			// Char color
+			if (rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharColor"))==0)
+			{
+				uno::Any &anyChar = rRes.Value;
+				sal_uInt32 crChar = (sal_uInt32)(anyChar.pReserved);					
+				if (COL_AUTO == crChar )
+				{
+					uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent;
+					if (mxParent.is())
+					{
+						xComponent.set(mxParent,uno::UNO_QUERY);
+					}
+					else
+					{
+						xComponent.set(m_xAccInfo,uno::UNO_QUERY);
+					}
+					if (xComponent.is())
+					{
+						uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY);
+						if (xContext->getAccessibleRole() == AccessibleRole::SHAPE 
+							|| xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+						{
+							anyChar <<= COL_BLACK;
+						}
+						else
+						{
+							Color cr(xComponent->getBackground());
+							crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
+							anyChar <<= crChar;
+						}
+					}
+				}
+				continue;
+			}
+			// Underline
+			if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharUnderline"))==0)
+			{	
+				/*
+				// MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
+				if (IsCurrentEditorEnableAutoSpell( mxParent ))
+				{
+					try
+					{
+						SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False );
+						sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
+						if ( bWrong )
+						{
+							uno::Any &anyUnderLine = pRes[9].Value;
+							// MT IA2: Not needed? sal_uInt16 crUnderLine = (sal_uInt16)(anyUnderLine.pReserved);		
+							anyUnderLine <<= (sal_uInt16)UNDERLINE_WAVE;
+						}
+					}
+					catch( const uno::RuntimeException& )
+					{
+					}
+				}
+				*/
+				continue;
+			}
+			// Underline color && Mis-spell
+			if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("CharUnderlineColor"))==0)
+			{	
+				uno::Any &anyCharUnderLine = rRes.Value;
+				sal_uInt32 crCharUnderLine = (sal_uInt32)(anyCharUnderLine.pReserved);					
+				if (COL_AUTO == crCharUnderLine )
+				{
+					uno::Reference< ::com::sun::star::accessibility::XAccessibleComponent > xComponent;
+					if (mxParent.is())
+					{
+						xComponent.set(mxParent,uno::UNO_QUERY);
+					}
+					else
+					{
+						xComponent.set(m_xAccInfo,uno::UNO_QUERY);
+					}
+					if (xComponent.is())
+					{
+						uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > xContext(xComponent,uno::UNO_QUERY);
+						if (xContext->getAccessibleRole() == AccessibleRole::SHAPE 
+							|| xContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+						{
+							anyCharUnderLine <<= COL_BLACK;
+						}
+						else
+						{
+							Color cr(xComponent->getBackground());
+							crCharUnderLine = cr.IsDark() ? COL_WHITE : COL_BLACK;
+							anyCharUnderLine <<= crCharUnderLine;
+						}
+					}
+				}
+				// MT: Implement XAccessibleTextMarkup, mark with TextMarkupType::SPELLCHECK. This way done in SW.
+				/*
+				if (IsCurrentEditorEnableAutoSpell( mxParent ))
+				{
+					try
+					{
+						SvxEditViewForwarder& rCacheVF = GetEditViewForwarder( sal_False );
+						sal_Bool bWrong = rCacheVF.IsWrongSpelledWordAtPos( GetParagraphIndex(), nIndex );
+						if ( bWrong )
+						{
+							uno::Any &anyUnderLineColor = rRes.Value;
+							// MT IA2: Not needed? sal_uInt16 crUnderLineColor = (sal_uInt16)(anyUnderLineColor.pReserved);		
+							anyUnderLineColor <<= COL_LIGHTRED;
+						}
+					}
+					catch( const uno::RuntimeException& )
+					{
+					}
+				}
+				*/				
+				continue;
+			}
+			// NumberingLevel
+			if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("NumberingLevel"))==0)
+			{				
+				const SvxNumBulletItem& rNumBullet = ( SvxNumBulletItem& )rCacheTF.GetParaAttribs(static_cast< sal_uInt16 >(GetParagraphIndex())).Get(EE_PARA_NUMBULLET);
+				if(rNumBullet.GetNumRule()->GetLevelCount()==0)
+				{
+					rRes.Value <<= (sal_Int16)-1;
+					rRes.Handle = -1;
+					rRes.State = PropertyState_DIRECT_VALUE;
+				}
+				else
+				{
+//					SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
+//						ImplGetSvxCharAndParaPropertiesMap() );
+					// MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
+            		SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() );
 
+					aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) );
+					rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); 
+					rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex );
+					rRes.Handle = -1;
+				}
+				continue;
+			}
+			// NumberingRules	
+			if(rRes.Name.compareTo(::rtl::OUString::createFromAscii("NumberingRules"))==0)
+			{
+				SfxItemSet aAttribs = rCacheTF.GetParaAttribs( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+				sal_Bool bVis = ((const SfxUInt16Item&)aAttribs.Get( EE_PARA_BULLETSTATE )).GetValue() ? sal_True : sal_False;
+				if(bVis)
+				{
+					rRes.Value <<= (sal_Int16)-1;
+					rRes.Handle = -1;
+					rRes.State = PropertyState_DIRECT_VALUE;
+				}
+				else
+				{
+					// MT IA2 TODO: Check if this is the correct replacement for ImplGetSvxCharAndParaPropertiesMap
+            		SvxAccessibleTextPropertySet aPropSet( &GetEditSource(), ImplGetSvxTextPortionSvxPropertySet() );
+					aPropSet.SetSelection( MakeSelection( 0, GetTextLen() ) );
+					rRes.Value = aPropSet._getPropertyValue( rRes.Name, mnParagraphIndex ); 
+					rRes.State = aPropSet._getPropertyState( rRes.Name, mnParagraphIndex );
+					rRes.Handle = -1;
+				}
+				continue;
+			}
+		}
+	}
+    sal_Int32 AccessibleEditableTextPara::SkipField(sal_Int32 nIndex, sal_Bool bForward)
+    {
+		sal_Int32 nParaIndex = GetParagraphIndex();
+		SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+		sal_Int32 nAllFieldLen = 0;
+		sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+		EFieldInfo ree;
+		sal_Int32  reeBegin=0, reeEnd=0;
+		for(sal_uInt16 j = 0; j < nField; j++)
+		{
+			ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+			reeBegin  = ree.aPosition.nIndex + nAllFieldLen;
+			reeEnd = reeBegin + ree.aCurrentText.Len();
+			nAllFieldLen += (ree.aCurrentText.Len() - 1);
+			if( reeBegin > nIndex )
+			{
+				break;
+			}
+			if(  nIndex >= reeBegin && nIndex < reeEnd )
+			{
+				if(ree.pFieldItem->GetField()->GetClassId() != SVX_URLFIELD)
+				{
+					nFoundFieldIndex = j;
+					break;
+				}
+			}
+		}
+		if( nFoundFieldIndex >= 0  )
+		{
+			if( bForward ) 
+				return reeEnd - 1;
+			else 
+				return reeBegin;
+		}
+		return nIndex;
+    }
+    sal_Bool AccessibleEditableTextPara::ExtendByField( ::com::sun::star::accessibility::TextSegment& Segment )
+    {
+		sal_Int32 nParaIndex = GetParagraphIndex();
+		SvxAccessibleTextAdapter& rCacheTF = GetTextForwarder();
+		sal_Int32 nAllFieldLen = 0;
+		sal_Int32 nField = rCacheTF.GetFieldCount(sal_uInt16(nParaIndex)), nFoundFieldIndex = -1;
+		EFieldInfo ree;
+		sal_Int32  reeBegin=0, reeEnd=0;
+		for(sal_uInt16 j = 0; j < nField; j++)
+		{
+			ree = rCacheTF.GetFieldInfo(sal_uInt16(nParaIndex), j);
+			reeBegin  = ree.aPosition.nIndex + nAllFieldLen;
+			reeEnd = reeBegin + ree.aCurrentText.Len();
+			nAllFieldLen += (ree.aCurrentText.Len() - 1);
+			if( reeBegin > Segment.SegmentEnd )
+			{
+				break;
+			}
+			if(  (Segment.SegmentEnd > reeBegin && Segment.SegmentEnd <= reeEnd) ||
+			      (Segment.SegmentStart >= reeBegin && Segment.SegmentStart < reeEnd)  )
+			{
+				if(ree.pFieldItem->GetField()->GetClassId() != SVX_URLFIELD)
+				{
+					nFoundFieldIndex = j;
+					break;
+				}
+			}
+		}
+		sal_Bool bExtend = sal_False;
+		if( nFoundFieldIndex >= 0 )
+		{
+			if( Segment.SegmentEnd < reeEnd ) 
+			{
+				Segment.SegmentEnd  = reeEnd;
+				bExtend = sal_True;
+			}
+			if( Segment.SegmentStart > reeBegin ) 
+			{
+				Segment.SegmentStart = reeBegin;
+				bExtend = sal_True;
+			}
+			if( bExtend )
+			{				
+				//If there is a bullet before the field, should add the bullet length into the segment.
+				EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo(sal_uInt16(nParaIndex));
+				int nBulletLen = aBulletInfo.aText.Len();
+				if (nBulletLen > 0)
+				{
+					Segment.SegmentEnd += nBulletLen;
+					if (nFoundFieldIndex > 0)
+						Segment.SegmentStart += nBulletLen;
+					Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);
+					//After get the correct field name, should restore the offset value which don't contain the bullet.
+					Segment.SegmentEnd -= nBulletLen;
+					if (nFoundFieldIndex > 0)
+						Segment.SegmentStart -= nBulletLen;
+				}
+				else
+					Segment.SegmentText = GetTextRange(Segment.SegmentStart, Segment.SegmentEnd);				
+			}
+		}
+		return bExtend;
+    }
+//-----IAccessibility2 Implementation 2009
     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleEditableTextPara::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     {
         DBG_CHKTHIS( AccessibleEditableTextPara, NULL );
@@ -1498,6 +2067,15 @@
 
         switch( aTextType )
         {
+	//IAccessibility2 Implementation 2009-----
+		case AccessibleTextType::CHARACTER:
+		case AccessibleTextType::WORD:				
+		{
+			aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
+			ExtendByField( aResult );
+			break;
+            	}
+	//-----IAccessibility2 Implementation 2009
             // Not yet handled by OCommonAccessibleText. Missing
             // implGetAttributeRunBoundary() method there
             case AccessibleTextType::ATTRIBUTE_RUN:
@@ -1512,17 +2090,86 @@
                 else
                 {
                     sal_uInt16 nStartIndex, nEndIndex;
-
+					//For the bullet paragraph, the bullet string is ingnored for IAText::attributes() function.
+					SvxTextForwarder&	rCacheTF = GetTextForwarder();
+					// MT IA2: Not used? sal_Int32 nBulletLen = 0;
+					EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+					if (aBulletInfo.bVisible)
+						nIndex += aBulletInfo.aText.Len();
+					if (nIndex != 0  && nIndex >= getCharacterCount())
+						nIndex = getCharacterCount()-1;
+					CheckPosition(nIndex);
                     if( GetAttributeRun(nStartIndex, nEndIndex, nIndex) )
                     {
                         aResult.SegmentText = GetTextRange(nStartIndex, nEndIndex);
+						if (aBulletInfo.bVisible)
+						{
+							nStartIndex -= aBulletInfo.aText.Len();
+							nEndIndex -= aBulletInfo.aText.Len();
+						}
                         aResult.SegmentStart = nStartIndex;
                         aResult.SegmentEnd = nEndIndex;
                     }
+		}
+                break;
+            }
+//IAccessibility2 Implementation 2009-----
+            case AccessibleTextType::LINE:
+            {
+                SvxTextForwarder&	rCacheTF = GetTextForwarder();
+                sal_Int32			nParaIndex = GetParagraphIndex();
+                // MT IA2: Not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
+                CheckPosition(nIndex);
+		if (nIndex != 0  && nIndex == getCharacterCount())
+			--nIndex;
+                sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 
+                sal_Int32 nCurIndex;
+                //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+                //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+                //by the IAText::attributes(). So here must do special support for bullet line.
+                sal_Int32 nBulletLen = 0;
+                for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine )
+                {
+                    if (nLine == 0)
+                    {
+                        EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) );
+                        if (aBulletInfo.bVisible)
+                        {
+                            //in bullet or numbering;
+                            nBulletLen = aBulletInfo.aText.Len();
+                        }
+                    }
+                    //nCurIndex += rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                    sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                    if (nLine == 0)
+                        nCurIndex += nLineLen - nBulletLen;
+                    else 
+                        nCurIndex += nLineLen;
+                    if( nCurIndex > nIndex )
+                    {
+                        if (nLine ==0)
+                        {
+                            //aResult.SegmentStart = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                            aResult.SegmentStart = 0;
+                            aResult.SegmentEnd = nCurIndex;
+                            //aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd );
+                            aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen);
+                            break;
+                        }
+                        else
+                        {
+                            //aResult.SegmentStart = nCurIndex - rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                            aResult.SegmentStart = nCurIndex - nLineLen;
+                            aResult.SegmentEnd = nCurIndex;
+                            //aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd );
+                            aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+                            break;
+                        }
+                    }
                 }
                 break;
             }
-
+//-----IAccessibility2 Implementation 2009
             default:
                 aResult = OCommonAccessibleText::getTextAtIndex( nIndex, aTextType );
                 break;
@@ -1543,7 +2190,9 @@
         ::com::sun::star::accessibility::TextSegment aResult;
         aResult.SegmentStart = -1;
         aResult.SegmentEnd = -1;
-
+//IAccessibility2 Implementation 2009-----
+		i18n::Boundary aBoundary;
+//-----IAccessibility2 Implementation 2009
         switch( aTextType )
         {
             // Not yet handled by OCommonAccessibleText. Missing
@@ -1581,7 +2230,118 @@
                 }
                 break;
             }
+	    //IAccessibility2 Implementation 2009-----
+            case AccessibleTextType::LINE:
+            {
+                SvxTextForwarder&	rCacheTF = GetTextForwarder();
+                sal_Int32			nParaIndex = GetParagraphIndex();
+                // MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
 
+                CheckPosition(nIndex);
+
+                sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 
+                //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+                //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+                //by the IAText::attributes(). So here must do special support for bullet line.
+                sal_Int32 nCurIndex=0, nLastIndex=0, nCurLineLen=0; 
+                sal_Int32 nLastLineLen = 0, nBulletLen = 0;;
+                // get the line before the line the index points into
+                for( nLine=0, nCurIndex=0, nLastIndex=0; nLine<nLineCount; ++nLine )
+                {
+                    nLastIndex = nCurIndex;
+                    if (nLine == 0)
+                    {
+                        EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) );
+                        if (aBulletInfo.bVisible)
+                        {
+                            //in bullet or numbering;
+                            nBulletLen = aBulletInfo.aText.Len();
+                        }
+                    }
+                    if (nLine == 1)
+                        nLastLineLen = nCurLineLen - nBulletLen;
+                    else
+                        nLastLineLen = nCurLineLen;
+                    nCurLineLen = rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                    //nCurIndex += nCurLineLen;
+                    if (nLine == 0)
+                        nCurIndex += nCurLineLen - nBulletLen;
+                    else 
+                        nCurIndex += nCurLineLen;
+                    
+                    //if( nCurIndex > nIndex &&
+                    //nLastIndex > nCurLineLen )
+                    if (nCurIndex > nIndex)
+                    {
+                        if (nLine == 0)
+                        {
+                            break;
+                        }
+                        else if (nLine == 1)
+                        {
+                            aResult.SegmentStart = 0;
+                            aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex );
+                            aResult.SegmentText = GetTextRange( aResult.SegmentStart, aResult.SegmentEnd + nBulletLen);
+                            break;
+                        }
+                        else
+                        {
+                            //aResult.SegmentStart = nLastIndex - nCurLineLen;
+                            aResult.SegmentStart = nLastIndex - nLastLineLen;
+                            aResult.SegmentEnd = static_cast< sal_uInt16 >( nLastIndex );
+                            aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+                            break;
+                        }
+                    }                
+                }
+
+                break;
+            }
+			case AccessibleTextType::WORD:
+			{
+				nIndex = SkipField( nIndex, sal_False);
+				::rtl::OUString sText( implGetText() );
+				sal_Int32 nLength = sText.getLength();
+
+				// get word at index
+				implGetWordBoundary( aBoundary, nIndex );
+
+
+				//sal_Int32 curWordStart = aBoundary.startPos;
+				//sal_Int32 preWordStart = curWordStart;
+				sal_Int32 curWordStart , preWordStart;
+				if( aBoundary.startPos == -1 || aBoundary.startPos > nIndex)
+					curWordStart = preWordStart = nIndex;
+				else
+					curWordStart = preWordStart = aBoundary.startPos;
+				
+				// get previous word
+				
+				sal_Bool bWord = sal_False;
+				
+				//while ( preWordStart > 0 && aBoundary.startPos == curWordStart)
+				while ( (preWordStart >= 0 && !bWord ) || ( aBoundary.endPos > curWordStart ) )
+					{
+					preWordStart--;
+					bWord = implGetWordBoundary( aBoundary, preWordStart );	
+				}
+				if ( bWord && implIsValidBoundary( aBoundary, nLength ) )
+				{
+					aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos );
+					aResult.SegmentStart = aBoundary.startPos;
+					aResult.SegmentEnd = aBoundary.endPos;
+					ExtendByField( aResult );					
+				}
+			}
+			break;
+			case AccessibleTextType::CHARACTER:
+			{
+				nIndex = SkipField( nIndex, sal_False);
+				aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
+				ExtendByField( aResult );
+				break;
+			}
+			//-----IAccessibility2 Implementation 2009
             default:
                 aResult = OCommonAccessibleText::getTextBeforeIndex( nIndex, aTextType );
                 break;
@@ -1602,7 +2362,9 @@
         ::com::sun::star::accessibility::TextSegment aResult;
         aResult.SegmentStart = -1;
         aResult.SegmentEnd = -1;
-
+//IAccessibility2 Implementation 2009-----
+		i18n::Boundary aBoundary;
+//-----IAccessibility2 Implementation 2009
         switch( aTextType )
         {
             case AccessibleTextType::ATTRIBUTE_RUN:
@@ -1625,6 +2387,93 @@
                 break;
             }
 
+//IAccessibility2 Implementation 2009-----
+            case AccessibleTextType::LINE:
+            {
+                SvxTextForwarder&	rCacheTF = GetTextForwarder();
+                sal_Int32			nParaIndex = GetParagraphIndex();
+                // MT IA2 not needed? sal_Int32 nTextLen = rCacheTF.GetTextLen( static_cast< sal_uInt16 >( nParaIndex ) );
+
+                CheckPosition(nIndex);
+
+                sal_uInt16 nLine, nLineCount=rCacheTF.GetLineCount( static_cast< sal_uInt16 >( nParaIndex ) ); 
+                sal_Int32 nCurIndex; 
+                //the problem is that rCacheTF.GetLineLen() will include the bullet length. But for the bullet line,
+                //the text value doesn't contain the bullet characters. all of the bullet and numbering info are exposed
+                //by the IAText::attributes(). So here must do special support for bullet line.
+                sal_Int32 nBulletLen = 0;
+                // get the line after the line the index points into
+                for( nLine=0, nCurIndex=0; nLine<nLineCount; ++nLine )
+                {
+                    if (nLine == 0)
+                    {
+                        EBulletInfo aBulletInfo = rCacheTF.GetBulletInfo( static_cast< sal_uInt16 >(nParaIndex) );
+                        if (aBulletInfo.bVisible)
+                        {
+                            //in bullet or numbering;
+                            nBulletLen = aBulletInfo.aText.Len();
+                        }
+                    }
+                    //nCurIndex += rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                    sal_Int32 nLineLen = rCacheTF.GetLineLen( static_cast< sal_uInt16 >( nParaIndex ), nLine);
+                    
+                    if (nLine == 0)
+                        nCurIndex += nLineLen - nBulletLen;
+                    else 
+                        nCurIndex += nLineLen;
+                    
+                    if( nCurIndex > nIndex &&
+                        nLine < nLineCount-1 )
+                    {
+                        aResult.SegmentStart = nCurIndex;
+                        aResult.SegmentEnd = nCurIndex + rCacheTF.GetLineLen(static_cast< sal_uInt16 >( nParaIndex ), nLine+1);
+                        aResult.SegmentText = GetTextRange( aResult.SegmentStart + nBulletLen, aResult.SegmentEnd + nBulletLen);
+                        break;
+                    }                
+                }
+
+                break;
+            }
+			case AccessibleTextType::WORD:
+			{
+				nIndex = SkipField( nIndex, sal_True);
+				::rtl::OUString sText( implGetText() );
+				sal_Int32 nLength = sText.getLength();
+
+				// get word at index
+				sal_Bool bWord = implGetWordBoundary( aBoundary, nIndex );
+
+				// real current world
+				sal_Int32 nextWord = nIndex;
+				//if( nIndex >= aBoundary.startPos && nIndex <= aBoundary.endPos )
+				if( nIndex <= aBoundary.endPos )
+				{		
+					nextWord = 	aBoundary.endPos;
+					if( sText.getStr()[nextWord] == sal_Unicode(' ') ) nextWord++;
+					bWord = implGetWordBoundary( aBoundary, nextWord );
+				}
+				
+				if ( bWord && implIsValidBoundary( aBoundary, nLength ) )
+				{
+					aResult.SegmentText = sText.copy( aBoundary.startPos, aBoundary.endPos - aBoundary.startPos );
+					aResult.SegmentStart = aBoundary.startPos;
+					aResult.SegmentEnd = aBoundary.endPos;
+
+					// If the end position of aBoundary is inside a field, extend the result to the end of the field
+
+					ExtendByField( aResult );
+				}
+			}
+			break;
+
+			case AccessibleTextType::CHARACTER:
+			{
+				nIndex = SkipField( nIndex, sal_True);
+				aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
+				ExtendByField( aResult );
+				break;
+			}
+			//-----IAccessibility2 Implementation 2009
             default:
                 aResult = OCommonAccessibleText::getTextBehindIndex( nIndex, aTextType );
                 break;
@@ -1656,11 +2505,17 @@
 
             CheckRange(nStartIndex, nEndIndex);
 
+            //Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
             // save current selection
             ESelection aOldSelection;
 
             rCacheVF.GetSelection( aOldSelection );
-            rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+            //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+            rCacheVF.SetSelection( MakeSelection(nStartIndex + nBulletLen, nEndIndex + nBulletLen) );
             aRetVal = rCacheVF.Copy();
             rCacheVF.SetSelection( aOldSelection ); // restore
 
@@ -1689,11 +2544,19 @@
 
             CheckRange(nStartIndex, nEndIndex);
 
-            if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
+            ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+            //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            if( !rCacheTF.IsEditable( aSelection ) )
                 return sal_False; // non-editable area selected
 
             // don't save selection, might become invalid after cut!
-            rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+            //rCacheVF.SetSelection( MakeSelection(nStartIndex, nEndIndex) );
+            rCacheVF.SetSelection( aSelection );
 
             return rCacheVF.Cut();
         }
@@ -1719,11 +2582,18 @@
 
             CheckPosition(nIndex);
 
-            if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+            // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
+            //if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+            if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) )
                 return sal_False; // non-editable area selected
 
             // #104400# set empty selection (=> cursor) to given index
-            rCacheVF.SetSelection( MakeCursor(nIndex) );
+            //rCacheVF.SetSelection( MakeCursor(nIndex) );
+            rCacheVF.SetSelection( MakeCursor(nIndex + nBulletLen) );
 
             return rCacheVF.Paste();
         }
@@ -1751,10 +2621,19 @@
 
             CheckRange(nStartIndex, nEndIndex);
 
-            if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
+            ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+
+            //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            if( !rCacheTF.IsEditable( aSelection ) )
                 return sal_False; // non-editable area selected
 
-            sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) );
+            //sal_Bool bRet = rCacheTF.Delete( MakeSelection(nStartIndex, nEndIndex) );
+            sal_Bool bRet = rCacheTF.Delete( aSelection );
 
             GetEditSource().UpdateData();
 
@@ -1784,11 +2663,19 @@
 
             CheckPosition(nIndex);
 
-            if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+            // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
+
+            //if( !rCacheTF.IsEditable( MakeSelection(nIndex) ) )
+            if( !rCacheTF.IsEditable( MakeSelection(nIndex + nBulletLen) ) )
                 return sal_False; // non-editable area selected
 
             // #104400# insert given text at empty selection (=> cursor)
-            sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex) );
+            //sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex) );
+            sal_Bool bRet = rCacheTF.InsertText( sText, MakeCursor(nIndex + nBulletLen) );
 
             rCacheTF.QuickFormatDoc();
             GetEditSource().UpdateData();
@@ -1819,11 +2706,20 @@
 
             CheckRange(nStartIndex, nEndIndex);
 
-            if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            // Because bullet may occupy one or more characters, the TextAdapter will include bullet to calculate the selection. Add offset to handle bullet
+            sal_Int32 nBulletLen = 0;
+            EBulletInfo aBulletInfo = GetTextForwarder().GetBulletInfo( static_cast< sal_uInt16 >(GetParagraphIndex()) );
+            if( aBulletInfo.nParagraph != EE_PARA_NOT_FOUND && aBulletInfo.bVisible )
+                        nBulletLen = aBulletInfo.aText.Len();
+            ESelection aSelection = MakeSelection (nStartIndex + nBulletLen, nEndIndex + nBulletLen);
+
+            //if( !rCacheTF.IsEditable( MakeSelection(nStartIndex, nEndIndex) ) )
+            if( !rCacheTF.IsEditable( aSelection ) )
                 return sal_False; // non-editable area selected
 
             // insert given text into given range => replace
-            sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) );
+            //sal_Bool bRet = rCacheTF.InsertText( sReplacement, MakeSelection(nStartIndex, nEndIndex) );
+            sal_Bool bRet = rCacheTF.InsertText( sReplacement, aSelection );
 
             rCacheTF.QuickFormatDoc();
             GetEditSource().UpdateData();
@@ -2024,7 +2920,10 @@
         DBG_ASSERT(GetParagraphIndex() >= 0 && GetParagraphIndex() <= USHRT_MAX,
                    "AccessibleEditableTextPara::getCharacterAttributes: index value overflow");
 
-        CheckIndex(nIndex);
+		if( getCharacterCount() > 0 )
+			CheckIndex(nIndex);
+		else
+			CheckPosition(nIndex);
 
         SvxAccessibleTextPropertySet aPropSet( &GetEditSource(),
                                                ImplGetSvxCharAndParaPropertiesSet() );
diff --git a/main/editeng/source/accessibility/AccessibleHyperlink.cxx b/main/editeng/source/accessibility/AccessibleHyperlink.cxx
index 5d7ee18..490f497 100644
--- a/main/editeng/source/accessibility/AccessibleHyperlink.cxx
+++ b/main/editeng/source/accessibility/AccessibleHyperlink.cxx
@@ -137,3 +137,310 @@
 }  // end of namespace accessibility
 
 //------------------------------------------------------------------------
+
+// MT IA2: Accessiblehyperlink.hxx from IA2 CWS - meanwhile we also introduced one in DEV300 (above)
+// Keeping this for reference - we probably should get support for image maps in our implementation...
+
+//IAccessibility2 Implementation 2009-----
+
+/*
+
+class SVX_DLLPUBLIC SvxAccessibleHyperlink : 
+		public ::cppu::WeakImplHelper1<
+		::com::sun::star::accessibility::XAccessibleHyperlink >
+{
+	SvxURLField* mpField;
+	sal_Int32 nStartIdx;
+	sal_Int32 nEndIdx;
+
+	ImageMap* mpImageMap;
+	SdrObject* m_pShape;
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >  shapeParent;
+
+public:
+
+	SvxAccessibleHyperlink(){};
+	//SvxAccessibleHyperlink(::rtl::OUString name, const Imagemap* pImageMap);
+	SvxAccessibleHyperlink(const SvxURLField* p, sal_Int32 nStt, sal_Int32 nEnd);
+	SvxAccessibleHyperlink(SdrObject* p, ::accessibility::AccessibleShape* pAcc);
+	virtual ~SvxAccessibleHyperlink();
+	//void setImageMap(ImageMap* pMap);
+	//void setXAccessibleImage(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > parent);
+	::rtl::OUString GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException);
+	sal_Bool IsValidHyperlink();
+
+	// XAccessibleAction
+    virtual sal_Int32 SAL_CALL getAccessibleActionCount() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( 
+				sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException,
+				::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< 
+			::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+		   	getAccessibleActionKeyBinding( sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleHyperlink
+    virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( 
+				sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( 
+			sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getStartIndex() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getEndIndex() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL isValid(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+};
+
+
+SvxAccessibleHyperlink::SvxAccessibleHyperlink( const SvxURLField *p,
+										  sal_Int32 nStt, sal_Int32 nEnd ) :
+	nStartIdx( nStt ),
+	nEndIdx( nEnd ),
+	m_pShape(NULL),
+	shapeParent(NULL)
+{
+	if(p)
+		mpField = (SvxURLField*)p->Clone();
+	else
+		mpField = NULL;
+}
+	
+SvxAccessibleHyperlink::SvxAccessibleHyperlink(SdrObject* p, 
+											::accessibility::AccessibleShape* pAcc) :
+	nStartIdx( -1 ),
+	nEndIdx( -1 ),
+	mpField(NULL),
+	m_pShape(p)
+{
+	mpImageMap = m_pShape->GetModel()->GetImageMapForObject(m_pShape);
+	shapeParent = dynamic_cast< XAccessible* >(pAcc);
+}
+
+SvxAccessibleHyperlink::~SvxAccessibleHyperlink()
+{
+	if(mpField)
+		delete mpField;
+}
+
+::rtl::OUString SvxAccessibleHyperlink::GetHyperlinkURL(sal_Int32 nIndex) throw (::com::sun::star::lang::IndexOutOfBoundsException)
+{
+	if( mpField )
+	{
+		if (nIndex != 0)
+	        throw ::com::sun::star::lang::IndexOutOfBoundsException();
+		return ::rtl::OUString( mpField->GetURL() );
+	}
+	else if (mpImageMap)
+	{
+		if (nIndex < 0 || nIndex >=mpImageMap->GetIMapObjectCount())
+			throw IndexOutOfBoundsException();
+		
+		IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex));
+		if (pMapObj->GetURL().Len())
+			return ::rtl::OUString( pMapObj->GetURL() );
+	}
+	else
+	{
+		if (nIndex != 0)
+	        throw ::com::sun::star::lang::IndexOutOfBoundsException();
+		
+		SdrUnoObj* pUnoCtrl = dynamic_cast< SdrUnoObj* >( m_pShape );
+	
+		if(pUnoCtrl) 
+		{
+			try
+			{
+				uno::Reference< awt::XControlModel > xControlModel( pUnoCtrl->GetUnoControlModel(), uno::UNO_QUERY_THROW );
+				uno::Reference< beans::XPropertySet > xPropSet( xControlModel, uno::UNO_QUERY_THROW );
+				uno::Reference< beans::XPropertySetInfo > xPropInfo( xPropSet->getPropertySetInfo(), uno::UNO_QUERY_THROW );
+		
+				form::FormButtonType eButtonType = form::FormButtonType_URL;
+				const ::rtl::OUString sButtonType( RTL_CONSTASCII_USTRINGPARAM( "ButtonType" ) );
+				if(xPropInfo->hasPropertyByName( sButtonType ) && (xPropSet->getPropertyValue( sButtonType ) >>= eButtonType ) )
+				{
+					::rtl::OUString aString;
+
+					// URL
+					const ::rtl::OUString sTargetURL(RTL_CONSTASCII_USTRINGPARAM( "TargetURL" ));
+					if(xPropInfo->hasPropertyByName(sTargetURL))
+					{
+						if( xPropSet->getPropertyValue(sTargetURL) >>= aString )
+							return aString;
+					}
+				}
+			}
+			catch( uno::Exception& )
+			{
+			}
+		}
+		// If hyperlink can't be got from sdrobject, query the corresponding document to retrieve the link info
+		uno::Reference< XAccessibleGroupPosition > xGroupPosition (shapeParent, uno::UNO_QUERY);
+		if (xGroupPosition.is())
+			return xGroupPosition->getObjectLink( uno::makeAny( shapeParent ) );
+	}
+	return ::rtl::OUString();
+}
+
+// Just check whether the first hyperlink is valid
+sal_Bool SvxAccessibleHyperlink::IsValidHyperlink()
+{
+	::rtl::OUString url = GetHyperlinkURL(0);
+	if (url.getLength() > 0)
+		return sal_True;
+	else
+		return sal_False;
+}
+// XAccessibleAction
+sal_Int32 SAL_CALL SvxAccessibleHyperlink::getAccessibleActionCount() 
+		throw (RuntimeException)
+{
+	if (mpImageMap)
+		return mpImageMap->GetIMapObjectCount();
+	else
+		return 1;	// only shape link or url field
+		
+	//return mpField ? 1 : (mpImageMap ? mpImageMap->GetIMapObjectCount() : 0);
+}
+
+sal_Bool SAL_CALL SvxAccessibleHyperlink::doAccessibleAction( sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	sal_Bool bRet = sal_False;
+
+	OUString url = GetHyperlinkURL(nIndex);
+	
+	if( url.getLength() > 0 ) 
+	{
+		SfxStringItem aStrItem(SID_FILE_NAME, url);
+		const SfxObjectShell* pDocSh = SfxObjectShell::Current();
+		if( pDocSh )
+		{
+			SfxMedium* pSfxMedium = pDocSh->GetMedium();
+			if( pSfxMedium)
+			{
+				SfxStringItem aReferer(SID_REFERER, pSfxMedium->GetName());
+				SfxBoolItem aBrowseItem( SID_BROWSE, TRUE );
+				SfxViewFrame* pFrame = SfxViewFrame::Current();
+				if( pFrame )
+				{
+					pFrame->GetDispatcher()->Execute(SID_OPENDOC, SFX_CALLMODE_ASYNCHRON | SFX_CALLMODE_RECORD,
+						    	&aStrItem, &aBrowseItem, &aReferer, 0L);
+					bRet = sal_True;
+				}
+			}
+		}
+	}
+
+	return bRet;
+}
+		
+OUString SAL_CALL SvxAccessibleHyperlink::getAccessibleActionDescription(
+		sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return GetHyperlinkURL(nIndex);
+}
+
+::com::sun::star::uno::Reference< XAccessibleKeyBinding > SAL_CALL
+	SvxAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 ) 
+	throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding;
+
+	if( mpField || m_pShape)
+	{
+		::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+		   	new ::comphelper::OAccessibleKeyBindingHelper();
+		xKeyBinding = pKeyBindingHelper;
+
+		::com::sun::star::awt::KeyStroke aKeyStroke;
+		aKeyStroke.Modifiers = 0;
+		aKeyStroke.KeyCode = KEY_RETURN;
+		aKeyStroke.KeyChar = 0;
+		aKeyStroke.KeyFunc = 0;
+		pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+	}
+
+	return xKeyBinding;
+}
+
+// XAccessibleHyperlink
+Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionAnchor(
+		sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	Any aRet;
+
+	::rtl::OUString retText;
+	if(mpField && nIndex == 0)
+	{
+		retText = mpField->GetRepresentation();		
+		aRet <<= retText;
+		return aRet;
+	}
+	else if(mpImageMap)
+	{
+		IMapObject* pMapObj = mpImageMap->GetIMapObject(sal_uInt16(nIndex));
+		if(pMapObj && pMapObj->GetURL().Len())
+			aRet <<= shapeParent;
+			return aRet;
+	}
+	else if (nIndex == 0)
+	{
+		aRet <<= shapeParent;
+		return aRet;
+	}
+	return aRet;
+}
+
+Any SAL_CALL SvxAccessibleHyperlink::getAccessibleActionObject( 
+			sal_Int32 nIndex ) 
+	throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::rtl::OUString retText = GetHyperlinkURL(nIndex);
+	Any aRet;
+	aRet <<= retText;
+	return aRet;
+}
+
+sal_Int32 SAL_CALL SvxAccessibleHyperlink::getStartIndex() 
+		throw (RuntimeException)
+{
+	return nStartIdx;
+}
+
+sal_Int32 SAL_CALL SvxAccessibleHyperlink::getEndIndex() 
+		throw (RuntimeException)
+{
+	return nEndIdx;
+}
+
+sal_Bool SAL_CALL SvxAccessibleHyperlink::isValid(  ) 
+		throw (RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	//return mpField ? sal_True: ( mpImageMap ? sal_True : sal_False );
+	if (mpField || m_pShape)
+		return sal_True;
+	else 
+		return sal_False;
+}
+
+*/
+
+//-----IAccessibility2 Implementation 2009
+
+
diff --git a/main/editeng/source/accessibility/AccessibleParaManager.cxx b/main/editeng/source/accessibility/AccessibleParaManager.cxx
index 861214d..1b73d7a 100644
--- a/main/editeng/source/accessibility/AccessibleParaManager.cxx
+++ b/main/editeng/source/accessibility/AccessibleParaManager.cxx
@@ -356,10 +356,10 @@
                                            const uno::Any& rOldValue ) const
     {
         DBG_ASSERT( maChildren.size() > nStartPara &&
-                    maChildren.size() >= nEndPara , "AccessibleParaManager::FireEvent: invalid index" );
+                    maChildren.size() >= nEndPara && 
+					nEndPara >= nStartPara , "AccessibleParaManager::FireEvent: invalid index" );
 
-        if( maChildren.size() > nStartPara &&
-            maChildren.size() >= nEndPara )
+        if( maChildren.size() > nStartPara && maChildren.size() >= nEndPara && nEndPara >= nStartPara)
         {
             VectorOfChildren::const_iterator front = maChildren.begin();
             VectorOfChildren::const_iterator back = front;
diff --git a/main/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/main/editeng/source/accessibility/AccessibleStaticTextBase.cxx
index 4f63bc0..d9781ad 100644
--- a/main/editeng/source/accessibility/AccessibleStaticTextBase.cxx
+++ b/main/editeng/source/accessibility/AccessibleStaticTextBase.cxx
@@ -83,7 +83,9 @@
             return ( lhs.Name == rhs.Name && lhs.Value == rhs.Value );
         }
     };
-
+//IAccessibility2 Implementation 2009-----
+sal_Unicode cNewLine(0x0a);
+//-----IAccessibility2 Implementation 2009
 	//------------------------------------------------------------------------
 	//
 	// Static Helper
@@ -120,7 +122,9 @@
      */
     class AccessibleStaticTextBase_Impl
     {
-
+	//IAccessibility2 Implementation 2009-----
+		friend class AccessibleStaticTextBase;
+	//-----IAccessibility2 Implementation 2009
     public:
 
         // receive pointer to our frontend class and view window
@@ -194,6 +198,9 @@
                                               sal_Int32 nEndPara, sal_Int32 nEndIndex );
 
         Rectangle                   GetParagraphBoundingBox() const;
+	//IAccessibility2 Implementation 2009-----
+		sal_Bool					RemoveLineBreakCount( sal_Int32& rIndex );
+	//-----IAccessibility2 Implementation 2009
 
     private:
 
@@ -386,8 +393,9 @@
         {
             nCurrCount = GetParagraph( nCurrPara ).getCharacterCount();
             nCurrIndex += nCurrCount;
-
-            if( nCurrIndex > nFlatIndex )
+	//IAccessibility2 Implementation 2009-----
+            if( nCurrIndex >= nFlatIndex )
+	//-----IAccessibility2 Implementation 2009
             {
                 // check overflow
                 DBG_ASSERT(nCurrPara >= 0 && nCurrPara <= USHRT_MAX &&
@@ -477,7 +485,59 @@
         }
         return aRect;
     }
+    	//IAccessibility2 Implementation 2009-----
+	//the input argument is the index(including "\n" ) in the string.
+	//the function will calculate the actual index(not including "\n") in the string.
+	//and return true if the index is just at a "\n"
+	sal_Bool AccessibleStaticTextBase_Impl::RemoveLineBreakCount( sal_Int32& rIndex )
+	{
+		// get the total char number inside the cell.
+		sal_Int32 i, nCount, nParas;
+        for( i=0, nCount=0, nParas=GetParagraphCount(); i<nParas; ++i )
+            nCount += GetParagraph(i).getCharacterCount();		
+		nCount = nCount + (nParas-1);
+		if( nCount == 0 &&  rIndex == 0) return sal_False;
+		
 
+		sal_Int32 nCurrPara, nCurrCount;
+		sal_Int32 nLineBreakPos = 0, nLineBreakCount = 0;
+		sal_Int32 nParaCount = GetParagraphCount();
+		for ( nCurrCount = 0, nCurrPara = 0; nCurrPara < nParaCount; nCurrPara++ )
+		{
+			nCurrCount += GetParagraph( nCurrPara ).getCharacterCount();
+			nLineBreakPos = nCurrCount++;
+			if ( rIndex == nLineBreakPos )
+			{
+				rIndex -= (++nLineBreakCount);//(++nLineBreakCount);
+				if ( rIndex < 0)
+				{
+					rIndex = 0;
+				}
+				//if the index is at the last position of the last paragraph
+				//there is no "\n" , so we should increase rIndex by 1 and return false.
+				if ( (nCurrPara+1) == nParaCount )
+				{
+					rIndex++;
+					return sal_False;
+				}
+				else
+				{
+					return sal_True;
+				}
+			}
+			else if ( rIndex < nLineBreakPos )
+			{
+				rIndex -= nLineBreakCount;
+				return sal_False;
+			}
+			else
+			{
+				nLineBreakCount++;
+			}
+		}
+		return sal_False;
+	}
+	//-----IAccessibility2 Implementation 2009
 	//------------------------------------------------------------------------
 	//
 	// AccessibleStaticTextBase implementation
@@ -666,6 +726,10 @@
     uno::Sequence< beans::PropertyValue > SAL_CALL AccessibleStaticTextBase::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
     {
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
+	//IAccessibility2 Implementation 2009-----
+		//get the actual index without "\n"
+		mpImpl->RemoveLineBreakCount( nIndex );
+	//IAccessibility2 Implementation 2009-----
 
         EPosition aPos( mpImpl->Index2Internal(nIndex) );
 
@@ -697,7 +761,10 @@
         sal_Int32 i, nCount, nParas;
         for( i=0, nCount=0, nParas=mpImpl->GetParagraphCount(); i<nParas; ++i )
             nCount += mpImpl->GetParagraph(i).getCharacterCount();
-
+	//IAccessibility2 Implementation 2009-----
+		//count on the number of "\n" which equals number of paragraphs decrease 1.
+		nCount = nCount + (nParas-1);
+	//IAccessibility2 Implementation 2009-----
         return nCount;
     }
 
@@ -800,37 +867,99 @@
 
         if( nStartIndex > nEndIndex )
             ::std::swap(nStartIndex, nEndIndex);
-
+		//IAccessibility2 Implementation 2009-----
+		//if startindex equals endindex we will get nothing. So return an empty string directly.
+		if ( nStartIndex == nEndIndex )
+		{
+			::rtl::OUString sEmptyStr;
+			return sEmptyStr;
+		}
+		sal_Bool bStart = mpImpl->RemoveLineBreakCount( nStartIndex );
+		//if the start index is just at a "\n", we need to begin from the next char
+		if ( bStart )
+		{
+			nStartIndex++;
+		}
+		//we need to find out whether the previous position of the current endindex is at "\n" or not
+		//if yes we need to mark it and add "\n" at the end of the result
+		sal_Int32 nTemp = nEndIndex - 1;
+		sal_Bool bEnd = mpImpl->RemoveLineBreakCount( nTemp );
+		sal_Bool bTemp = mpImpl->RemoveLineBreakCount( nEndIndex );
+		//if the below condition is true it indicates an empty paragraph with just a "\n"
+		//so we need to set one "\n" flag to avoid duplication.
+		if ( bStart && bEnd && ( nStartIndex == nEndIndex) )
+		{
+			bEnd = sal_False;
+		}
+		//if the current endindex is at a "\n", we need to increase endindex by 1 to make sure
+		//the char before "\n" is included. Because string returned by this function will not include
+		//the char at the endindex.
+		if ( bTemp )
+		{
+			nEndIndex++;
+		}
+		::rtl::OUString aRes;
         EPosition aStartIndex( mpImpl->Range2Internal(nStartIndex) );
         EPosition aEndIndex( mpImpl->Range2Internal(nEndIndex) );
 
         // #102170# Special case: start and end paragraph are identical
         if( aStartIndex.nPara == aEndIndex.nPara )
         {
-            return mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
+			//we don't return the string directly now for that we have to do some further process for "\n"
+			aRes = mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
+            //return mpImpl->GetParagraph( aStartIndex.nPara ).getTextRange( aStartIndex.nIndex, aEndIndex.nIndex );
+			//-----IAccessibility2 Implementation 2009
         }
         else
         {
             sal_Int32 i( aStartIndex.nPara );
-            ::rtl::OUString aRes( mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex,
-                                                                        mpImpl->GetParagraph(i).getCharacterCount()-1) );
+	    		//IAccessibility2 Implementation 2009-----
+	            aRes = mpImpl->GetParagraph(i).getTextRange( aStartIndex.nIndex,
+                                                                        mpImpl->GetParagraph(i).getCharacterCount()/*-1*/);
+			//-----IAccessibility2 Implementation 2009
             ++i;
 
             // paragraphs inbetween are fully included
             for( ; i<aEndIndex.nPara; ++i )
+	    //IAccessibility2 Implementation 2009-----
+			{
+				aRes += rtl::OUString(cNewLine);
                 aRes += mpImpl->GetParagraph(i).getText();
+			}
 
             if( i<=aEndIndex.nPara )
+			{
+				//if the below condition is mathed it means the endindex is at mid of the last paragraph
+				//we need to add a "\n" before we add the last part of the string.
+				if ( !bEnd && aEndIndex.nIndex )
+				{
+					aRes += rtl::OUString(cNewLine);
+				}
                 aRes += mpImpl->GetParagraph(i).getTextRange( 0, aEndIndex.nIndex );
-
-            return aRes;
+			}
+            //return aRes;
         }
+		//According the the flag we marked before, we have to add "\n" at the beginning 
+		//or at the end of the result string.
+		if ( bStart )
+		{
+			aRes = rtl::OUString(cNewLine) + aRes;
+		}
+		if ( bEnd )
+		{
+			aRes += rtl::OUString(cNewLine);
+		}
+		return aRes;
+		//-----IAccessibility2 Implementation 2009
     }
 
     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     {
+    	//IAccessibility2 Implementation 2009-----
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
 
+		sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nIndex );
+	//-----IAccessibility2 Implementation 2009
         EPosition aPos( mpImpl->Range2Internal(nIndex) );
 
         ::com::sun::star::accessibility::TextSegment aResult;
@@ -850,6 +979,19 @@
             aResult.SegmentStart = mpImpl->Internal2Index( EPosition( aPos.nPara, 0 ) );
             aResult.SegmentEnd = aResult.SegmentStart + aResult.SegmentText.getLength();
         }
+	//IAccessibility2 Implementation 2009-----
+        else if ( AccessibleTextType::ATTRIBUTE_RUN == aTextType )
+        {
+              SvxAccessibleTextAdapter& rTextForwarder = mpImpl->GetParagraph( aPos.nIndex ).GetTextForwarder();
+              sal_uInt16 nStartIndex, nEndIndex;
+              if ( rTextForwarder.GetAttributeRun( nStartIndex, nEndIndex, aPos.nPara, aPos.nIndex, sal_True ) )
+              {
+                     aResult.SegmentText = getTextRange( nStartIndex, nEndIndex );
+                     aResult.SegmentStart = nStartIndex;
+                     aResult.SegmentEnd = nEndIndex;
+              }
+        }
+	//-----IAccessibility2 Implementation 2009
         else
         {
             // No special handling required, forward to wrapped class
@@ -857,6 +999,12 @@
 
             // #112814# Adapt the start index with the paragraph offset
             mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+	    //IAccessibility2 Implementation 2009-----
+			if ( bLineBreak )
+			{
+				aResult.SegmentText = rtl::OUString(cNewLine);
+			}
+	    //-----IAccessibility2 Implementation 2009
         }
 
         return aResult;
@@ -865,7 +1013,10 @@
     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     {
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+		//IAccessibility2 Implementation 2009-----
+		sal_Int32 nOldIdx = nIndex;
+		sal_Bool bLineBreak =  mpImpl->RemoveLineBreakCount( nIndex );
+		//-----IAccessibility2 Implementation 2009
         EPosition aPos( mpImpl->Range2Internal(nIndex) );
 
         ::com::sun::star::accessibility::TextSegment aResult;
@@ -897,6 +1048,12 @@
 
             // #112814# Adapt the start index with the paragraph offset
             mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+			//IAccessibility2 Implementation 2009-----
+			if ( bLineBreak && (nOldIdx-1) >= 0)
+			{
+				aResult = getTextAtIndex( nOldIdx-1, aTextType );
+			}
+			//-----IAccessibility2 Implementation 2009			
         }
 
         return aResult;
@@ -905,7 +1062,11 @@
     ::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleStaticTextBase::getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
     {
         ::vos::OGuard aGuard( Application::GetSolarMutex() );
-
+	//IAccessibility2 Implementation 2009-----
+		sal_Int32 nTemp = nIndex+1;
+		sal_Bool bLineBreak = mpImpl->RemoveLineBreakCount( nTemp );
+		mpImpl->RemoveLineBreakCount( nIndex );
+	//-----IAccessibility2 Implementation 2009
         EPosition aPos( mpImpl->Range2Internal(nIndex) );
 
         ::com::sun::star::accessibility::TextSegment aResult;
@@ -931,6 +1092,12 @@
 
             // #112814# Adapt the start index with the paragraph offset
             mpImpl->CorrectTextSegment( aResult, aPos.nPara );
+			//IAccessibility2 Implementation 2009-----
+			if ( bLineBreak )
+			{
+				aResult.SegmentText = rtl::OUString(cNewLine) + aResult.SegmentText;
+			}
+			//-----IAccessibility2 Implementation 2009
        }
 
         return aResult;
diff --git a/main/editeng/source/accessibility/accessibility.src b/main/editeng/source/accessibility/accessibility.src
index 2c1af32..09a2f46 100644
--- a/main/editeng/source/accessibility/accessibility.src
+++ b/main/editeng/source/accessibility/accessibility.src
@@ -33,4 +33,14 @@
 	Text [ en-US ] = "Image bullet" ;
 };
 
+String RID_SVXSTR_A11Y_PARAGRAPH_DESCRIPTION
+{
+	Text [ en-US ] = "Paragraph: $(ARG) " ;
+};
+
+String RID_SVXSTR_A11Y_PARAGRAPH_NAME
+{
+	Text [ en-US ] = "Paragraph $(ARG)" ;
+};
+
 
diff --git a/main/editeng/source/editeng/editdoc.hxx b/main/editeng/source/editeng/editdoc.hxx
index 205c760..a468b16 100644
--- a/main/editeng/source/editeng/editdoc.hxx
+++ b/main/editeng/source/editeng/editdoc.hxx
@@ -451,7 +451,7 @@
 	sal_uInt16 			nEndPortion;
 	sal_uInt16			nHeight;	// Gesamthoehe der Zeile
 	sal_uInt16			nTxtHeight;	// Reine Texthoehe
-	sal_uInt16			nCrsrHeight;	// Bei Konturfluss hohe Zeilen => Cursor zu gro�.
+	sal_uInt16			nCrsrHeight;	// Bei Konturfluss hohe Zeilen => Cursor zu gro?.
 	sal_uInt16			nMaxAscent;
 	sal_Bool			bHangingPunctuation;
 	sal_Bool			bInvalid;	// fuer geschickte Formatierung
diff --git a/main/editeng/source/editeng/edtspell.cxx b/main/editeng/source/editeng/edtspell.cxx
index 7d1c4f6..bd22ada 100644
--- a/main/editeng/source/editeng/edtspell.cxx
+++ b/main/editeng/source/editeng/edtspell.cxx
@@ -140,6 +140,9 @@
 	if ( pSpellInfo->bMultipleDoc )
 	{
 		bMore = pImpEE->GetEditEnginePtr()->SpellNextDocument();
+		//IAccessibility2 Implementation 2009-----
+		SetCurTextObj( pImpEE->GetEditEnginePtr()->GetCurTextObj() );
+		//-----IAccessibility2 Implementation 2009
 		if ( bMore )
 		{
 			// Der Text wurde in diese Engine getreten, bei Rueckwaerts
diff --git a/main/editeng/source/editeng/impedit.cxx b/main/editeng/source/editeng/impedit.cxx
index 6a38b2e..dd90140 100644
--- a/main/editeng/source/editeng/impedit.cxx
+++ b/main/editeng/source/editeng/impedit.cxx
@@ -122,7 +122,23 @@
 
     if ( pEditEngine->pImpEditEngine->GetNotifyHdl().IsSet() )
     {
-        EENotify aNotify( EE_NOTIFY_TEXTVIEWSELECTIONCHANGED );
+    //IAccessibility2 Implementation 2009-----
+		const EditDoc& rDoc = pEditEngine->pImpEditEngine->GetEditDoc();
+		const EditPaM pmEnd = rDoc.GetEndPaM();
+		EENotifyType eNotifyType;
+		if (rDoc.Count() > 1 && 
+			pmEnd == rEditSelection.Min() && 
+			pmEnd == rEditSelection.Max())//if move cursor to the last para.
+		{
+			eNotifyType = EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA;
+		}
+		else 
+		{
+			eNotifyType = EE_NOTIFY_TEXTVIEWSELECTIONCHANGED;
+		}
+        //EENotify aNotify( EE_NOTIFY_TEXTVIEWSELECTIONCHANGED );
+        EENotify aNotify( eNotifyType );
+	//-----IAccessibility2 Implementation 2009
         aNotify.pEditEngine = pEditEngine;
         aNotify.pEditView = GetEditViewPtr();
         pEditEngine->pImpEditEngine->CallNotify( aNotify );
diff --git a/main/editeng/source/editeng/impedit.hxx b/main/editeng/source/editeng/impedit.hxx
index 8bfba30..bd846b2 100644
--- a/main/editeng/source/editeng/impedit.hxx
+++ b/main/editeng/source/editeng/impedit.hxx
@@ -480,6 +480,8 @@
 	sal_Bool			bInSelection;
 	sal_Bool			bIsInUndo;
 	sal_Bool			bUpdate;
+	// IAccessible2 migration fix
+	sal_Bool			bUpdateForAcc;
 	sal_Bool			bUndoEnabled;
 	sal_Bool			bOwnerOfRefDev;
 	sal_Bool			bDowning;
@@ -713,6 +715,9 @@
 
 	void					SetUpdateMode( sal_Bool bUp, EditView* pCurView = 0, sal_Bool bForceUpdate = sal_False );
 	sal_Bool				GetUpdateMode()	const	{ return bUpdate; }
+	// IAccessible2 migration fix
+	void					SetUpdateModeForAcc( sal_Bool bUp);
+	sal_Bool				GetUpdateModeForAcc();
 
 	const ParaPortionList&	GetParaPortions() const	{ return aParaPortionList; }
 	ParaPortionList&		GetParaPortions() 		{ return aParaPortionList; }
diff --git a/main/editeng/source/editeng/impedit2.cxx b/main/editeng/source/editeng/impedit2.cxx
index 65b53ec..95956a4 100644
--- a/main/editeng/source/editeng/impedit2.cxx
+++ b/main/editeng/source/editeng/impedit2.cxx
@@ -136,6 +136,7 @@
 	bIsFormatting 		= sal_False;
 	bFormatted			= sal_False;
 	bUpdate 			= sal_True;
+	bUpdateForAcc		= TRUE;		//IAccessible2 implementation 2009
     bUseAutoColor       = sal_True;
     bForceAutoColor     = sal_False;
     bAddExtLeading      = sal_False;
diff --git a/main/editeng/source/editeng/impedit3.cxx b/main/editeng/source/editeng/impedit3.cxx
index a21a860..1f4ca2f 100644
--- a/main/editeng/source/editeng/impedit3.cxx
+++ b/main/editeng/source/editeng/impedit3.cxx
@@ -368,7 +368,9 @@
 
 void ImpEditEngine::FormatDoc()
 {
-	if ( !GetUpdateMode() || IsFormatting() )
+	// IAccessible2 migration fix
+	//if ( !GetUpdateMode() || IsFormatting() )
+	if ( !GetUpdateMode() || IsFormatting() || !GetUpdateModeForAcc())
 		return;
 
     EnterBlockNotifications();
@@ -3860,6 +3862,16 @@
 	DBG_ASSERT( IsInUndo(), "ConnectContent nur fuer Undo()!" );
 	return ImpConnectParagraphs( pLeftNode, pRightNode, bBackward );
 }
+//IAccessible2 migration fix
+void ImpEditEngine::SetUpdateModeForAcc( sal_Bool bUp)
+{
+	bUpdateForAcc = bUp;
+}
+sal_Bool ImpEditEngine::GetUpdateModeForAcc()
+{
+	return bUpdateForAcc;
+}
+//End
 
 void ImpEditEngine::SetUpdateMode( sal_Bool bUp, EditView* pCurView, sal_Bool bForceUpdate )
 {
diff --git a/main/editeng/source/misc/splwrap.cxx b/main/editeng/source/misc/splwrap.cxx
index e198799..e9c9337 100644
--- a/main/editeng/source/misc/splwrap.cxx
+++ b/main/editeng/source/misc/splwrap.cxx
@@ -170,6 +170,7 @@
 	bAuto		( sal_False ),
 	bStartChk	( bOther ),
     bRevAllowed ( bRevAllow ),
+	mpTextObj( NULL),
     bAllRight   ( bIsAllRight )
 {
 	Reference< beans::XPropertySet >  xProp( SvxGetLinguPropertySet() );
@@ -198,6 +199,7 @@
 	bEndDone	( bReverse && bStart && !bOther ),
 	bStartChk	( bOther ),
     bRevAllowed ( sal_False ),
+	mpTextObj( NULL),
     bAllRight   ( sal_True )
 {
 }
diff --git a/main/editeng/source/outliner/outliner.cxx b/main/editeng/source/outliner/outliner.cxx
index b704eb6..5fd316d 100644
--- a/main/editeng/source/outliner/outliner.cxx
+++ b/main/editeng/source/outliner/outliner.cxx
@@ -1519,6 +1519,13 @@
 bool Outliner::ImplHasNumberFormat( sal_uInt16 nPara ) const
 {
     return GetNumberFormat(nPara) != 0;
+	if ( GetNumberFormat(nPara) )
+	{
+		const SfxBoolItem& rBulletState = (const SfxBoolItem&) pEditEngine->GetParaAttrib( nPara, EE_PARA_BULLETSTATE );
+		return rBulletState.GetValue();
+	}
+	else
+		return sal_False;
 }
 
 const SvxNumberFormat* Outliner::GetNumberFormat( sal_uInt16 nPara ) const
diff --git a/main/editeng/source/outliner/outlvw.cxx b/main/editeng/source/outliner/outlvw.cxx
index 05d14ed..f1a0c60 100644
--- a/main/editeng/source/outliner/outlvw.cxx
+++ b/main/editeng/source/outliner/outlvw.cxx
@@ -1825,7 +1825,6 @@
 	return pEditView->IsWrongSpelledWordAtPos( rPosPixel, bMarkIfWrong );
 }
 
-
 void OutlinerView::SpellIgnoreWord()
 {
 	DBG_CHKTHIS(OutlinerView,0);
diff --git a/main/editeng/source/uno/unoedhlp.cxx b/main/editeng/source/uno/unoedhlp.cxx
index 6a06606..b2adfa5 100644
--- a/main/editeng/source/uno/unoedhlp.cxx
+++ b/main/editeng/source/uno/unoedhlp.cxx
@@ -28,7 +28,10 @@
 #include <editeng/unoedhlp.hxx>
 #include <editeng/editdata.hxx>
 #include <editeng/editeng.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <svl/itemset.hxx>
 
+//-----IAccessibility2 Implementation 2009
 //------------------------------------------------------------------------
 
 TYPEINIT1( SvxEditSourceHint, TextHint );
@@ -76,7 +79,9 @@
 {
     mnEnd = n; 
 }
-
+//IAccessibility2 Implementation 2009-----
+TYPEINIT1( SvxEditSourceHintEndPara , SvxEditSourceHint );
+//-----IAccessibility2 Implementation 2009
 //------------------------------------------------------------------------
 
 ::std::auto_ptr<SfxHint> SvxEditSourceHelper::EENotification2Hint( EENotify* aNotify )
@@ -117,7 +122,10 @@
 
             case EE_NOTIFY_INPUT_END:
                 return ::std::auto_ptr<SfxHint>( new TextHint( TEXT_HINT_INPUT_END, 0 ) );
-
+	//IAccessibility2 Implementation 2009-----
+			case EE_NOTIFY_TEXTVIEWSELECTIONCHANGED_ENDD_PARA:
+				return ::std::auto_ptr<SfxHint>( new SvxEditSourceHintEndPara( EDITSOURCE_HINT_SELECTIONCHANGED ) );
+	//-----IAccessibility2 Implementation 2009
             default:
                 DBG_ERROR( "SvxEditSourceHelper::EENotification2Hint unknown notification" );
                 break;
@@ -126,9 +134,166 @@
 
     return ::std::auto_ptr<SfxHint>( new SfxHint() );
 }
-
-sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex )
+sal_Bool SvxEditSourceHelper::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, const EditEngine& rEE, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell )
 {
+	// IA2 CWS introduced bInCell, but also did many other changes here.
+	// Need to verify implementation with AT (IA2 and ATK)
+	// Old implementation at the end of the method for reference...
+
+#if 1 // IA2 CWS
+
+    //added dummy attributes for the default text
+	EECharAttribArray aCharAttribs, aTempCharAttribs;
+	rEE.GetCharAttribs( nPara, aTempCharAttribs );
+	if ( aTempCharAttribs.Count() )
+	{
+		sal_uInt32 nIndex2 = 0;
+		sal_uInt32 nParaLen = rEE.GetTextLen(nPara);
+		for ( sal_uInt16 nAttr = 0; nAttr < aTempCharAttribs.Count(); nAttr++ )
+		{
+			if ( nIndex2 < aTempCharAttribs[nAttr].nStart )
+			{
+				EECharAttrib aEEAttr;
+				aEEAttr.nStart = sal_uInt16(nIndex2);
+				aEEAttr.nEnd = aTempCharAttribs[nAttr].nStart;
+				aCharAttribs.Insert( aEEAttr, nAttr );
+			}
+			nIndex2 = aTempCharAttribs[nAttr].nEnd;
+			aCharAttribs.Insert( aTempCharAttribs[nAttr], aCharAttribs.Count() );
+		}
+		if ( nIndex2 != nParaLen )
+		{
+			EECharAttrib aEEAttr;
+			aEEAttr.nStart = sal_uInt16(nIndex2);
+			aEEAttr.nEnd = sal_uInt16(nParaLen);
+			aCharAttribs.Insert( aEEAttr, aCharAttribs.Count() );
+		}
+	}
+    // find closest index in front of nIndex
+    sal_uInt16 nAttr, nCurrIndex;
+    sal_Int32 nClosestStartIndex;
+	sal_Int32 nClosestStartIndex_s, nClosestStartIndex_e;
+    for( nAttr=0, nClosestStartIndex_s=0, nClosestStartIndex_e=0; nAttr<aCharAttribs.Count(); ++nAttr )
+    {
+        nCurrIndex = aCharAttribs[nAttr].nStart;
+        
+        //if( nCurrIndex > nIndex )
+        //    break; // aCharAttribs array is sorted in increasing order for nStart values
+
+        if( nCurrIndex > nClosestStartIndex_s &&
+			nCurrIndex <= nIndex)
+        {
+            nClosestStartIndex_s = nCurrIndex;
+        }
+		nCurrIndex = aCharAttribs[nAttr].nEnd;
+		if ( nCurrIndex > nClosestStartIndex_e &&
+			nCurrIndex < nIndex )
+		{
+			nClosestStartIndex_e = nCurrIndex;
+		}
+    }
+	nClosestStartIndex = nClosestStartIndex_s > nClosestStartIndex_e ? nClosestStartIndex_s : nClosestStartIndex_e;
+
+    // find closest index behind of nIndex
+    sal_Int32 nClosestEndIndex;
+	sal_Int32 nClosestEndIndex_s, nClosestEndIndex_e;
+    for( nAttr=0, nClosestEndIndex_s=nClosestEndIndex_e=rEE.GetTextLen(nPara); nAttr<aCharAttribs.Count(); ++nAttr )
+    {
+        nCurrIndex = aCharAttribs[nAttr].nEnd;
+
+        if( nCurrIndex > nIndex &&
+            nCurrIndex < nClosestEndIndex_e )
+        {
+            nClosestEndIndex_e = nCurrIndex;
+        }
+		nCurrIndex = aCharAttribs[nAttr].nStart;
+		if ( nCurrIndex > nIndex &&
+			nCurrIndex < nClosestEndIndex_s)
+		{
+			nClosestEndIndex_s = nCurrIndex;
+		}
+    }
+	nClosestEndIndex = nClosestEndIndex_s < nClosestEndIndex_e ? nClosestEndIndex_s : nClosestEndIndex_e;
+
+    nStartIndex = static_cast<sal_uInt16>( nClosestStartIndex );
+    nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
+	if ( bInCell )
+	{
+		EPosition aStartPos( nPara, nStartIndex ), aEndPos( nPara, nEndIndex );
+		sal_uInt32 nParaCount = rEE.GetParagraphCount();
+		sal_uInt32 nCrrntParaLen = rEE.GetTextLen(nPara);
+		//need to find closest index in front of nIndex in the previous paragraphs
+		if ( aStartPos.nIndex == 0 )
+		{
+			SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, 0, 1, GETATTRIBS_CHARATTRIBS );
+			for ( sal_Int32 nParaIdx = nPara-1; nParaIdx >= 0; nParaIdx-- )
+			{
+				sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) );
+				if ( nLen )
+				{
+					sal_uInt16 nStartIdx, nEndIdx;
+					GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), sal_uInt16(nLen), sal_False );
+					SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), sal_uInt16(nLen-1), sal_uInt16(nLen), GETATTRIBS_CHARATTRIBS );
+					if ( aSet == aCrrntSet )
+					{
+						aStartPos.nPara = sal_uInt16(nParaIdx);
+						aStartPos.nIndex = nStartIdx;
+						if ( aStartPos.nIndex != 0 )
+						{
+							break;
+						}
+					}
+				}
+			}
+		}
+		//need find closest index behind nIndex in the following paragrphs
+		if ( aEndPos.nIndex == nCrrntParaLen )
+		{
+			SfxItemSet aCrrntSet = rEE.GetAttribs( nPara, sal_uInt16(nCrrntParaLen-1), sal_uInt16(nCrrntParaLen), GETATTRIBS_CHARATTRIBS );
+			for ( sal_uInt32 nParaIdx = nPara+1; nParaIdx < nParaCount; nParaIdx++ )
+			{
+				sal_uInt32 nLen = rEE.GetTextLen( sal_uInt16(nParaIdx) );
+				if ( nLen )
+				{
+					sal_uInt16 nStartIdx, nEndIdx;
+					GetAttributeRun( nStartIdx, nEndIdx, rEE, sal_uInt16(nParaIdx), 0, sal_False );
+					SfxItemSet aSet = rEE.GetAttribs( sal_uInt16(nParaIdx), 0, 1, GETATTRIBS_CHARATTRIBS );
+					if ( aSet == aCrrntSet )
+					{
+						aEndPos.nPara = sal_uInt16(nParaIdx);
+						aEndPos.nIndex = nEndIdx;
+						if ( aEndPos.nIndex != nLen )
+						{
+							break;
+						}
+					}
+				}
+			}
+		}
+		nStartIndex = 0;
+		if ( aStartPos.nPara > 0 )
+		{
+			for ( sal_uInt16 i = 0; i < aStartPos.nPara; i++ )
+			{
+				nStartIndex += rEE.GetTextLen(i)+1;
+			}
+		}
+		nStartIndex += aStartPos.nIndex;
+		nEndIndex = 0;
+		if ( aEndPos.nPara > 0 )
+		{
+			for ( sal_uInt16 i = 0; i < aEndPos.nPara; i++ )
+			{
+				nEndIndex += rEE.GetTextLen(i)+1;
+			}
+		}
+		nEndIndex += aEndPos.nIndex;
+	}
+
+    return sal_True;
+
+#else // old implementation	
+
     EECharAttribArray aCharAttribs;
     
     rEE.GetCharAttribs( nPara, aCharAttribs );
@@ -166,6 +331,8 @@
     nEndIndex = static_cast<sal_uInt16>( nClosestEndIndex );
 
     return sal_True;
+
+#endif
 }
 
 Point SvxEditSourceHelper::EEToUserSpace( const Point& rPoint, const Size& rEESize, bool bIsVertical )
diff --git a/main/editeng/source/uno/unoedprx.cxx b/main/editeng/source/uno/unoedprx.cxx
index 1332660..5e74865 100644
--- a/main/editeng/source/uno/unoedprx.cxx
+++ b/main/editeng/source/uno/unoedprx.cxx
@@ -508,6 +508,9 @@
     EBulletInfo aBulletInfo1 = GetBulletInfo( static_cast< sal_uInt16 >(aStartIndex.GetParagraph()) );
     EBulletInfo aBulletInfo2 = GetBulletInfo( static_cast< sal_uInt16 >(aEndIndex.GetParagraph()) );
 
+    //IAccessibility2 Implementation 2009-----
+	// MT: This was done in OOo, commented out in IA2 CWS...
+    /*
     if( aStartIndex.InBullet() )
     {
         // prepend leading bullet
@@ -521,8 +524,8 @@
 
         sBullet += sStr;
         sStr = sBullet;
-    }
-
+    }*/
+    //-----IAccessibility2 Implementation 2009
     if( aEndIndex.InBullet() )
     {
         // append trailing bullet
@@ -751,7 +754,16 @@
 
     return mrTextForwarder->GetBulletInfo( nPara );
 }
-
+//IAccessible2 Implementation 2009----
+void	SvxAccessibleTextAdapter::SetUpdateModeForAcc( sal_Bool bUp)
+{
+	return mrTextForwarder->SetUpdateModeForAcc( bUp );
+}
+sal_Bool	SvxAccessibleTextAdapter::GetUpdateModeForAcc( ) const
+{
+	return mrTextForwarder->GetUpdateModeForAcc( );
+}
+//-----IAccessible2 Implementation 2009
 Rectangle SvxAccessibleTextAdapter::GetCharBounds( sal_uInt16 nPara, sal_uInt16 nIndex ) const
 {
     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
@@ -976,8 +988,7 @@
 
     return sal_True;
 }
-
-sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxAccessibleTextAdapter::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool /* bInCell */) const
 {
     DBG_ASSERT(mrTextForwarder, "SvxAccessibleTextAdapter: no forwarder");
 
diff --git a/main/editeng/source/uno/unofored.cxx b/main/editeng/source/uno/unofored.cxx
index e0d8457..620c0f9 100644
--- a/main/editeng/source/uno/unofored.cxx
+++ b/main/editeng/source/uno/unofored.cxx
@@ -453,10 +453,9 @@
 
     return sal_False;
 }
-
-sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxEditEngineForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const
 {
-    return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex );
+    return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rEditEngine, nPara, nIndex, bInCell );
 }
 
 sal_uInt16 SvxEditEngineForwarder::GetLineCount( sal_uInt16 nPara ) const
diff --git a/main/editeng/source/uno/unoforou.cxx b/main/editeng/source/uno/unoforou.cxx
index 098662f..56c75cb 100644
--- a/main/editeng/source/uno/unoforou.cxx
+++ b/main/editeng/source/uno/unoforou.cxx
@@ -411,10 +411,9 @@
 
     return sal_False;
 }
-
-sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
+sal_Bool SvxOutlinerForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const
 {
-    return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex );
+    return SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, rOutliner.GetEditEngine(), nPara, nIndex, bInCell );
 }
 
 sal_uInt16 SvxOutlinerForwarder::GetLineCount( sal_uInt16 nPara ) const
diff --git a/main/editeng/source/uno/unonrule.cxx b/main/editeng/source/uno/unonrule.cxx
index 853125e..58dbab3 100644
--- a/main/editeng/source/uno/unonrule.cxx
+++ b/main/editeng/source/uno/unonrule.cxx
@@ -221,11 +221,16 @@
 	}
 
 	{
+	//IAccessibility2 Implementation 2009-----
+		if(SVX_NUM_CHAR_SPECIAL == rFmt.GetNumberingType())
+	//-----IAccessibility2 Implementation 2009
+		{
 		sal_Unicode nCode = rFmt.GetBulletChar();
 		OUString aStr( &nCode, 1 );
 		aVal <<= aStr;
 		beans::PropertyValue aBulletProp( OUString(RTL_CONSTASCII_USTRINGPARAM("BulletChar")), -1, aVal, beans::PropertyState_DIRECT_VALUE);
 		pArray[nIdx++] = aBulletProp;
+		}
 	}
 
 	if( rFmt.GetBulletFont() )
diff --git a/main/editeng/source/uno/unotext.cxx b/main/editeng/source/uno/unotext.cxx
index 2c07983..7ce9ebf 100644
--- a/main/editeng/source/uno/unotext.cxx
+++ b/main/editeng/source/uno/unotext.cxx
@@ -2650,7 +2650,7 @@
     return sal_False;
 }
 
-sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const
+sal_Bool SvxDummyTextSource::GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16, sal_Bool ) const
 {
     return sal_False;
 }
diff --git a/main/filter/source/pdf/impdialog.cxx b/main/filter/source/pdf/impdialog.cxx
index eb4d92e..8fb88e7 100644
--- a/main/filter/source/pdf/impdialog.cxx
+++ b/main/filter/source/pdf/impdialog.cxx
@@ -643,7 +643,7 @@
 IMPL_LINK( ImpPDFTabGeneralPage, TogglePagesHdl, void*, EMPTYARG )
 {
     maEdPages.Enable( maRbRange.IsChecked() );
-    //Sym2_5805, When the control is disabled, it is also readonly. So here, it is not necessary to set it as readonly.
+    //When the control is disabled, it is also readonly. So here, it is not necessary to set it as readonly.
     //maEdPages.SetReadOnly( !maRbRange.IsChecked() );
     return 0;
 }
diff --git a/main/formula/source/ui/dlg/ControlHelper.hxx b/main/formula/source/ui/dlg/ControlHelper.hxx
index 2020bcf..1dc269d 100644
--- a/main/formula/source/ui/dlg/ControlHelper.hxx
+++ b/main/formula/source/ui/dlg/ControlHelper.hxx
@@ -183,6 +183,7 @@
 	void Hide();
 	void Show();
 
+	void UpdateAccessibleNames();
 };
 
 }
diff --git a/main/formula/source/ui/dlg/formdlgs.src b/main/formula/source/ui/dlg/formdlgs.src
index f45587a..7428942 100644
--- a/main/formula/source/ui/dlg/formdlgs.src
+++ b/main/formula/source/ui/dlg/formdlgs.src
@@ -225,11 +225,17 @@
 	    Right = TRUE ;
 	    Text [ en-US ] = "Function result" ;
     };
-    Window WND_RESULT
+//IAccessibility2 Implementation 2009-----
+    //Window WND_RESULT
+	FixedText WND_RESULT
+//-----IAccessibility2 Implementation 2009
     {
 	    Border = TRUE ;
 	    Pos = MAP_APPFONT ( 255 , 4 ) ;
 	    Size = MAP_APPFONT ( 60 , 12 ) ;
+//IAccessibility2 Implementation 2009-----
+		Text [ en-US ] = "Function result" ;
+//-----IAccessibility2 Implementation 2009
     };
     FixedText FT_FORMULA_RESULT
     {
diff --git a/main/formula/source/ui/dlg/funcutl.cxx b/main/formula/source/ui/dlg/funcutl.cxx
index b8efecd..97c2750 100644
--- a/main/formula/source/ui/dlg/funcutl.cxx
+++ b/main/formula/source/ui/dlg/funcutl.cxx
@@ -34,6 +34,9 @@
 #include "ControlHelper.hxx"
 #include "ModuleHelper.hxx"
 #include "ForResId.hrc"
+// IAccessibility2 implementation 2009. ------
+#include "com/sun/star/accessibility/AccessibleRole.hpp"
+// ------ IAccessibility2 implementation 2009.
 
 
 namespace formula
@@ -69,6 +72,7 @@
 	aRectOut = Rectangle( Point( 1, ( nDiff<2 ) ? 1 : nDiff/2),
 						  Size ( aSzWnd.Width()-2, nHeight ) );
 	SetClipRegion( Region( aRectOut ) );
+	SetAccessibleRole( ::com::sun::star::accessibility::AccessibleRole::LABEL );
 }
 
 //----------------------------------------------------------------------------
@@ -472,7 +476,21 @@
 		pRefBtn->Show();
 	}
 }
+//IAccessibility2 Implementation 2009-----
+void ArgInput::UpdateAccessibleNames()
+{
+	String aArgName = String::CreateFromAscii(":");
+	aArgName += pFtArg->GetText();
 
+	String aName = pBtnFx->GetQuickHelpText();
+	aName += aArgName;
+	pBtnFx->SetAccessibleName(aName);
+	
+	aName = pRefBtn->GetQuickHelpText();
+	aName += aArgName;
+	pRefBtn->SetAccessibleName(aName);	
+}
+	
 /*************************************************************************
 #*	Member:		FxClick										Datum:13.01.97
 #*------------------------------------------------------------------------
diff --git a/main/formula/source/ui/dlg/parawin.cxx b/main/formula/source/ui/dlg/parawin.cxx
index febe7a8..afd07ae 100644
--- a/main/formula/source/ui/dlg/parawin.cxx
+++ b/main/formula/source/ui/dlg/parawin.cxx
@@ -374,6 +374,7 @@
 void ParaWin::SetArgName(sal_uInt16 no,const String& aText)
 {
 	aArgInput[no].SetArgName(aText);
+	aArgInput[no].UpdateAccessibleNames();
 }
 
 void ParaWin::SetArgNameFont(sal_uInt16 no,const Font& aFont)
@@ -419,6 +420,7 @@
 	aArgInput[nPos].SetFxFocusHdl	( LINK( this, ParaWin, GetFxFocusHdl ) );
 	aArgInput[nPos].SetEdFocusHdl	( LINK( this, ParaWin, GetEdFocusHdl ) );
 	aArgInput[nPos].SetEdModifyHdl	( LINK( this, ParaWin, ModifyHdl ) );
+	aArgInput[nPos].UpdateAccessibleNames();
 }
 
 void ParaWin::ClearAll()
@@ -516,6 +518,7 @@
 		aArgInput[nEdFocus].SetArgSelection(Selection(0,SELECTION_MAX ));
 		nActiveLine=nEdFocus+nOffset;
 		ArgumentModified();
+		aArgInput[nEdFocus].UpdateAccessibleNames();
 	}
 	aScrollLink.Call(this);
 }
@@ -596,6 +599,7 @@
 		UpdateArgDesc( nEdFocus );
 		nActiveLine=nEdFocus+nOffset;
 		ArgumentModified();
+		aArgInput[nEdFocus].UpdateAccessibleNames();
 	}
 
 	return 0;
diff --git a/main/framework/source/loadenv/loadenv.cxx b/main/framework/source/loadenv/loadenv.cxx
index 0c843d4..07b0a07 100644
--- a/main/framework/source/loadenv/loadenv.cxx
+++ b/main/framework/source/loadenv/loadenv.cxx
@@ -187,6 +187,11 @@
           css::io::IOException               ,
           css::uno::RuntimeException         )
 {
+	//IAccessibility2 Implementation 2009-----
+#ifdef WNT	
+	CEnableAccessInterface e;
+#endif
+	//-----IAccessibility2 Implementation 2009
     css::uno::Reference< css::lang::XComponent > xComponent;
 
     try
diff --git a/main/graphite/graphite-2.3.1.patch b/main/graphite/graphite-2.3.1.patch
index 7adbd0e..508226a 100644
--- a/main/graphite/graphite-2.3.1.patch
+++ b/main/graphite/graphite-2.3.1.patch
@@ -2347,7 +2347,7 @@
  	}
  
 -	~GrSlotAbstract()
-+	virtual ~GrSlotAbstract()

++	virtual ~GrSlotAbstract()
  	{
  		// the table manager is responsible for destroying the contents of m_prgnVarLenBuf
  	}
@@ -2356,7 +2356,7 @@
  	}
  
 -	~GrSlotState()
-+	virtual ~GrSlotState()

++	virtual ~GrSlotState()
  	{
  	}
  
diff --git a/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl b/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
index 8f4cb10..809fe40 100644
--- a/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
+++ b/main/offapi/com/sun/star/accessibility/AccessibleEventId.idl
@@ -376,6 +376,17 @@
         @since OOo 3.2
     */
     const short LISTBOX_ENTRY_COLLAPSED = 33;
+
+    //IAccessibility2 Implementation 2009-----
+    const short ACTIVE_DESCENDANT_CHANGED_NOFOCUS = 34;
+    const short SELECTION_CHANGED_ADD =35;
+    const short SELECTION_CHANGED_REMOVE =36;
+    const short SELECTION_CHANGED_WITHIN =37;
+    const short PAGE_CHANGED =38;
+    const short SECTION_CHANGED =39;
+    const short COLUMN_CHANGED =40;
+    //-----IAccessibility2 Implementation 2009
+
 };
 
 }; }; }; };
diff --git a/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl b/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
index 5924d34..5696ec4 100644
--- a/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
+++ b/main/offapi/com/sun/star/accessibility/AccessibleRelationType.idl
@@ -110,6 +110,14 @@
         @since OOo 3.0
     */
     const short NODE_CHILD_OF = 9;
+
+    /** Described-by relation type.
+    
+        <p>Indicates an object is described by the target object.</p>
+
+        @since OOo 3.5
+    */
+    const short DESCRIBED_BY = 10;
 };
 
 }; }; }; };
diff --git a/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl b/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
index 4438d31..7c574e0 100644
--- a/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
+++ b/main/offapi/com/sun/star/accessibility/AccessibleStateType.idl
@@ -214,6 +214,27 @@
         partly in the visible area of its parent.</p>
     */
     const short VISIBLE = 30;
+    
+    // The following constants have been introduced with the IA2 CWS:
+
+	// MOVEABLE only exists in MSAA/IA2, but not in ATK/JAA/NSAccessibility.
+    /** Indicates the position of the object is not fixed.
+    */
+    const short MOVEABLE = 31;
+
+	// DEFAULT exists in MSAA/IA2, and now also in ATK and NSAccessibility.
+    /** Indicates the object is the default button in a window
+    */
+    const short DEFAULT = 32;
+
+	// OFFSCREEN only exists in MSAA/IA2, but not in ATK/JAA/NSAccessibility.
+    // MT: Shouldn't this be the same like !SHOWING in UAA/ATK?
+    const short OFFSCREEN = 33;
+
+	// COLLAPSED exists in MSAA/IA2, and now also in JAA, but not in ATK/NSAccessibility. In NSAccessibility, there is a notification for collapse.
+    // In opposite to MSAA, UAA has EXPANDABLE, so EXPANDABLE && !EXPANDED should be the same like COLLAPSED.
+    const short COLLAPSE = 34;
+
 };
 
 }; }; }; };
diff --git a/main/offapi/com/sun/star/accessibility/MSAAService.idl b/main/offapi/com/sun/star/accessibility/MSAAService.idl
new file mode 100644
index 0000000..4bbd42b
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/MSAAService.idl
@@ -0,0 +1,45 @@
+/*************************************************************************

+*

+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

+*

+*  Copyright IBM Corporation 2010.

+* Copyright 2000, 2010 Oracle and/or its affiliates.

+*

+* OpenOffice.org - a multi-platform office productivity suite

+*

+* This file is part of OpenOffice.org.

+*

+* OpenOffice.org is free software: you can redistribute it and/or modify

+* it under the terms of the GNU Lesser General Public License version 3

+* only, as published by the Free Software Foundation.

+*

+* OpenOffice.org is distributed in the hope that it will be useful,

+* but WITHOUT ANY WARRANTY; without even the implied warranty of

+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+* GNU Lesser General Public License version 3 for more details

+* (a copy is included in the LICENSE file that accompanied this code).

+*

+* You should have received a copy of the GNU Lesser General Public License

+* version 3 along with OpenOffice.org.  If not, see

+* <http://www.openoffice.org/license.html>

+* for a copy of the LGPLv3 License.

+*

+************************************************************************/

+#ifndef __com_sun_star_accessibility_Accessible_idl__
+#define __com_sun_star_accessibility_Accessible_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+#include <com/sun/star/lang/XInitialization.idl>
+#include "XMSAAService.idl"
+
+module com { module sun { module star { module accessibility {
+
+service MSAAService
+{
+	interface XMSAAService;
+		interface com::sun::star::lang::XInitialization;
+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleExtendedAttributes.idl b/main/offapi/com/sun/star/accessibility/XAccessibleExtendedAttributes.idl
new file mode 100644
index 0000000..f21cd5c
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleExtendedAttributes.idl
@@ -0,0 +1,49 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_accessibility_XAccessibleAttribute_idl__
+#define __com_sun_star_accessibility_XAccessibleAttribute_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#endif
+
+module com { module sun { module star { module accessibility {
+
+interface XAccessibleExtendedAttributes : ::com::sun::star::uno::XInterface
+{
+    /* Returns the attribute of this object' formula */ // MT: I guess it's not formula only?
+    any getExtendedAttributes() raises (::com::sun::star::lang::IndexOutOfBoundsException);
+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleGetAccFlowTo.idl b/main/offapi/com/sun/star/accessibility/XAccessibleGetAccFlowTo.idl
new file mode 100644
index 0000000..d69224f
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleGetAccFlowTo.idl
@@ -0,0 +1,48 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_accessibility_XAccessibleGetAccFlowTo_idl_
+#define __com_sun_star_accessibility_XAccessibleGetAccFlowTo_idl_
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+
+module com { module sun { module star { module accessibility {
+
+// !!!
+// MT: When integrating this, interface and method names should be renamed somehow. Of course, file name also need to change then...
+// !!!
+interface XAccessibleGetAccFlowTo : ::com::sun::star::uno::XInterface
+{
+	sequence<any> get_AccFlowTo([in] any aXShape, [in] long nType);
+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleGroupPosition.idl b/main/offapi/com/sun/star/accessibility/XAccessibleGroupPosition.idl
new file mode 100644
index 0000000..ced96f1
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleGroupPosition.idl
@@ -0,0 +1,52 @@
+/*************************************************************************

+ *

+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

+ * 

+ * Copyright IBM Corporation 2010.

+ * Copyright 2000, 2010 Oracle and/or its affiliates.

+ *

+ * OpenOffice.org - a multi-platform office productivity suite

+ *

+ * This file is part of OpenOffice.org.

+ *

+ * OpenOffice.org is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU Lesser General Public License version 3

+ * only, as published by the Free Software Foundation.

+ *

+ * OpenOffice.org is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU Lesser General Public License version 3 for more details

+ * (a copy is included in the LICENSE file that accompanied this code).

+ *

+ * You should have received a copy of the GNU Lesser General Public License

+ * version 3 along with OpenOffice.org.  If not, see

+ * <http://www.openoffice.org/license.html>

+ * for a copy of the LGPLv3 License.

+ *

+ ************************************************************************/

+

+#ifndef __com_sun_star_accessibility_XAccessibleGroupPosition_idl__
+#define __com_sun_star_accessibility_XAccessibleGroupPosition_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__
+#include <com/sun/star/uno/XInterface.idl>
+#endif
+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#endif
+
+module com { module sun { module star { module accessibility {
+
+interface XAccessibleGroupPosition : ::com::sun::star::uno::XInterface
+{
+    /* Returns the group position of the object */
+    sequence<long> getGroupPosition( [in] any accoject ) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+

+    /* Returns the hyperlink URL info of the object */

+    string getObjectLink( [in] any accoject ) raises (::com::sun::star::lang::IndexOutOfBoundsException);

+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl b/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
index 3ed6f7d..11245c5 100644
--- a/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleTable.idl
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef __com_sun_star_accessibility_XAccessibleTable_idl__
 #define __com_sun_star_accessibility_XAccessibleTable_idl__
 
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleTableSelection.idl b/main/offapi/com/sun/star/accessibility/XAccessibleTableSelection.idl
new file mode 100644
index 0000000..fcd6f5c
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleTableSelection.idl
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_accessibility_XAccessibleTableSelection_idl__
+#define __com_sun_star_accessibility_XAccessibleTableSelection_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__ 
+#include <com/sun/star/uno/XInterface.idl> 
+#endif 
+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#endif
+
+module com { module sun { module star { module accessibility {
+
+interface XAccessible;
+
+interface XAccessibleTableSelection : ::com::sun::star::uno::XInterface
+{
+	boolean selectRow ([in] long row) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+	boolean unselectRow ([in] long row) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+
+	boolean selectColumn ([in] long column) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+	boolean unselectColumn ([in] long column) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleTextSelection.idl b/main/offapi/com/sun/star/accessibility/XAccessibleTextSelection.idl
new file mode 100644
index 0000000..a56f770
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleTextSelection.idl
@@ -0,0 +1,67 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef __com_sun_star_accessibility_XAccessibleTextSelection_idl__
+#define __com_sun_star_accessibility_XAccessibleTextSelection_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__ 
+#include <com/sun/star/uno/XInterface.idl> 
+#endif 
+#ifndef __com_sun_star_awt_Point_idl__
+#include <com/sun/star/awt/Point.idl>
+#endif
+#ifndef __com_sun_star_awt_Rectangle_idl__
+#include <com/sun/star/awt/Rectangle.idl>
+#endif
+#ifndef __com_sun_star_lang_IndexOutOfBoundsException_idl__
+#include <com/sun/star/lang/IndexOutOfBoundsException.idl>
+#endif
+#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
+#include <com/sun/star/lang/IllegalArgumentException.idl>
+#endif
+
+module com { module sun { module star { module accessibility {
+
+interface XAccessibleTextSelection : ::com::sun::star::uno::XInterface
+{
+    boolean scrollToPosition ([in] ::com::sun::star::awt::Point aPoint, [in] boolean isLeftTop) raises (::com::sun::star::lang::IllegalArgumentException);
+            
+    long getSelectedPortionCount();
+    
+    long getSeletedPositionStart ([in] long nSelectedPortionIndex) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+
+    long getSeletedPositionEnd ([in] long nSelectedPortionIndex) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+
+    long addSelection( [in] long selectionIndex, [in]long startOffset, [in] long endOffset) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+	
+    boolean removeSelection( [in] long selectionIndex ) raises (::com::sun::star::lang::IndexOutOfBoundsException);
+};
+
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl b/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
index d711e62..12ff70e 100644
--- a/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
+++ b/main/offapi/com/sun/star/accessibility/XAccessibleValue.idl
@@ -19,8 +19,6 @@
  * 
  *************************************************************/
 
-
-
 #ifndef __com_sun_star_accessibility_XAccessibleValue_idl__
 #define __com_sun_star_accessibility_XAccessibleValue_idl__
 
diff --git a/main/offapi/com/sun/star/accessibility/XMSAAService.idl b/main/offapi/com/sun/star/accessibility/XMSAAService.idl
new file mode 100644
index 0000000..77cbd83
--- /dev/null
+++ b/main/offapi/com/sun/star/accessibility/XMSAAService.idl
@@ -0,0 +1,56 @@
+/*************************************************************************

+ *

+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

+ * 

+ * Copyright IBM Corporation 2010.

+ * Copyright 2000, 2010 Oracle and/or its affiliates.

+ *

+ * OpenOffice.org - a multi-platform office productivity suite

+ *

+ * This file is part of OpenOffice.org.

+ *

+ * OpenOffice.org is free software: you can redistribute it and/or modify

+ * it under the terms of the GNU Lesser General Public License version 3

+ * only, as published by the Free Software Foundation.

+ *

+ * OpenOffice.org is distributed in the hope that it will be useful,

+ * but WITHOUT ANY WARRANTY; without even the implied warranty of

+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the

+ * GNU Lesser General Public License version 3 for more details

+ * (a copy is included in the LICENSE file that accompanied this code).

+ *

+ * You should have received a copy of the GNU Lesser General Public License

+ * version 3 along with OpenOffice.org.  If not, see

+ * <http://www.openoffice.org/license.html>

+ * for a copy of the LGPLv3 License.

+ *

+ ************************************************************************/

+

+#ifndef __com_sun_star_accessibility_XMSAASERVICE_idl__
+#define __com_sun_star_accessibility_XMSAASERVICE_idl__
+
+#ifndef __com_sun_star_uno_XInterface_idl__ 
+#include <com/sun/star/uno/XInterface.idl> 
+#endif 
+
+module com { module sun { module star { module accessibility {
+
+/** The interface must be implemented for a server that can support MSAA com objects and send win32 accessible events
+*/
+interface XMSAAService : ::com::sun::star::uno::XInterface
+{
+    /** Return com object pointer.
+        
+        @return
+            A reference to the object that contains the actual accessibility information.
+            
+        @see AccessibleContext
+	*/
+    long getAccObjectPtr ([in] long hWnd, [in] long lParam, [in] long wParam);
+    
+    [oneway] void handleWindowOpened ([in] long i);
+};
+          
+}; }; }; };
+
+#endif
diff --git a/main/offapi/com/sun/star/accessibility/makefile.mk b/main/offapi/com/sun/star/accessibility/makefile.mk
index c30f17b..db4dc85 100644
--- a/main/offapi/com/sun/star/accessibility/makefile.mk
+++ b/main/offapi/com/sun/star/accessibility/makefile.mk
@@ -47,15 +47,18 @@
     AccessibleTableModelChangeType.idl              \
     AccessibleTextType.idl                          \
     IllegalAccessibleComponentStateException.idl    \
+    MSAAService.idl                                 \
     TextSegment.idl                                 \
     XAccessible.idl                                 \
     XAccessibleAction.idl                           \
     XAccessibleComponent.idl                        \
     XAccessibleContext.idl                          \
     XAccessibleEditableText.idl                     \
+    XAccessibleExtendedAttributes.idl               \
     XAccessibleEventBroadcaster.idl                 \
     XAccessibleEventListener.idl                    \
     XAccessibleExtendedComponent.idl                \
+    XAccessibleGroupPosition.idl                    \
     XAccessibleHyperlink.idl                        \
     XAccessibleHypertext.idl                        \
     XAccessibleImage.idl                            \
@@ -65,10 +68,15 @@
     XAccessibleSelection.idl                        \
     XAccessibleStateSet.idl                         \
     XAccessibleTable.idl                            \
+    XAccessibleTableSelection.idl                   \
     XAccessibleText.idl                             \
     XAccessibleTextAttributes.idl                   \
     XAccessibleTextMarkup.idl                       \
-    XAccessibleValue.idl
+    XAccessibleTextSelection.idl                    \
+    XAccessibleGetAccFlowTo.idl		            \
+    XAccessibleValue.idl                            \
+    XMSAAService.idl
+
 
 # ------------------------------------------------------------------
 
diff --git a/main/postprocess/packcomponents/makefile.mk b/main/postprocess/packcomponents/makefile.mk
index 60fc3c5..97c4f37 100644
--- a/main/postprocess/packcomponents/makefile.mk
+++ b/main/postprocess/packcomponents/makefile.mk
@@ -328,6 +328,7 @@
     java_uno_accessbridge \
     sysmail \
     sysdtrans \
+    winaccessibility \
     wininetbe1
 .END
 
diff --git a/main/postprocess/prj/build.lst b/main/postprocess/prj/build.lst
index 04608ec..ce2a2f5 100644
--- a/main/postprocess/prj/build.lst
+++ b/main/postprocess/prj/build.lst
@@ -1,4 +1,4 @@
-po      postprocess     ::      svgio accessibility automation basctl bean chart2 configmgr CRASHREP:crashrep COINMP:coinmp cui dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions extras fileaccess filter forms fpicker helpcontent2 hwpfilter io JAVAINSTALLER2:javainstaller2 lingucomponent MATHMLDTD:MathMLDTD ODK:odk officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts OOo:pyuno OOo:readlicense_oo SO:top unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder reportdesign sdext SWEXT:swext smoketestdoc uui writerfilter oox MYSQLC:mysqlc LIBXSLT:libxslt NULL
+po      postprocess     ::      svgio accessibility automation basctl bean chart2 configmgr CRASHREP:crashrep COINMP:coinmp cui dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions extras fileaccess filter forms fpicker helpcontent2 hwpfilter io JAVAINSTALLER2:javainstaller2 lingucomponent MATHMLDTD:MathMLDTD ODK:odk officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 scripting sd setup_native slideshow starmath sw sysui testtools ucb UnoControls unoxml ure wizards xmerge xmlsecurity MORE_FONTS:more_fonts OOo:pyuno OOo:readlicense_oo SO:top unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder reportdesign sdext SWEXT:swext smoketestdoc uui writerfilter winaccessibility oox MYSQLC:mysqlc LIBXSLT:libxslt NULL
 po	postprocess			    	usr1	-	all	po_mkout NULL
 po	postprocess\checkxml		nmake	-	all	po_checkxml NULL
 po	postprocess\checkdeliver	nmake	-	all	po_checkdlv NULL
diff --git a/main/sc/inc/chgtrack.hxx b/main/sc/inc/chgtrack.hxx
index 368c127..0b48f14 100644
--- a/main/sc/inc/chgtrack.hxx
+++ b/main/sc/inc/chgtrack.hxx
@@ -44,8 +44,25 @@
 #endif
 
 #define DEBUG_CHANGETRACK 0
+//IAccessibility2 Implementation 2009-----
+class ScChangeAction;
+class ScAppOptions;
+class ScActionColorChanger
+{
+private:
+	const ScAppOptions&		rOpt;
+	const ScStrCollection&	rUsers;
+	String					aLastUserName;
+	sal_uInt16					nLastUserIndex;
+	ColorData				nColor;
 
-
+public:
+				ScActionColorChanger( const ScChangeTrack& rTrack );
+				~ScActionColorChanger() {}
+				void		Update( const ScChangeAction& rAction );
+				ColorData	GetColor() const	{ return nColor; }
+};
+//-----IAccessibility2 Implementation 2009
 class ScBaseCell;
 class ScDocument;
 
diff --git a/main/sc/inc/detfunc.hxx b/main/sc/inc/detfunc.hxx
index 8125404..094cc79 100644
--- a/main/sc/inc/detfunc.hxx
+++ b/main/sc/inc/detfunc.hxx
@@ -155,6 +155,9 @@
 	static ColorData GetCommentColor();
 	static void InitializeColors();
 	static sal_Bool	IsColorsInitialized();
+//IAccessibility2 Implementation 2009-----
+	static void AppendChangTrackNoteSeparator(String &str);
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/inc/document.hxx b/main/sc/inc/document.hxx
index 489a65f..1b0bfeb 100644
--- a/main/sc/inc/document.hxx
+++ b/main/sc/inc/document.hxx
@@ -440,7 +440,23 @@
 
     sal_Int16           mnNamedRangesLockCount;
 
+//IAccessibility2 Implementation 2009-----
+	String msDocAccTitle;
 public:
+	// SC_DLLPUBLIC sal_Bool RowHidden( SCROW nRow, SCTAB nTab );
+	//inline sal_Bool 		RowHidden( SCROW nRow, SCTAB nTab );		// FillInfo
+	virtual void setDocAccTitle( const String& rTitle ) { msDocAccTitle = rTitle; }
+	virtual const String getDocAccTitle() const { return msDocAccTitle; }
+
+private:	
+	sal_Bool bReadOnly;  // MT: Really needed???
+
+public:
+	virtual void setDocReadOnly( sal_Bool b){ bReadOnly = b; }
+	virtual sal_Bool getDocReadOnly() const { return bReadOnly; }
+	sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
+	void GetCellChangeTrackNote( const ScAddress &cell,String &strTrackText,sal_Bool &pbLeftEdge);
+//-----IAccessibility2 Implementation 2009
 	SC_DLLPUBLIC sal_uLong			GetCellCount() const;		// alle Zellen
     SCSIZE          GetCellCount(SCTAB nTab, SCCOL nCol) const;
 	sal_uLong			GetWeightedCount() const;	// Formeln und Edit staerker gewichtet
@@ -466,6 +482,9 @@
 	SC_DLLPUBLIC void			InitDrawLayer( SfxObjectShell* pDocShell = NULL );
 	XColorListSharedPtr GetColorTable();
 
+//IAccessibility2 Implementation 2009-----
+	ScTable*      GetTableByIndex(sal_Int32 nIndex);
+//-----IAccessibility2 Implementation 2009
 	SC_DLLPUBLIC sfx2::LinkManager*		GetLinkManager() const;
 
 	SC_DLLPUBLIC const ScDocOptions&		GetDocOptions() const;
diff --git a/main/sc/inc/dptablecache.hxx b/main/sc/inc/dptablecache.hxx
index 6bf6e42..e69c7d1 100644
--- a/main/sc/inc/dptablecache.hxx
+++ b/main/sc/inc/dptablecache.hxx
@@ -22,14 +22,11 @@
 
 #ifndef DPTABLECACHE_HXX
 #define DPTABLECACHE_HXX
-// Wang Xu Ming -- 12/21/2008
 // Add Data Cache Support.
 #ifndef SC_SCGLOB_HXX
 #include "global.hxx"
 #endif
-//Added by PengYunQuan for SODC_16015
 #include <svl/zforlist.hxx>
-//end
 #include <vector>
 #include "dpglobal.hxx"
 
diff --git a/main/sc/inc/drwlayer.hxx b/main/sc/inc/drwlayer.hxx
index 1ab1f06..ce36641 100644
--- a/main/sc/inc/drwlayer.hxx
+++ b/main/sc/inc/drwlayer.hxx
@@ -230,6 +230,10 @@
 							const Point& rWinPoint, const Window& rCmpWnd );
 
     static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = sal_False );
+//IAccessibility2 Implementation 2009-----
+	virtual ImageMap* GetImageMapForObject(SdrObject* pObj);
+	virtual sal_Int32 GetHyperlinkCount(SdrObject* pObj);
+//-----IAccessibility2 Implementation 2009
 
 private:
 	static SfxObjectShell* pGlobalDrawPersist;			// fuer AllocModel
diff --git a/main/sc/inc/table.hxx b/main/sc/inc/table.hxx
index bc2fe8b..ab9a671 100644
--- a/main/sc/inc/table.hxx
+++ b/main/sc/inc/table.hxx
@@ -937,6 +937,11 @@
         SCROW mnCurRow;
         SCROW mnUBound;
     };
+
+//IAccessibility2 Implementation 2009-----
+public :
+	ScColumn* GetColumnByIndex(sal_Int32 index);
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/core/data/documen2.cxx b/main/sc/source/core/data/documen2.cxx
index c5c197b..fc40697 100644
--- a/main/sc/source/core/data/documen2.cxx
+++ b/main/sc/source/core/data/documen2.cxx
@@ -87,6 +87,11 @@
 #include "recursionhelper.hxx"
 #include "lookupcache.hxx"
 #include "externalrefmgr.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "appoptio.hxx"
+#include "scmod.hxx"
+#include "../../ui/inc/viewutil.hxx"
+//-----IAccessibility2 Implementation 2009
 #include "tabprotection.hxx"
 #include "formulaparserpool.hxx"
 #include "clipparam.hxx"
@@ -211,6 +216,9 @@
         eGrammar( formula::FormulaGrammar::GRAM_NATIVE ),
         bStyleSheetUsageInvalid( sal_True ),
         mbUndoEnabled( true ),
+//IAccessibility2 Implementation 2009-----
+		bReadOnly(sal_False),
+//-----IAccessibility2 Implementation 2009
         mbAdjustHeightEnabled( true ),
         mbExecuteLinkEnabled( true ),
         mbChangeReadOnlyEnabled( false ),
@@ -1295,3 +1303,158 @@
     if( pLookupCacheMapImpl )
         pLookupCacheMapImpl->clear();
 }
+//IAccessibility2 Implementation 2009-----
+sal_Bool ScDocument::IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder)
+{
+	ScChangeTrack* pTrack = GetChangeTrack();
+	ScChangeViewSettings* pSettings = GetChangeViewSettings();
+	if ( !pTrack || !pTrack->GetFirst() || !pSettings || !pSettings->ShowChanges() )
+		return sal_False;			// nix da oder abgeschaltet
+	ScActionColorChanger aColorChanger(*pTrack);
+	//	Clipping passiert von aussen
+	//!	ohne Clipping, nur betroffene Zeilen painten ??!??!?
+	const ScChangeAction* pAction = pTrack->GetFirst();
+	while (pAction)
+	{
+		ScChangeActionType eType;
+		if ( pAction->IsVisible() )
+		{
+			eType = pAction->GetType();
+			const ScBigRange& rBig = pAction->GetBigRange();
+			if ( rBig.aStart.Tab() == cell.Tab())
+			{
+				ScRange aRange = rBig.MakeRange();
+				if ( eType == SC_CAT_DELETE_ROWS )
+					aRange.aEnd.SetRow( aRange.aStart.Row() );
+				else if ( eType == SC_CAT_DELETE_COLS )
+					aRange.aEnd.SetCol( aRange.aStart.Col() );
+				if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+				{
+					if (aRange.In(cell))
+					{
+						if (pColCellBoder != NULL)
+						{
+							aColorChanger.Update( *pAction );
+							Color aColor( aColorChanger.GetColor() );
+							*pColCellBoder = aColor;
+						}
+						return sal_True;
+					}
+				}
+			}
+			if ( eType == SC_CAT_MOVE &&
+				((const ScChangeActionMove*)pAction)->
+				GetFromRange().aStart.Tab() == cell.Col() )
+			{
+				ScRange aRange = ((const ScChangeActionMove*)pAction)->
+					GetFromRange().MakeRange();
+				if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+				{
+					if (aRange.In(cell))
+					{
+						if (pColCellBoder != NULL)
+						{
+							aColorChanger.Update( *pAction );
+							Color aColor( aColorChanger.GetColor() );
+							*pColCellBoder = aColor;
+						}
+						return sal_True;
+					}
+				}
+			}
+		}
+		pAction = pAction->GetNext();
+	}
+	return sal_False;
+}
+void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos,String &aTrackText,sal_Bool &bLeftEdge)
+{
+	aTrackText=String();
+	//	Change-Tracking
+	ScChangeTrack* pTrack = GetChangeTrack();
+	ScChangeViewSettings* pSettings = GetChangeViewSettings();
+	if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges())
+	{
+		const ScChangeAction* pFound = NULL;
+		const ScChangeAction* pFoundContent = NULL;
+		const ScChangeAction* pFoundMove = NULL;
+		long nModified = 0;
+		const ScChangeAction* pAction = pTrack->GetFirst();
+		while (pAction)
+		{
+			if ( pAction->IsVisible() &&
+				 ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+			{
+				ScChangeActionType eType = pAction->GetType();
+				const ScBigRange& rBig = pAction->GetBigRange();
+				if ( rBig.aStart.Tab() == aCellPos.Tab())
+				{
+					ScRange aRange = rBig.MakeRange();
+					if ( eType == SC_CAT_DELETE_ROWS )
+						aRange.aEnd.SetRow( aRange.aStart.Row() );
+					else if ( eType == SC_CAT_DELETE_COLS )
+						aRange.aEnd.SetCol( aRange.aStart.Col() );
+					if ( aRange.In( aCellPos ) )
+					{
+						pFound = pAction;		// der letzte gewinnt
+						switch ( eType )
+						{
+							case SC_CAT_CONTENT :
+								pFoundContent = pAction;
+							break;
+							case SC_CAT_MOVE :
+								pFoundMove = pAction;
+							break;
+							default:
+								break;
+						}
+						++nModified;
+					}
+				}
+				if ( eType == SC_CAT_MOVE )
+				{
+					ScRange aRange =
+						((const ScChangeActionMove*)pAction)->
+						GetFromRange().MakeRange();
+					if ( aRange.In( aCellPos ) )
+					{
+						pFound = pAction;
+						++nModified;
+					}
+				}
+			}
+			pAction = pAction->GetNext();
+		}
+		if ( pFound )
+		{
+			if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT )
+				pFound = pFoundContent;		// Content gewinnt
+			if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE &&
+					pFoundMove->GetActionNumber() >
+					pFound->GetActionNumber() )
+				pFound = pFoundMove;		// Move gewinnt
+			//	bei geloeschten Spalten: Pfeil auf die linke Seite der Zelle
+			if ( pFound->GetType() == SC_CAT_DELETE_COLS )
+				bLeftEdge = sal_True;
+			DateTime aDT = pFound->GetDateTime();
+			aTrackText  = pFound->GetUser();
+			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
+            aTrackText += ScGlobal::pLocaleData->getDate(aDT);
+			aTrackText += ' ';
+            aTrackText += ScGlobal::pLocaleData->getTime(aDT);
+			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n" ));
+			String aComStr=pFound->GetComment();
+			if(aComStr.Len()>0)
+			{
+				aTrackText += aComStr;
+				aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n( " ));
+			}
+			pFound->GetDescription( aTrackText, this );
+			if(aComStr.Len()>0)
+			{
+				aTrackText +=')';
+			}
+		}
+	}
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/core/data/document.cxx b/main/sc/source/core/data/document.cxx
index 297b6db..0f4a6dd 100644
--- a/main/sc/source/core/data/document.cxx
+++ b/main/sc/source/core/data/document.cxx
@@ -200,6 +200,15 @@
 	return sal_False;
 }
 
+//IAccessibility2 Implementation 2009-----
+ScTable* ScDocument::GetTableByIndex(sal_Int32 nIndex)
+{
+  if ( nIndex <= MAXTAB && nIndex >= 0)
+     return  pTab[nIndex];
+
+  return NULL;
+}
+//-----IAccessibility2 Implementation 2009
 
 sal_Bool ScDocument::ValidTabName( const String& rName ) const
 {
diff --git a/main/sc/source/core/data/dpsave.cxx b/main/sc/source/core/data/dpsave.cxx
index c79d9a5..c9cb80f 100644
--- a/main/sc/source/core/data/dpsave.cxx
+++ b/main/sc/source/core/data/dpsave.cxx
@@ -1506,7 +1506,6 @@
         };
 
         //remove unused members
-        //SODC_19124
         for (MemberList::iterator i=maMemberList.begin(); i != maMemberList.end() ; )
         {
             rtl::OUString aMemberName = (*i)->GetName();
diff --git a/main/sc/source/core/data/dptablecache.cxx b/main/sc/source/core/data/dptablecache.cxx
index 8a019b8..569dcb7 100644
--- a/main/sc/source/core/data/dptablecache.cxx
+++ b/main/sc/source/core/data/dptablecache.cxx
@@ -196,8 +196,8 @@
 
 	if ( pCell && pCell->GetCellType() == CELLTYPE_FORMULA && ((ScFormulaCell*)pCell)->GetErrCode() )
     {
-        SetString ( aDocStr );      //[SODC_19347] add liyi
-        //bErr = sal_True;              //[SODC_19347] del liyi
+        SetString ( aDocStr );      
+        //bErr = sal_True;
         mbFlag |= MK_ERR;
     }
 	else if ( pDoc->HasValueData( nCol, nRow, nDocTab ) )
@@ -293,8 +293,7 @@
     else
         return ScGlobal::GetCollator()->compareString( rA.aString, rB.aString );
 }
-//
-//Wang Xu Ming SODC_17561
+
 #ifdef DEBUG
 void	ScDPItemData::dump() const
 {
@@ -304,7 +303,6 @@
 	DBG_TRACE1( "mbFlag= %d", mbFlag);
 }
 #endif
-//End
 
 TypedStrData*  ScDPItemData::CreateTypeString( )
 {
@@ -740,9 +738,8 @@
 						if ( bMatchWholeCell )
 						{
                         				bOk = pTransliteration->isEqual( aCellStr, *rEntry.pStr );
-							//Added by zhaosz,for sodc_2702,20060808
+							
 							String aStr = *rEntry.pStr;//"f*"
-							//modified by weihuaw,for SODC_16698
 							//use another way to find "*" in aStr
 							sal_Bool bHasStar = sal_False;
 							xub_StrLen nIndex;
@@ -1044,7 +1041,7 @@
 
 SCCOL ScDPTableDataCache::GetDimensionIndex(String sName) const
 {
-	for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong SODC_17590, SODC_18932,SODC_18827,SODC_18960,SODC_18923
+	for ( size_t n = 1; n < mrLabelNames.size(); n ++ ) //defects, label name map wrong
 	{
 		if ( mrLabelNames[n]->GetString() == sName )
 			return (SCCOL)(n-1);
diff --git a/main/sc/source/core/data/drwlayer.cxx b/main/sc/source/core/data/drwlayer.cxx
index e619f1e..d1143d6 100644
--- a/main/sc/source/core/data/drwlayer.cxx
+++ b/main/sc/source/core/data/drwlayer.cxx
@@ -2027,7 +2027,27 @@
     }
     return 0;
 }
+//IAccessibility2 Implementation 2009-----
+ImageMap* ScDrawLayer::GetImageMapForObject(SdrObject* pObj)
+{
+	ScIMapInfo* pIMapInfo = const_cast<ScIMapInfo*>( GetIMapInfo( pObj ) );
+	if ( pIMapInfo )
+	{
+		return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) );
+	}
+	return NULL;
+}
 
+sal_Int32 ScDrawLayer::GetHyperlinkCount(SdrObject* pObj)
+{
+	sal_Int32 nHLCount = 0;
+	ScMacroInfo* pMacroInfo = GetMacroInfo(pObj, sal_False);
+	if (pMacroInfo)
+		// MT IA2: GetHlink*( doesn|t exist in DEV300 anymore...
+		nHLCount = 0; // pMacroInfo->GetHlink().getLength() > 0 ? 1 : 0;
+	return nHLCount;
+}
+//-----IAccessibility2 Implementation 2009
 void ScDrawLayer::SetGlobalDrawPersist(SfxObjectShell* pPersist)			// static
 {
 	DBG_ASSERT(!pGlobalDrawPersist,"SetGlobalDrawPersist mehrfach");
diff --git a/main/sc/source/core/data/table2.cxx b/main/sc/source/core/data/table2.cxx
index 2f53d32..a98042c 100644
--- a/main/sc/source/core/data/table2.cxx
+++ b/main/sc/source/core/data/table2.cxx
@@ -3308,3 +3308,14 @@
 	return n;
 }
 
+//IAccessibility2 Implementation 2009-----
+ScColumn* ScTable::GetColumnByIndex(sal_Int32 index)
+{
+	if( index <= MAXCOL && index >= 0 )
+	{
+		return &(aCol[index]);
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/core/tool/detfunc.cxx b/main/sc/source/core/tool/detfunc.cxx
index 5fc8834..1ebaa45 100644
--- a/main/sc/source/core/tool/detfunc.cxx
+++ b/main/sc/source/core/tool/detfunc.cxx
@@ -1706,3 +1706,10 @@
 	return bColorsInitialized;
 }
 
+//IAccessibility2 Implementation 2009-----
+void ScDetectiveFunc::AppendChangTrackNoteSeparator(String &aDisplay)
+{
+	aDisplay.AppendAscii( RTL_CONSTASCII_STRINGPARAM("\n--------\n") );	
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/ui/Accessibility/AccessibleCell.cxx b/main/sc/source/ui/Accessibility/AccessibleCell.cxx
index d010476..f5e6c59 100644
--- a/main/sc/source/ui/Accessibility/AccessibleCell.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleCell.cxx
@@ -40,7 +40,9 @@
 #include "editsrc.hxx"
 #include "dociter.hxx"
 #include "cell.hxx"
-
+//IAccessibility2 Implementation 2009-----
+#include "validat.hxx"
+//-----IAccessibility2 Implementation 2009
 #ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX
 #include <unotools/accessiblestatesethelper.hxx>
 #endif
@@ -58,6 +60,9 @@
 #include <comphelper/sequence.hxx>
 #include <float.h>
 
+//IAccessibility2 Implementation 2009-----
+#include "AccessibleSpreadsheet.hxx"
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
@@ -117,11 +122,11 @@
 
 	//=====  XInterface  =====================================================
 
-IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+IMPLEMENT_FORWARD_XINTERFACE3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl )
 
     //=====  XTypeProvider  ===================================================
 
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+IMPLEMENT_FORWARD_XTYPEPROVIDER3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl )
 
 	//=====  XAccessibleComponent  ============================================
 
@@ -240,6 +245,25 @@
 		pStateSet->AddState(AccessibleStateType::DEFUNC);
     else
     {
+//IAccessibility2 Implementation 2009-----
+		if (IsFormulaMode())
+		{
+			pStateSet->AddState(AccessibleStateType::ENABLED);
+		    pStateSet->AddState(AccessibleStateType::MULTI_LINE);
+			pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+			if (IsOpaque(xParentStates))
+				pStateSet->AddState(AccessibleStateType::OPAQUE);
+			pStateSet->AddState(AccessibleStateType::SELECTABLE);
+			if (IsSelected())
+				pStateSet->AddState(AccessibleStateType::SELECTED);
+			if (isShowing())
+				pStateSet->AddState(AccessibleStateType::SHOWING);
+			pStateSet->AddState(AccessibleStateType::TRANSIENT);
+			if (isVisible())
+				pStateSet->AddState(AccessibleStateType::VISIBLE);
+			return pStateSet;
+		}
+//-----IAccessibility2 Implementation 2009
 	    if (IsEditable(xParentStates))
 	    {
 		    pStateSet->AddState(AccessibleStateType::EDITABLE);
@@ -248,6 +272,9 @@
 	    pStateSet->AddState(AccessibleStateType::ENABLED);
 	    pStateSet->AddState(AccessibleStateType::MULTI_LINE);
 	    pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+//IAccessibility2 Implementation 2009-----
+	    pStateSet->AddState(AccessibleStateType::FOCUSABLE);
+//-----IAccessibility2 Implementation 2009
 	    if (IsOpaque(xParentStates))
 		    pStateSet->AddState(AccessibleStateType::OPAQUE);
 	    pStateSet->AddState(AccessibleStateType::SELECTABLE);
@@ -344,6 +371,17 @@
 
 sal_Bool ScAccessibleCell::IsSelected()
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		const ScAccessibleSpreadsheet *pSheet =static_cast<const ScAccessibleSpreadsheet*>(mxParent.get());
+		if (pSheet)
+		{
+			return pSheet->IsScAddrFormulaSel(maCellAddress);
+		}
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
 	sal_Bool bResult(sal_False);
 	if (mpViewShell && mpViewShell->GetViewData())
 	{
@@ -363,6 +401,12 @@
 
 ::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return ::std::auto_ptr< SvxEditSource >();
+	}
+//-----IAccessibility2 Implementation 2009
 	::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
         ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
 	::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
@@ -453,3 +497,146 @@
 		pRelationSet->AddRelation(aRelation);
 	}
 }
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString ReplaceOneChar(::rtl::OUString oldOUString, ::rtl::OUString replacedChar, ::rtl::OUString replaceStr)
+{
+	int iReplace = -1;
+	iReplace = oldOUString.lastIndexOf(replacedChar);
+	if (iReplace > -1)
+	{
+		for(;iReplace>-1;)
+		{
+			oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+			iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+		}
+	}
+	return oldOUString;
+}
+::rtl::OUString ReplaceFourChar(::rtl::OUString oldOUString)
+{
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("\\"),::rtl::OUString::createFromAscii("\\\\"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(";"),::rtl::OUString::createFromAscii("\\;"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("="),::rtl::OUString::createFromAscii("\\="));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(","),::rtl::OUString::createFromAscii("\\,"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(":"),::rtl::OUString::createFromAscii("\\:"));
+	return oldOUString;
+}
+
+uno::Any SAL_CALL ScAccessibleCell::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any strRet;
+	if (mpViewShell)
+	{
+		const ::rtl::OUString strAttr(::rtl::OUString::createFromAscii(":"));
+		const ::rtl::OUString strSplit(::rtl::OUString::createFromAscii(";"));
+		::rtl::OUString strFor = mpViewShell->GetFormula(maCellAddress) ;
+		strFor = strFor.replaceAt(0,1,::rtl::OUString::createFromAscii(""));
+		strFor = ReplaceFourChar(strFor);
+		strFor =::rtl::OUString::createFromAscii("Formula:") + strFor;		
+		strFor +=strSplit; 
+		strFor +=::rtl::OUString::createFromAscii("Note:");
+		strFor +=ReplaceFourChar(GetAllDisplayNote());		
+		strFor +=strSplit; 
+		strFor += getShadowAttrs();//the string returned contains the spliter ";"
+		strFor += getBorderAttrs();//the string returned contains the spliter ";"
+		//end of cell attributes
+		if( mpDoc )
+		{
+			strFor += ::rtl::OUString::createFromAscii("isdropdown:");			
+			if( IsDropdown() ) 
+				strFor+= ::rtl::OUString::createFromAscii("true");
+			else
+				strFor+= ::rtl::OUString::createFromAscii("false");
+			strFor += ::rtl::OUString::createFromAscii(";");
+		}
+		strRet <<= strFor ;
+	}	
+	return strRet;
+}
+
+// cell has its own ParaIndent property, so when calling character attributes on cell, the ParaIndent should replace the ParaLeftMargin if its value is not zero.
+uno::Sequence< beans::PropertyValue > SAL_CALL ScAccessibleCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	uno::Sequence< beans::PropertyValue > aAttribs = AccessibleStaticTextBase::getCharacterAttributes( nIndex, aRequestedAttributes );
+	beans::PropertyValue *pAttribs = aAttribs.getArray();
+
+	sal_uInt16 nParaIndent = static_cast< const SfxUInt16Item* >( mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_INDENT ) )->GetValue();
+	if (nParaIndent > 0)
+	{
+		::rtl::OUString sLeftMarginName (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin")));		
+		for (int i = 0; i < aAttribs.getLength(); ++i)
+		{
+			if (sLeftMarginName == pAttribs[i].Name)
+			{
+				pAttribs[i].Value = uno::makeAny( nParaIndent );
+				break;
+			}
+		}
+	}
+	return aAttribs;
+}
+
+sal_Bool ScAccessibleCell::IsFormulaMode()
+{
+	ScAccessibleSpreadsheet* pSheet =static_cast<ScAccessibleSpreadsheet*>(mxParent.get());
+	if (pSheet)
+	{
+		return pSheet->IsFormulaMode();
+	}
+	return sal_False;	
+}
+sal_Bool ScAccessibleCell::IsDropdown()
+{	
+	sal_uInt16 nPosX = maCellAddress.Col();
+	sal_uInt16 nPosY = sal_uInt16(maCellAddress.Row());
+	sal_uInt16 nTab = maCellAddress.Tab();
+	//IAccessibility2 Implementation 2009-----
+	sal_uInt32 nValidation = static_cast< const SfxUInt32Item* >( mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_VALIDDATA ) )->GetValue();
+    if( nValidation )
+    {
+        const ScValidationData* pData = mpDoc->GetValidationEntry( nValidation );
+        if( pData && pData->HasSelectionList() )
+            return sal_True;
+    }
+	//-----IAccessibility2 Implementation 2009
+	ScMergeFlagAttr* pAttr;
+	pAttr = (ScMergeFlagAttr*)mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
+	if( pAttr->HasAutoFilter() )
+	{
+		return sal_True;	
+	}
+	else
+	{
+		sal_uInt16 nTabCount = mpDoc->GetTableCount();
+		if ( nTab+1<nTabCount && mpDoc->IsScenario(nTab+1) && !mpDoc->IsScenario(nTab) )
+		{
+			sal_uInt16 i;
+			ScMarkData aMarks;
+			for (i=nTab+1; i<nTabCount && mpDoc->IsScenario(i); i++)
+				mpDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME );
+			ScRangeList aRanges;
+			aMarks.FillRangeListWithMarks( &aRanges, sal_False );
+			sal_Bool bHasScenario;
+			sal_uInt16 nRangeCount = (sal_uInt16)aRanges.Count();
+			for (i=0; i<nRangeCount; i++)
+			{
+				ScRange aRange = *aRanges.GetObject(i);
+				mpDoc->ExtendTotalMerge( aRange );
+				sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 );
+				// MT IA2: Not used: sal_Bool bIsInScen = sal_False;
+				if ( bTextBelow )
+				{
+					bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aEnd.Row() == nPosY-1);
+				}
+				else
+				{
+					bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aStart.Row() == nPosY+1);
+				}
+				if( bHasScenario ) return sal_True;
+			}
+		}
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/main/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index 8187dbf..25ec3b1 100644
--- a/main/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -38,7 +38,10 @@
 #include "sc.hrc"
 #endif
 #include "unonames.hxx"
-
+//IAccessibility2 Implementation 2009-----
+#include "detfunc.hxx"
+#include "chgtrack.hxx"
+//-----IAccessibility2 Implementation 2009
 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEROLE_HPP_
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #endif
@@ -52,6 +55,11 @@
 #include <rtl/uuid.h>
 #include <comphelper/sequence.hxx>
 #include <sfx2/objsh.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/sheet/XSheetAnnotation.hpp>
+#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+//-----IAccessibility2 Implementation 2009
 
 #include <float.h>
 
@@ -226,17 +234,20 @@
     ScAccessibleCellBase::createAccessibleName(void)
     throw (uno::RuntimeException)
 {
-	String sName( ScResId(STR_ACC_CELL_NAME) );
+//IAccessibility2 Implementation 2009-----
+	//String sName( ScResId(STR_ACC_CELL_NAME) );
 	String sAddress;
 	// Document not needed, because only the cell address, but not the tablename is needed
 	// always us OOO notation
 	maCellAddress.Format( sAddress, SCA_VALID, NULL );
-	sName.SearchAndReplaceAscii("%1", sAddress);
+	//sName.SearchAndReplaceAscii("%1", sAddress);
     /*  #i65103# ZoomText merges cell address and contents, e.g. if value 2 is
         contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2".
         Simple solution: Append a space character to the cell address. */
-    sName.Append( ' ' );
-    return rtl::OUString(sName);
+    //sName.Append( ' ' );
+    //return rtl::OUString(sName);
+    return rtl::OUString(sAddress);
+//-----IAccessibility2 Implementation 2009
 }
 
 	//=====  XAccessibleValue  ================================================
@@ -249,8 +260,14 @@
     IsObjectValid();
 	uno::Any aAny;
 	if (mpDoc)
-		aAny <<= mpDoc->GetValue(maCellAddress);
-
+//IAccessibility2 Implementation 2009-----
+		//aAny <<= mpDoc->GetValue(maCellAddress);
+	{
+		String valStr;
+		mpDoc->GetString(maCellAddress.Col(),maCellAddress.Row(),maCellAddress.Tab(), valStr);
+		aAny <<= rtl::OUString(valStr);
+	}
+//-----IAccessibility2 Implementation 2009
 	return aAny;
 }
 
@@ -339,3 +356,305 @@
 		bEditable = sal_True;
 	return bEditable;
 }
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString SAL_CALL ScAccessibleCellBase::GetNote(void)
+								throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+    IsObjectValid();
+    rtl::OUString msNote;
+    if (mpDoc)
+    {
+        SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+        if ( pObjSh )
+        {
+            uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+            if ( xSpreadDoc.is() )
+            {
+                uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+                uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+                if ( xIndex.is() )
+                {
+                    uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+                    uno::Reference<sheet::XSpreadsheet> xTable;
+                    if (aTable>>=xTable)
+                    {
+                        uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+                        if (xCell.is())
+                        {
+							uno::Reference <sheet::XSheetAnnotationAnchor> xAnnotationAnchor ( xCell, uno::UNO_QUERY);
+							if(xAnnotationAnchor.is())
+							{
+								uno::Reference <sheet::XSheetAnnotation> xSheetAnnotation = xAnnotationAnchor->getAnnotation();
+								if (xSheetAnnotation.is())
+								{
+									uno::Reference <text::XSimpleText> xText (xSheetAnnotation, uno::UNO_QUERY);
+									if (xText.is())
+									{
+										msNote = xText->getString();
+									}
+								}
+							}
+                        }
+                    }
+                }
+            }
+        }
+    }
+	return msNote;
+}
+#ifndef _COM_SUN_STAR_TABLE_SHADOWFORMAT_HPP_
+#include <com/sun/star/table/ShadowFormat.hpp>
+#endif
+::rtl::OUString SAL_CALL ScAccessibleCellBase::getShadowAttrs(void)
+										throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+	IsObjectValid();
+	table::ShadowFormat aShadowFmt;
+	if (mpDoc)
+	{
+		SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+		if ( pObjSh )
+		{
+			uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+			if ( xSpreadDoc.is() )
+			{
+				uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+				uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+				if ( xIndex.is() )
+				{
+					uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+					uno::Reference<sheet::XSpreadsheet> xTable;
+					if (aTable>>=xTable)
+					{
+						uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+						if (xCell.is())
+						{
+							uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+							if (xCellProps.is())
+							{
+								uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHADOW)));
+								aAny >>= aShadowFmt;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	//construct shadow attributes string
+	rtl::OUString sShadowAttrs( RTL_CONSTASCII_USTRINGPARAM("Shadow:") );
+	rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") );
+	rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") );
+	sal_Int32 nLocationVal = 0;
+	switch( aShadowFmt.Location )
+	{
+	case table::ShadowLocation_TOP_LEFT:
+		nLocationVal = 1;
+		break;
+	case table::ShadowLocation_TOP_RIGHT:
+		nLocationVal = 2;
+		break;
+	case table::ShadowLocation_BOTTOM_LEFT:
+		nLocationVal = 3;
+		break;
+	case table::ShadowLocation_BOTTOM_RIGHT:
+		nLocationVal = 4;
+		break;
+	default:
+		break;
+	}
+	//if there is no shadow property for the cell
+	if ( nLocationVal == 0 )
+	{
+		sShadowAttrs += sOuterSplit;
+		return sShadowAttrs;
+	}
+	//else return all the shadow properties
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Location=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)nLocationVal );
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowWidth=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.ShadowWidth ) ;
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsTransparent=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Bool)aShadowFmt.IsTransparent ) ;
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.Color );
+	sShadowAttrs += sOuterSplit;
+	return sShadowAttrs;
+}
+#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_
+#include <com/sun/star/table/BorderLine.hpp>
+#endif
+::rtl::OUString SAL_CALL ScAccessibleCellBase::getBorderAttrs(void) 
+										throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+	IsObjectValid();
+	table::BorderLine aTopBorder;
+	table::BorderLine aBottomBorder;
+	table::BorderLine aLeftBorder;
+	table::BorderLine aRightBorder;
+	if (mpDoc)
+	{
+		SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+		if ( pObjSh )
+		{
+			uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+			if ( xSpreadDoc.is() )
+			{
+				uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+				uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+				if ( xIndex.is() )
+				{
+					uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+					uno::Reference<sheet::XSpreadsheet> xTable;
+					if (aTable>>=xTable)
+					{
+						uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+						if (xCell.is())
+						{
+							uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+							if (xCellProps.is())
+							{
+								uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TOPBORDER)));
+								aAny >>= aTopBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_BOTTBORDER)));
+								aAny >>= aBottomBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_LEFTBORDER)));
+								aAny >>= aLeftBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_RIGHTBORDER)));
+								aAny >>= aRightBorder;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	Color aColor;
+	sal_Bool bIn = mpDoc ? mpDoc->IsCellInChangeTrack(maCellAddress,&aColor) : sal_False;
+	if (bIn)
+	{
+		aTopBorder.Color = aColor.GetColor();
+		aBottomBorder.Color = aColor.GetColor();
+		aLeftBorder.Color = aColor.GetColor();
+		aRightBorder.Color = aColor.GetColor();
+		aTopBorder.OuterLineWidth =2;
+		aBottomBorder.OuterLineWidth =2;
+		aLeftBorder.OuterLineWidth =2;
+		aRightBorder.OuterLineWidth =2;
+	}
+
+	//construct border attributes string
+	rtl::OUString sBorderAttrs;
+	rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") );
+	rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") );
+	//top border
+	//if top of the cell has no border
+	if ( aTopBorder.InnerLineWidth == 0 && aTopBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:;") );
+	}
+	else//add all the border properties to the return string.
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//bottom border
+	if ( aBottomBorder.InnerLineWidth == 0 && aBottomBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorde:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//left border
+	if ( aLeftBorder.InnerLineWidth == 0 && aLeftBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//right border
+	if ( aRightBorder.InnerLineWidth == 0 && aRightBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	return sBorderAttrs;
+}
+//end of cell attributes
+
+::rtl::OUString SAL_CALL ScAccessibleCellBase::GetAllDisplayNote(void)
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	::rtl::OUString strNote;
+	String strTrackText;
+	if (mpDoc)
+	{
+		sal_Bool bLeftedge=sal_False;
+		mpDoc->GetCellChangeTrackNote(maCellAddress,strTrackText,bLeftedge);
+	}	
+	if (strTrackText.Len() > 0 )
+	{
+		ScDetectiveFunc::AppendChangTrackNoteSeparator(strTrackText);
+		strNote = strTrackText;
+	}
+	strNote += GetNote();
+	return strNote;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx b/main/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
index 69d6d3d..2fac54e 100644
--- a/main/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx
@@ -31,17 +31,32 @@
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <vcl/keycodes.hxx>
+//-----IAccessibility2 Implementation 2009
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX
 #include <unotools/accessiblestatesethelper.hxx>
+#endif
 #include <rtl/uuid.h>
 #include <tools/gen.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <tools/debug.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
 class ScAccessibleDataPilotButton
 	:	public ScAccessibleContextBase
+//IAccessibility2 Implementation 2009-----
+	, public ::com::sun::star::accessibility::XAccessibleAction
+//-----IAccessibility2 Implementation 2009
 {
 public:
 	//=====  internal  ========================================================
@@ -63,6 +78,19 @@
 protected:
 	virtual ~ScAccessibleDataPilotButton(void);
 public:
+//IAccessibility2 Implementation 2009-----
+	// XAccessibleAction
+	virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	///=====  XInterface  =====================================================
+	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 
+		::com::sun::star::uno::Type const & rType ) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL acquire() throw ();
+	virtual void SAL_CALL release() throw ();
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleComponent  ============================================
 
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
@@ -104,7 +132,10 @@
             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     	getAccessibleStateSet(void)
         throw (::com::sun::star::uno::RuntimeException);
-
+//IAccessibility2 Implementation 2009-----
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > 
+		SAL_CALL getAccessibleRelationSet(	) throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 	///=====  XServiceInfo  ====================================================
 
     /**	Returns an identifier for the implementation of this object.
@@ -296,6 +327,10 @@
     {
         DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
 
+//IAccessibility2 Implementation 2009-----
+		if(maChildren.size()==0)
+			return ;
+//-----IAccessibility2 Implementation 2009
         sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex());
         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
         if (xTempAcc.is() && maChildren[nIndex].pAcc)
@@ -308,7 +343,10 @@
     if (mpFieldWindow)
     {
         DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
-
+//IAccessibility2 Implementation 2009-----
+		if(maChildren.size()==0)
+			return ;
+//-----IAccessibility2 Implementation 2009
         sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex());
         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
         if (xTempAcc.is() && maChildren[nIndex].pAcc)
@@ -518,7 +556,11 @@
         ::com::sun::star::accessibility::XAccessible>& rxParent,
         ScPivotFieldWindow* pFieldWindow,
         sal_Int32 nIndex)
-    : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+//IAccessibility2 Implementation 2009-----
+//change role frome PUSH_BUTTON to BUTTON_MENU
+    //: ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+    : ScAccessibleContextBase(rxParent, AccessibleRole::BUTTON_MENU),
+//-----IAccessibility2 Implementation 2009
     mpFieldWindow(pFieldWindow),
     mnIndex(nIndex)
 {
@@ -657,7 +699,23 @@
 
     return pStateSet;
 }
+//IAccessibility2 Implementation 2009-----
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > 
+	SAL_CALL ScAccessibleDataPilotButton::getAccessibleRelationSet(	) throw (::com::sun::star::uno::RuntimeException)
+{
+	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+	if(mxParent.is())
+	{
+		uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+		aSequence[0] = mxParent;
+		pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+	}
 
+	return xSet;
+
+}
+//-----IAccessibility2 Implementation 2009
 	///=====  XServiceInfo  ====================================================
 
 ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
@@ -685,6 +743,10 @@
 ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
         throw (::com::sun::star::uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+	 if (mpFieldWindow)
+        return mpFieldWindow->GetHelpText();
+//-----IAccessibility2 Implementation 2009
     return rtl::OUString();
 }
 
@@ -721,3 +783,67 @@
     else
         return Rectangle();
 }
+//IAccessibility2 Implementation 2009-----
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+sal_Int32 ScAccessibleDataPilotButton::getAccessibleActionCount( ) throw (uno::RuntimeException)
+{
+	return 1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool ScAccessibleDataPilotButton::doAccessibleAction ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw lang::IndexOutOfBoundsException();
+	return sal_True;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString ScAccessibleDataPilotButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw lang::IndexOutOfBoundsException();
+	return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(  "press" ) );
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< XAccessibleKeyBinding > ScAccessibleDataPilotButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+		throw lang::IndexOutOfBoundsException();
+	  comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new comphelper::OAccessibleKeyBindingHelper();
+    ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    ScPivotFieldWindow* pWindow = mpFieldWindow;
+    if ( pWindow )
+    {
+        awt::KeyStroke aKeyStroke;
+        aKeyStroke.Modifiers = 0;
+        aKeyStroke.KeyCode = KEY_SPACE;
+        pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+    }
+    return xKeyBinding;
+}
+//=====  XInterface  =====================================================
+uno::Any SAL_CALL ScAccessibleDataPilotButton::queryInterface( uno::Type const & rType )
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	uno::Any aAny (ScAccessibleContextBase::queryInterface(rType));
+	if(!aAny.hasValue())
+	{
+	  aAny = ::cppu::queryInterface (rType,
+            static_cast<XAccessibleAction*>(this)
+            );
+	}
+    return aAny;
+}
+void SAL_CALL ScAccessibleDataPilotButton::acquire() 
+	throw ()
+{
+	ScAccessibleContextBase::acquire();
+}
+void SAL_CALL ScAccessibleDataPilotButton::release()
+	throw ()
+{
+	ScAccessibleContextBase::release();
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/ui/Accessibility/AccessibleDocument.cxx b/main/sc/source/ui/Accessibility/AccessibleDocument.cxx
index 1343ca6..b0a11ba 100644
--- a/main/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -70,9 +70,23 @@
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <toolkit/helper/convert.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <list>
 #include <algorithm>
+//IAccessibility2 Implementation 2009-----
+#include "AccessibleCell.hxx"
 
+#include "svx/unoapi.hxx"
+#include "scmod.hxx"
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 using ::std::for_each;
@@ -245,6 +259,16 @@
 		const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
 	)	throw (::com::sun::star::uno::RuntimeException);
 
+//IAccessibility2 Implementation 2009-----
+	virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel
+		(::com::sun::star::beans::XPropertySet* pSet) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual  ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>
+        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
+            ::com::sun::star::drawing::XShape>& xShape)
+			throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
     ///=====  Internal  ========================================================
     void SetDrawBroadcaster();
 
@@ -465,6 +489,45 @@
     return bResult;
 }
 
+//IAccessibility2 Implementation 2009-----
+::accessibility::AccessibleControlShape * ScChildrenShapes::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 count = GetCount();
+	for (sal_Int32 index=0;index<count;index++)
+	{
+		ScAccessibleShapeData* pShape = maZOrderedShapes[index];
+            	if (pShape)
+   	     	{
+   	     		::accessibility::AccessibleShape* pAccShape = pShape->pAccShape;
+          	 	if (pAccShape  && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
+          	  	{
+				::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+				if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+					return pCtlAccShape;
+			  }
+            	}
+	}
+	return NULL;
+}
+::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible >
+ScChildrenShapes::GetAccessibleCaption (const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape>& xShape)
+			throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 count = GetCount();
+	for (sal_Int32 index=0;index<count;index++)
+	{
+		ScAccessibleShapeData* pShape = maZOrderedShapes[index];
+			if (pShape && pShape->xShape == xShape )
+   	     	{
+				::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xNewChild(  pShape->pAccShape );	
+//				uno::Reference<XAccessible> xNewChild( pShape->pAccShape , uno::UNO_QUERY );					
+				if(xNewChild.get())
+				return xNewChild;
+			}
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
 sal_Int32 ScChildrenShapes::GetCount() const
 {
 	SdrPage* pDrawPage = GetDrawPage();
@@ -743,6 +806,9 @@
         std::vector < uno::Reference < drawing::XShape > > aShapes;
         FillShapes(aShapes);
 
+//IAccessibility2 Implementation 2009-----
+		if(aShapes.size()<=0) return xAccessible;
+//-----IAccessibility2 Implementation 2009
         SortedShapes::iterator aItr;
         if (FindShape(aShapes[nSelectedChildIndex], aItr))
             xAccessible = Get(aItr - maZOrderedShapes.begin());
@@ -887,9 +953,20 @@
     }
     else
         mnShapesSelected = 0;
+//IAccessibility2 Implementation 2009-----
+	SdrObject *pFocusedObj = NULL;
+	if( mnShapesSelected == 1 && aShapesList.size() == 1)
+	{
+		pFocusedObj = GetSdrObjectFromXShape(aShapesList[0]->xShape);
+	}
+//-----IAccessibility2 Implementation 2009
     ScShapeDataLess aLess;
     std::sort(aShapesList.begin(), aShapesList.end(), aLess);
-
+//IAccessibility2 Implementation 2009-----
+	SortedShapes vecSelectedShapeAdd;
+	SortedShapes vecSelectedShapeRemove;
+	sal_Bool bHasSelect=sal_False;
+//-----IAccessibility2 Implementation 2009
     SortedShapes::iterator aXShapesItr(aShapesList.begin());
     SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
     SortedShapes::iterator aDataItr(maZOrderedShapes.begin());
@@ -914,9 +991,18 @@
                         (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
                         bResult = sal_True;
+//IAccessibility2 Implementation 2009-----
+						vecSelectedShapeAdd.push_back((*aDataItr));
+//-----IAccessibility2 Implementation 2009
                     }
                     aFocusedItr = aDataItr;
                 }
+//IAccessibility2 Implementation 2009-----
+				else
+				{
+					 bHasSelect = sal_True;
+				}
+//-----IAccessibility2 Implementation 2009
                 ++aDataItr;
                 ++aXShapesItr;
             }
@@ -930,6 +1016,9 @@
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
                         bResult = sal_True;
+//IAccessibility2 Implementation 2009-----
+						vecSelectedShapeRemove.push_back(*aDataItr);
+//-----IAccessibility2 Implementation 2009
                     }
                 }
                 ++aDataItr;
@@ -944,9 +1033,122 @@
         else
             ++aDataItr;
     }
-    if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+//IAccessibility2 Implementation 2009-----
+	bool bWinFocus=false;
+	ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+	if (pWin)
+	{
+		bWinFocus = pWin->HasFocus();
+	}
+	const SdrMarkList* pMarkList = NULL;
+	SdrObject* pMarkedObj = NULL;
+	SdrObject* pUpObj = NULL;
+	sal_Bool bIsFocuseMarked = sal_True;
+	if( mpViewShell && mnShapesSelected == 1 && bWinFocus)	
+	{		
+		ScDrawView* pScDrawView = mpViewShell->GetViewData()->GetScDrawView();
+		if( pScDrawView )
+		{
+			if( pScDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
+			{
+				pMarkList = &(pScDrawView->GetMarkedObjectList());
+				pMarkedObj = pMarkList->GetMark(0)->GetMarkedSdrObj();
+				uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
+				if( aFocusedItr != aDataEndItr &&
+					(*aFocusedItr)->xShape.is() && 
+					xMarkedXShape.is() && 
+					(*aFocusedItr)->xShape != xMarkedXShape )
+					bIsFocuseMarked = sal_False;
+			}
+		}
+	}
+    //if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+    if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1) && bWinFocus)
+	{
         (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
+	}
+	else if( pFocusedObj && bWinFocus && pMarkList && pMarkList->GetMarkCount() == 1 && mnShapesSelected == 1 )
+	{		
+		if( pMarkedObj )
+		{
+			uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
+			pUpObj = pMarkedObj->GetUpGroup();
 
+			if( pMarkedObj == pFocusedObj )
+			{
+				if( pUpObj )
+				{
+					uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY);
+					uno::Reference < XAccessible > xAccGroupShape = 
+						const_cast<ScChildrenShapes*>(this)->GetAccessibleCaption( xUpGroupXShape );
+					if( xAccGroupShape.is() )
+					{
+						::accessibility::AccessibleShape* pAccGroupShape =  
+							static_cast< ::accessibility::AccessibleShape* >(xAccGroupShape.get());
+						if( pAccGroupShape )
+						{
+							sal_Int32 nCount =  pAccGroupShape->getAccessibleChildCount();
+							for( sal_Int32 i = 0; i < nCount; i++ )
+							{
+								uno::Reference<XAccessible> xAccShape = pAccGroupShape->getAccessibleChild(i);
+								if (xAccShape.is())
+								{
+									::accessibility::AccessibleShape* pChildAccShape =  static_cast< ::accessibility::AccessibleShape* >(xAccShape.get());
+									uno::Reference< drawing::XShape > xChildShape = pChildAccShape->GetXShape();
+									if (xChildShape == xMarkedXShape)
+									{
+			                			pChildAccShape->SetState(AccessibleStateType::FOCUSED);
+									}
+									else
+									{
+										pChildAccShape->ResetState(AccessibleStateType::FOCUSED);
+									}
+								}
+							}
+						}
+					}			
+				}
+			}
+		}
+	}
+	if (vecSelectedShapeAdd.size() >= 10 )
+	{
+		AccessibleEventObject aEvent;
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+		aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+		mpAccessibleDocument->CommitChange(aEvent);
+	}
+	else
+	{
+		SortedShapes::iterator vi = vecSelectedShapeAdd.begin();
+		for (; vi != vecSelectedShapeAdd.end() ; ++vi )
+		{
+			AccessibleEventObject aEvent;
+			if (bHasSelect)
+			{
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+			}
+			else
+			{
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+			}
+			aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+			uno::Reference< XAccessible > xChild( (*vi)->pAccShape);
+			aEvent.NewValue <<= xChild;
+			mpAccessibleDocument->CommitChange(aEvent);
+		}
+	}
+	SortedShapes::iterator vi = vecSelectedShapeRemove.begin();
+	for (; vi != vecSelectedShapeRemove.end() ; ++vi )
+	{
+		AccessibleEventObject aEvent;
+		aEvent.EventId =  AccessibleEventId::SELECTION_CHANGED_REMOVE;		
+		aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+		uno::Reference< XAccessible > xChild( (*vi)->pAccShape);
+		aEvent.NewValue <<= xChild;
+		mpAccessibleDocument->CommitChange(aEvent);
+	}
+//-----IAccessibility2 Implementation 2009
     std::for_each(aShapesList.begin(), aShapesList.end(), Destroy());
 
     return bResult;
@@ -1357,12 +1559,32 @@
 		const ScAccGridWinFocusGotHint& rRef = (const ScAccGridWinFocusGotHint&)rHint;
 		if (rRef.GetNewGridWin() == meSplitPos)
         {
+//IAccessibility2 Implementation 2009-----
+			uno::Reference<XAccessible> xAccessible;
+			if (mpChildrenShapes)
+			{
+				sal_Bool bTabMarked(IsTableSelected());				
+				xAccessible = mpChildrenShapes->GetSelected(0, bTabMarked);				
+			}
+			if( xAccessible.is() )
+			{				
+				uno::Any aNewValue;
+				aNewValue<<=AccessibleStateType::FOCUSED;
+				static_cast< ::accessibility::AccessibleShape* >(xAccessible.get())->
+					CommitChange(AccessibleEventId::STATE_CHANGED,
+								aNewValue,
+								uno::Any() );
+			}
+			else
+			{
             if (mxTempAcc.is() && mpTempAccEdit)
                 mpTempAccEdit->GotFocus();
             else if (mpAccessibleSpreadsheet)
                 mpAccessibleSpreadsheet->GotFocus();
             else
                 CommitFocusGained();
+			}            
+//-----IAccessibility2 Implementation 2009
         }
 	}
 	else if (rHint.ISA( SfxSimpleHint ))
@@ -1381,11 +1603,18 @@
             {
                 mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos );
             }
-
+//IAccessibility2 Implementation 2009-----
+			//Invoke Init() to rebuild the mpChildrenShapes variable
+			this->Init();
+//-----IAccessibility2 Implementation 2009
 			AccessibleEventObject aEvent;
 			aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
 			aEvent.Source = uno::Reference< XAccessibleContext >(this);
 			CommitChange(aEvent); // all childs changed
+//IAccessibility2 Implementation 2009-----
+			if (mpAccessibleSpreadsheet)
+				mpAccessibleSpreadsheet->FireFirstCellFocus();
+//-----IAccessibility2 Implementation 2009
 		}
         else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER)
         {
@@ -1396,19 +1625,25 @@
         {
             if (mpViewShell && mpViewShell->GetViewData()->HasEditView(meSplitPos))
             {
-                mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
-                    mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
-                    rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
-                uno::Reference<XAccessible> xAcc = mpTempAccEdit;
+				//IAccessibility2 Implementation 2009------
+				EditEngine* pEditEng = mpViewShell->GetViewData()->GetEditView(meSplitPos)->GetEditEngine();
+				if (pEditEng && pEditEng->GetUpdateMode())
+				{
+					mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
+						mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
+						rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
+					uno::Reference<XAccessible> xAcc = mpTempAccEdit;
 
-                AddChild(xAcc, sal_True);
+					AddChild(xAcc, sal_True);
 
-                if (mpAccessibleSpreadsheet)
-                    mpAccessibleSpreadsheet->LostFocus();
-                else
-                    CommitFocusLost();
+					if (mpAccessibleSpreadsheet)
+						mpAccessibleSpreadsheet->LostFocus();
+					else
+						CommitFocusLost();
 
-                mpTempAccEdit->GotFocus();
+					mpTempAccEdit->GotFocus();
+				}
+				//------IAccessibility2 Implementation 2009
             }
         }
         else if (rRef.GetId() == SC_HINT_ACC_LEAVEEDITMODE)
@@ -1420,10 +1655,15 @@
 
                 mpTempAccEdit = NULL;
                 RemoveChild(mxTempAcc, sal_True);
-
-                if (mpAccessibleSpreadsheet)
+//IAccessibility2 Implementation 2009-----
+                //if (mpAccessibleSpreadsheet)
+                if (mpAccessibleSpreadsheet && mpViewShell->IsActive())
+//-----IAccessibility2 Implementation 2009
                     mpAccessibleSpreadsheet->GotFocus();
-                else
+//IAccessibility2 Implementation 2009-----
+                //else
+                else if( mpViewShell->IsActive())
+//-----IAccessibility2 Implementation 2009
                     CommitFocusGained();
             }
         }
@@ -1484,6 +1724,12 @@
 
 		CommitChange(aEvent);
 	}
+//IAccessibility2 Implementation 2009-----
+    if(mpChildrenShapes )
+	{
+		mpChildrenShapes->SelectionChanged();
+	}
+//-----IAccessibility2 Implementation 2009
 }
 
 	//=====  XInterface  =====================================================
@@ -1491,6 +1737,15 @@
 uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType )
 	throw (uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+	uno::Any aAnyTmp;
+	if(rType == ::getCppuType((com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> *)NULL) )
+       {
+	     com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> AccFromXShape = this;
+            aAnyTmp <<= AccFromXShape;
+	     return aAnyTmp;
+       }
+//-----IAccessibility2 Implementation 2009
 	uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType));
 	return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
 }
@@ -1642,6 +1897,37 @@
 	return pStateSet;
 }
 
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString SAL_CALL
+    ScAccessibleDocument::getAccessibleName(void)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+	rtl::OUString sName = String(ScResId(STR_ACC_DOC_SPREADSHEET));
+	ScDocument* pScDoc = GetDocument();
+	if ( pScDoc )
+	{
+		rtl::OUString sFileName = pScDoc->getDocAccTitle();
+		if ( !sFileName.getLength() )
+		{
+			SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+			if ( pObjSh )
+			{
+				sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
+			}
+		}
+		rtl::OUString sReadOnly;
+		if (pScDoc->getDocReadOnly())
+		{
+			sReadOnly = String(ScResId(STR_ACC_DOC_SPREADSHEET_READONLY));
+		}
+		if ( sFileName.getLength() )
+		{
+			sName = sFileName + sReadOnly + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName;
+		}
+	}
+	return sName;
+}
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleSelection  ===========================================
 
 void SAL_CALL
@@ -2114,3 +2400,202 @@
 {
     return rtl::OUString();
 }
+//IAccessibility2 Implementation 2009-----
+ScDocument *ScAccessibleDocument::GetDocument() const
+{
+	return mpViewShell ? mpViewShell->GetViewData()->GetDocument() : NULL;  
+}
+ScAddress   ScAccessibleDocument::GetCurCellAddress() const
+{ 
+	return mpViewShell ? mpViewShell->GetViewData()->GetCurPos() :ScAddress(); 
+}
+uno::Any SAL_CALL ScAccessibleDocument::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	
+	uno::Any anyAtrribute;
+	
+	rtl::OUString sName;
+	rtl::OUString sValue;
+	sal_uInt16 sheetIndex;
+	String sSheetName;
+	sheetIndex = getVisibleTable();
+	if(GetDocument()==NULL)
+		return anyAtrribute;
+	GetDocument()->GetName(sheetIndex,sSheetName);
+	sName = rtl::OUString::createFromAscii("page-name:");
+	sValue = sName + sSheetName ;
+	sName = rtl::OUString::createFromAscii(";page-number:");
+	sValue += sName;
+	sValue += String::CreateFromInt32(sheetIndex+1) ;
+	sName = rtl::OUString::createFromAscii(";total-pages:");
+	sValue += sName;
+	sValue += String::CreateFromInt32(GetDocument()->GetTableCount());
+	sValue +=  rtl::OUString::createFromAscii(";");
+	anyAtrribute <<= sValue;
+	return anyAtrribute;
+}
+com::sun::star::uno::Sequence< com::sun::star::uno::Any > ScAccessibleDocument::GetScAccFlowToSequence()
+{
+	if ( getAccessibleChildCount() )
+	{
+		uno::Reference < XAccessible > xSCTableAcc = getAccessibleChild( 0 ); // table
+		if ( xSCTableAcc.is() )
+		{		
+			uno::Reference < XAccessibleSelection > xAccSelection( xSCTableAcc, uno::UNO_QUERY );
+			sal_Int32 nSelCount = xAccSelection->getSelectedAccessibleChildCount();
+			if( nSelCount )
+			{
+				uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); // selected cell
+				if ( xSel.is() )
+				{
+					uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+					if ( xSelContext.is() )
+					{										
+						if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL )
+						{
+							sal_Int32 nParaCount = 0;
+							uno::Sequence <uno::Any> aSequence(nSelCount);
+							for ( sal_Int32 i = 0; i < nSelCount; i++ )
+							{
+								xSel = xAccSelection->getSelectedAccessibleChild( i )	;
+								if ( xSel.is() )
+								{
+									xSelContext = xSel->getAccessibleContext();
+									if ( xSelContext.is() )
+									{
+										if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL )
+										{
+											aSequence[nParaCount] = uno::makeAny( xSel );
+											nParaCount++;
+										}
+									}
+								}
+							}
+							return aSequence;
+						}
+					}
+				}
+			}									
+		}
+	}
+	uno::Sequence <uno::Any> aEmpty;
+	return aEmpty;
+}
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL ScAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException )
+{
+	const sal_Int32 SPELLCHECKFLOWTO = 1;
+	const sal_Int32 FINDREPLACEFLOWTO = 2;
+	if ( nType == SPELLCHECKFLOWTO )
+	{
+		uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+		rAny >>= xShape;
+		if ( xShape.is() )
+		{
+			uno::Reference < XAccessible > xAcc = mpChildrenShapes->GetAccessibleCaption(xShape);
+			uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
+			if ( xAccSelection.is() )
+			{
+				if ( xAccSelection->getSelectedAccessibleChildCount() ) 
+				{
+					uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
+					if ( xSel.is() )
+					{
+						uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+						if ( xSelContext.is() )
+						{
+							//if in sw we find the selected paragraph here
+							if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+							{
+								uno::Sequence<uno::Any> aRet( 1 );
+								aRet[0] = uno::makeAny( xSel );
+								return aRet;
+							}
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			if ( getSelectedAccessibleChildCount() ) 
+			{
+				uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 );
+				if ( xSel.is() )
+				{
+					uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+					if ( xSelContext.is() )
+					{
+						uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY );
+						if ( xAccChildSelection.is() )
+						{
+							if ( xAccChildSelection->getSelectedAccessibleChildCount() )
+							{
+								uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 );
+								if ( xChildSel.is() )
+								{
+									uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() );
+									if ( xChildSelContext.is() &&
+										xChildSelContext->getAccessibleRole() == ::com::sun::star::accessibility::AccessibleRole::PARAGRAPH )
+									{
+										uno::Sequence<uno::Any> aRet( 1 );
+										aRet[0] = uno::makeAny( xChildSel );
+										return aRet;	
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	else if ( nType == FINDREPLACEFLOWTO )
+	{
+		sal_Bool bSuccess;
+		rAny >>= bSuccess;
+		if ( bSuccess )
+		{
+			uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
+			if ( aSeq.getLength() )
+			{
+				return aSeq;
+			}
+			else if( mpAccessibleSpreadsheet )
+			{
+				uno::Reference < XAccessible > xFindCellAcc = mpAccessibleSpreadsheet->GetActiveCell();
+				// add xFindCellAcc to the return the Sequence
+				uno::Sequence< uno::Any> aSeq2(1);
+				aSeq2[0] = uno::makeAny( xFindCellAcc );
+				return aSeq2;
+			}
+		}
+	}
+	uno::Sequence< uno::Any> aEmpty;
+	return aEmpty;
+}
+void ScAccessibleDocument::SwitchViewFireFocus()
+{
+	if (mpAccessibleSpreadsheet)
+	{
+		mpAccessibleSpreadsheet->FireFirstCellFocus();
+	}
+}
+
+sal_Int32 SAL_CALL ScAccessibleDocument::getForeground(  )
+        throw (uno::RuntimeException)
+{
+    return COL_BLACK;
+}
+
+sal_Int32 SAL_CALL ScAccessibleDocument::getBackground(  )
+        throw (uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+    IsObjectValid();
+    return SC_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx b/main/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
index 38f2393..9289608 100644
--- a/main/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleDocumentBase.cxx
@@ -45,3 +45,10 @@
 ScAccessibleDocumentBase::~ScAccessibleDocumentBase(void)
 {
 }
+//IAccessibility2 Implementation 2009-----
+void ScAccessibleDocumentBase::SwitchViewFireFocus()
+{
+	CommitFocusGained();
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/main/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index db0185c..404646c 100644
--- a/main/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1899,6 +1899,35 @@
     return mpShapeChilds;
 }
 
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString ScAccessibleDocumentPagePreview::getAccessibleName(void)
+throw (::com::sun::star::uno::RuntimeException)
+{
+	rtl::OUString sName = String(ScResId(STR_ACC_DOC_SPREADSHEET));
+	ScDocument* pScDoc = mpViewShell->GetDocument();
+	if ( pScDoc )
+	{
+		rtl::OUString sFileName = pScDoc->getDocAccTitle();
+		if ( !sFileName.getLength() )
+		{
+			SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+			if ( pObjSh )
+			{
+				sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
+			}
+		}
+		if ( sFileName.getLength() )
+		{
+			sName = sFileName + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName;
+			sName += String(ScResId(STR_ACC_DOC_PREVIEW_SUFFIX));
+			
+		}
+	}
+
+	return sName;
+}
+//-----IAccessibility2 Implementation 2009=======
+
 //UNUSED2009-05 uno::Reference < XAccessible > ScAccessibleDocumentPagePreview::GetCurrentAccessibleTable()
 //UNUSED2009-05 {
 //UNUSED2009-05     if (!mpTable)
diff --git a/main/sc/source/ui/Accessibility/AccessibleEditObject.cxx b/main/sc/source/ui/Accessibility/AccessibleEditObject.cxx
index 03af003..9fba9d7 100644
--- a/main/sc/source/ui/Accessibility/AccessibleEditObject.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleEditObject.cxx
@@ -44,10 +44,23 @@
 #include <rtl/uuid.h>
 #include <tools/debug.hxx>
 #include <svx/AccessibleTextHelper.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
+#include <com/sun/star/sheet/XSpreadsheet.hpp>
 #include <editeng/editview.hxx>
 #include <editeng/editeng.hxx>
 #include <svx/svdmodel.hxx>
+#include <sfx2/objsh.hxx>
 
+#include "unonames.hxx"
+#include "document.hxx"
+#include "AccessibleDocument.hxx"
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::uno::RuntimeException;
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
@@ -68,6 +81,23 @@
     CreateTextHelper();
     SetName(rName);
     SetDescription(rDescription);
+//IAccessibility2 Implementation 2009-----
+	if( meObjectType == CellInEditMode)
+	{
+		const ScAccessibleDocument *pAccDoc = const_cast<ScAccessibleDocument*>(static_cast<ScAccessibleDocument*>(rxParent.get())) ;
+		if (pAccDoc)
+		{
+			m_pScDoc = pAccDoc->GetDocument();
+			m_curCellAddress =pAccDoc->GetCurCellAddress();
+		}
+		else
+		{
+			m_pScDoc=NULL;
+		}
+	}
+	else
+		m_pScDoc=NULL;
+//-----IAccessibility2 Implementation 2009
 }
 
 ScAccessibleEditObject::~ScAccessibleEditObject()
@@ -106,6 +136,33 @@
         mpTextHelper->SetFocus(sal_True);
 }
 
+//IAccessibility2 Implementation 2009-----
+//=====  XInterface  ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+    ScAccessibleEditObject::queryInterface (const com::sun::star::uno::Type & rType)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any aReturn = ScAccessibleContextBase::queryInterface (rType);
+    if ( ! aReturn.hasValue())
+        aReturn = ::cppu::queryInterface (rType,
+            static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this)
+            );
+    return aReturn;
+}
+void SAL_CALL
+    ScAccessibleEditObject::acquire (void)
+    throw ()
+{
+    ScAccessibleContextBase::acquire ();
+}
+void SAL_CALL
+    ScAccessibleEditObject::release (void)
+    throw ()
+{
+    ScAccessibleContextBase::release ();
+}
+//-----IAccessibility2 Implementation 2009
 	//=====  XAccessibleComponent  ============================================
 
 uno::Reference< XAccessible > SAL_CALL ScAccessibleEditObject::getAccessibleAtPoint(
@@ -351,4 +408,153 @@
         }
     }
 }
+//IAccessibility2 Implementation 2009-----
+sal_Int32 SAL_CALL ScAccessibleEditObject::getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	return GetFgBgColor(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CCOLOR)));
+}
+
+sal_Int32 SAL_CALL ScAccessibleEditObject::getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	return GetFgBgColor(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_CELLBACK)));
+}
+sal_Int32 ScAccessibleEditObject::GetFgBgColor( const rtl::OUString &strPropColor)
+{
+    ScUnoGuard aGuard;
+    sal_Int32 nColor(0);
+    if (m_pScDoc)
+    {
+        SfxObjectShell* pObjSh = m_pScDoc->GetDocumentShell();
+        if ( pObjSh )
+        {
+            uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+            if ( xSpreadDoc.is() )
+            {
+                uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+                uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+                if ( xIndex.is() )
+                {
+                    uno::Any aTable = xIndex->getByIndex(m_curCellAddress.Tab());
+                    uno::Reference<sheet::XSpreadsheet> xTable;
+                    if (aTable>>=xTable)
+                    {
+                        uno::Reference<table::XCell> xCell = xTable->getCellByPosition(m_curCellAddress.Col(), m_curCellAddress.Row());
+                        if (xCell.is())
+                        {
+                            uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+                            if (xCellProps.is())
+                            {
+                                uno::Any aAny = xCellProps->getPropertyValue(strPropColor);
+                                aAny >>= nColor;
+                            }
+                        }
+                    }
+                }
+            }
+        }
+    }
+    return nColor;
+}
+//=====  XAccessibleSelection  ============================================
+//--------------------------------------------------------------------------------
+void SAL_CALL ScAccessibleEditObject::selectAccessibleChild( sal_Int32 ) 
+throw ( IndexOutOfBoundsException, RuntimeException )
+{
+}
+//----------------------------------------------------------------------------------
+sal_Bool SAL_CALL ScAccessibleEditObject::isAccessibleChildSelected( sal_Int32 nChildIndex ) 
+throw ( IndexOutOfBoundsException, 
+	   RuntimeException )
+{	
+	uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
+	uno::Reference<XAccessibleContext> xContext;
+	if( xAcc.is() )
+		xContext = xAcc->getAccessibleContext();
+	if( xContext.is() )
+	{
+		if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+		{
+			uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
+				xText(xAcc, uno::UNO_QUERY);
+			if( xText.is() )
+			{				
+				if( xText->getSelectionStart() >= 0 ) return sal_True;
+			}		
+		}
+	}	
+	return sal_False;	
+}
+//---------------------------------------------------------------------
+void SAL_CALL ScAccessibleEditObject::clearAccessibleSelection(  ) 
+throw ( RuntimeException )
+{
+}
+//-------------------------------------------------------------------------
+void SAL_CALL ScAccessibleEditObject::selectAllAccessibleChildren(  ) 
+throw ( RuntimeException )
+{
+}
+//----------------------------------------------------------------------------
+sal_Int32 SAL_CALL ScAccessibleEditObject::getSelectedAccessibleChildCount() 
+throw ( RuntimeException )
+{	
+	sal_Int32 nCount = 0;
+	sal_Int32 TotalCount = getAccessibleChildCount();
+	for( sal_Int32 i = 0; i < TotalCount; i++ )
+		if( isAccessibleChildSelected(i) ) nCount++;
+	return nCount;
+}
+//--------------------------------------------------------------------------------------
+uno::Reference<XAccessible> SAL_CALL ScAccessibleEditObject::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 
+throw ( IndexOutOfBoundsException, RuntimeException)
+{
+	if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
+		throw IndexOutOfBoundsException();
+	sal_Int32 i1, i2;
+	for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
+		if( isAccessibleChildSelected(i1) )
+		{
+			if( i2 == nSelectedChildIndex )
+				return getAccessibleChild( i1 );
+			i2++;
+		}
+	return uno::Reference<XAccessible>();
+}
+//----------------------------------------------------------------------------------
+void SAL_CALL ScAccessibleEditObject::deselectAccessibleChild( 
+															sal_Int32 ) 
+															throw ( IndexOutOfBoundsException, 
+															RuntimeException )
+{    
+}
+uno::Reference< XAccessibleRelationSet > ScAccessibleEditObject::getAccessibleRelationSet(  )
+    throw (uno::RuntimeException)
+{
+       ScUnoGuard aGuard;
+	Window* pWindow = mpWindow;
+	utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper;
+	uno::Reference< XAccessibleRelationSet > rSet = rRelationSet;
+	if ( pWindow )
+	{
+		Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+		if ( pLabeledBy && pLabeledBy != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pLabeledBy->GetAccessible();
+			rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) );
+		}
+		Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+		if ( pMemberOf && pMemberOf != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pMemberOf->GetAccessible();
+			rRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+		return rSet;
+	}
+	return uno::Reference< XAccessibleRelationSet >();
+}
+//-----IAccessibility2 Implementation 2009
 
diff --git a/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
index c2c4850..f912cbf 100644
--- a/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx
@@ -50,12 +50,212 @@
 #include <tools/debug.hxx>
 #include <tools/gen.hxx>
 #include <svtools/colorcfg.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include "scresid.hxx"
+#include "sc.hrc"
+//-----IAccessibility2 Implementation 2009
 #include <algorithm>
 
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
+//IAccessibility2 Implementation 2009-----
+bool CompMinCol(const std::pair<sal_uInt16,sal_uInt16> & pc1,const std::pair<sal_uInt16,sal_uInt16>  &pc2)
+{
+    return pc1.first < pc2.first;
+}
+ScMyAddress ScAccessibleSpreadsheet::CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex)
+{
+    if (pMarkedRanges->Count() <= 1)
+    {
+        ScRange* pRange = pMarkedRanges->First();
+        if (pRange)
+        {
+			// MT IA2: Not used.
+            // const int nRowNum = pRange->aEnd.Row() - pRange->aStart.Row() + 1;
+            const int nColNum = pRange->aEnd.Col() - pRange->aStart.Col() + 1;
+            const int nCurCol = nSelectedChildIndex % nColNum;
+            const int nCurRow = (nSelectedChildIndex - nCurCol)/nColNum;
+            return ScMyAddress(static_cast<SCCOL>(pRange->aStart.Col() + nCurCol), pRange->aStart.Row() + nCurRow, maActiveCell.Tab());
+        }
+    }
+    else
+    {
+        sal_Int32 nMinRow = MAXROW;
+        sal_Int32 nMaxRow = 0;
+        m_vecTempRange.clear();
+        ScRange* pRange = pMarkedRanges->First();
+        while (pRange)
+        {
+            if (pRange->aStart.Tab() != pRange->aEnd.Tab())
+            {
+                if ((maActiveCell.Tab() >= pRange->aStart.Tab()) ||
+                    maActiveCell.Tab() <= pRange->aEnd.Tab())
+                {
+                    m_vecTempRange.push_back(pRange);
+                    nMinRow = std::min(pRange->aStart.Row(),nMinRow);
+                    nMaxRow = std::max(pRange->aEnd.Row(),nMaxRow);
+                }
+                else
+                    DBG_ERROR("Range of wrong table");
+            }
+            else if(pRange->aStart.Tab() == maActiveCell.Tab())
+            {
+                m_vecTempRange.push_back(pRange);
+                nMinRow = std::min(pRange->aStart.Row(),nMinRow);
+                nMaxRow = std::max(pRange->aEnd.Row(),nMaxRow);
+            }
+            else
+                DBG_ERROR("Range of wrong table");
+            pRange = pMarkedRanges->Next();
+        }
+        int nCurrentIndex = 0 ;
+        for(sal_Int32 row = nMinRow ; row <= nMaxRow ; ++row)
+        {
+            m_vecTempCol.clear();
+            {
+                VEC_RANGE::const_iterator vi = m_vecTempRange.begin();
+                for (; vi < m_vecTempRange.end(); ++vi)
+                {
+                    ScRange *p = *vi;
+                    if ( row >= p->aStart.Row() && row <= p->aEnd.Row())
+                    {
+                        m_vecTempCol.push_back(std::make_pair(p->aStart.Col(),p->aEnd.Col()));
+                    }
+                }
+            }
+            std::sort(m_vecTempCol.begin(),m_vecTempCol.end(),CompMinCol);
+            {
+                VEC_COL::const_iterator vic = m_vecTempCol.begin();
+                for(; vic != m_vecTempCol.end(); ++vic)
+                {
+                    const PAIR_COL &pariCol = *vic;
+                    sal_uInt16 nCol = pariCol.second - pariCol.first + 1;
+                    if (nCol + nCurrentIndex > nSelectedChildIndex)
+                    {
+                        return ScMyAddress(static_cast<SCCOL>(pariCol.first + nSelectedChildIndex - nCurrentIndex), row, maActiveCell.Tab());
+                    }
+                    nCurrentIndex += nCol;
+                }
+            }
+        }
+    }
+    return ScMyAddress(0,0,maActiveCell.Tab());
+}
+sal_Bool ScAccessibleSpreadsheet::CalcScRangeDifferenceMax(ScRange *pSrc,ScRange *pDest,int nMax,VEC_MYADDR &vecRet,int &nSize)
+{
+    //Src Must be :Src > Dest
+    if (pDest->In(*pSrc))
+    {//Here is Src In Dest,Src <= Dest
+        return sal_False;
+    }
+	if (!pDest->Intersects(*pSrc))
+	{
+		int nCellCount = sal_uInt32(pDest->aEnd.Col() - pDest->aStart.Col() + 1)
+			* sal_uInt32(pDest->aEnd.Row() - pDest->aStart.Row() + 1)
+			* sal_uInt32(pDest->aEnd.Tab() - pDest->aStart.Tab() + 1);
+		if (nCellCount + nSize > nMax)
+		{
+			return sal_True;
+		}
+		else if(nCellCount > 0)
+		{
+			nCellCount +=nSize;
+			for (sal_Int32 row = pDest->aStart.Row(); row <=  pDest->aEnd.Row();++row)
+			{
+				for (sal_uInt16 col = pDest->aStart.Col(); col <=  pDest->aEnd.Col();++col)
+				{
+					vecRet.push_back(ScMyAddress(col,row,pDest->aStart.Tab()));
+				}
+			}
+		}
+		return sal_False;
+	}
+	sal_Int32 nMinRow = pSrc->aStart.Row(); 
+	sal_Int32 nMaxRow = pSrc->aEnd.Row();
+	for (; nMinRow <= nMaxRow ; ++nMinRow,--nMaxRow)
+	{
+		for (sal_uInt16 col = pSrc->aStart.Col(); col <=  pSrc->aEnd.Col();++col)
+		{
+			if (nSize > nMax)
+			{
+				return sal_True;
+			}
+			ScMyAddress cell(col,nMinRow,pSrc->aStart.Tab());
+			if(!pDest->In(cell))
+			{//In Src ,Not In Dest
+				vecRet.push_back(cell);
+				++nSize;
+			}
+		}
+		if (nMinRow != nMaxRow)
+		{
+			for (sal_uInt16 col = pSrc->aStart.Col(); col <=  pSrc->aEnd.Col();++col)
+			{
+				if (nSize > nMax)
+				{
+					return sal_True;
+				}
+				ScMyAddress cell(col,nMaxRow,pSrc->aStart.Tab());
+				if(!pDest->In(cell))
+				{//In Src ,Not In Dest
+					vecRet.push_back(cell);
+					++nSize;
+				}
+			}
+		}
+	}
+    return sal_False;
+}
+//In Src , Not in Dest
+sal_Bool ScAccessibleSpreadsheet::CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet)
+{
+    if (pSrc == NULL || pDest == NULL)
+    {
+        return sal_False;
+    }
+    int nSize =0;
+    if (pDest->GetCellCount() == 0)//if the Dest Rang List is empty
+    {
+        if (pSrc->GetCellCount() > sal_uInt32(nMax))//if the Src Cell count is greater then  nMax
+        {
+            return sal_True;
+        }
+        //now the cell count is less then nMax
+        vecRet.reserve(10);
+        ScRange* pRange = pSrc->First();
+        while (pRange)
+        {
+            for (sal_Int32 row = pRange->aStart.Row(); row <=  pRange->aEnd.Row();++row)
+            {
+                for (sal_uInt16 col = pRange->aStart.Col(); col <=  pRange->aEnd.Col();++col)
+                {
+                    vecRet.push_back(ScMyAddress(col,row,pRange->aStart.Tab()));
+                }
+            }
+            pRange = pSrc->Next();
+        }
+        return sal_False;
+    }
+    //the Dest Rang List is not empty
+    vecRet.reserve(10);
+    ScRange* pRange = pSrc->First();
+    while (pRange)
+    {
+        ScRange* pRangeDest = pDest->First();
+        while (pRangeDest)
+        {   
+            if (CalcScRangeDifferenceMax(pRange,pRangeDest,nMax,vecRet,nSize))
+            {
+                return sal_True;
+            }
+            pRangeDest = pDest->Next();
+        }
+        pRange = pSrc->Next();
+    }
+    return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
 //=====  internal  ============================================================
 
 ScAccessibleSpreadsheet::ScAccessibleSpreadsheet(
@@ -66,7 +266,13 @@
 	:
 	ScAccessibleTableBase (pAccDoc, GetDocument(pViewShell),
         ScRange(ScAddress(0, 0, nTab),ScAddress(MAXCOL, MAXROW, nTab))),
-    mbIsSpreadsheet( sal_True )
+    mbIsSpreadsheet( sal_True ),
+//IAccessibility2 Implementation 2009-----
+	m_bFormulaMode(sal_False),
+	m_bFormulaLastMode(sal_False),
+	m_pAccFormulaCell(NULL),
+	m_nMinX(0),m_nMaxX(0),m_nMinY(0),m_nMaxY(0)
+//-----IAccessibility2 Implementation 2009
 {
     ConstructScAccessibleSpreadsheet( pAccDoc, pViewShell, nTab, eSplitPos );
 }
@@ -83,8 +289,10 @@
 {
 	if (mpMarkedRanges)
 		delete mpMarkedRanges;
-	if (mpSortedMarkedCells)
-		delete mpSortedMarkedCells;
+//IAccessibility2 Implementation 2009-----
+	//if (mpSortedMarkedCells)
+	//	delete mpSortedMarkedCells;
+//-----IAccessibility2 Implementation 2009
 	if (mpViewShell)
 		mpViewShell->RemoveAccessibilityObject(*this);
 }
@@ -118,7 +326,14 @@
         mpAccCell = GetAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
         mpAccCell->acquire();
         mpAccCell->Init();
-    }
+		//IAccessibility2 Implementation 2009-----
+		ScDocument* pScDoc= GetDocument(mpViewShell);
+		if (pScDoc)
+		{
+			pScDoc->GetName( maActiveCell.Tab(), m_strOldTabName );
+		}
+		//-----IAccessibility2 Implementation 2009
+    }	
 }
 
 void SAL_CALL ScAccessibleSpreadsheet::disposing()
@@ -140,11 +355,18 @@
 
 void ScAccessibleSpreadsheet::CompleteSelectionChanged(sal_Bool bNewState)
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return ;
+	}
+//-----IAccessibility2 Implementation 2009
 	if (mpMarkedRanges)
 		DELETEZ(mpMarkedRanges);
-	if (mpSortedMarkedCells)
-		DELETEZ(mpSortedMarkedCells);
-
+//IAccessibility2 Implementation 2009-----
+	//if (mpSortedMarkedCells)
+	//	DELETEZ(mpSortedMarkedCells);
+//-----IAccessibility2 Implementation 2009
 	mbHasSelection = bNewState;
 
     AccessibleEventObject aEvent;
@@ -173,12 +395,46 @@
 
 void ScAccessibleSpreadsheet::GotFocus()
 {
-    CommitFocusGained();
-
+//IAccessibility2 Implementation 2009-----
+    //CommitFocusGained();
+//-----IAccessibility2 Implementation 2009
 	AccessibleEventObject aEvent;
 	aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
 	aEvent.Source = uno::Reference< XAccessibleContext >(this);
-    uno::Reference< XAccessible > xNew = mpAccCell;
+//IAccessibility2 Implementation 2009-----
+    //uno::Reference< XAccessible > xNew = mpAccCell;
+    uno::Reference< XAccessible > xNew;
+	if (IsFormulaMode())
+	{
+		if (!m_pAccFormulaCell || !m_bFormulaLastMode)
+		{
+			ScAddress aFormulaAddr;
+			if(!GetFormulaCurrentFocusCell(aFormulaAddr))
+			{
+				return;
+			}
+			m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(),aFormulaAddr.Col());
+
+			m_pAccFormulaCell->acquire();
+			m_pAccFormulaCell->Init();
+
+
+		}
+	    xNew = m_pAccFormulaCell;
+	}
+	else
+	{
+		if(mpAccCell->GetCellAddress() == maActiveCell)
+		{
+			xNew = mpAccCell;
+		}
+		else
+		{
+			CommitFocusCell(maActiveCell);
+			return ;
+		}		
+	}
+//-----IAccessibility2 Implementation 2009
 	aEvent.NewValue <<= xNew;
 
 	CommitChange(aEvent);
@@ -210,58 +466,247 @@
 	{
 		const SfxSimpleHint& rRef = (const SfxSimpleHint&)rHint;
 		// only notify if child exist, otherwise it is not necessary
+//IAccessibility2 Implementation 2009-----		
+		//if ((rRef.GetId() == SC_HINT_ACC_CURSORCHANGED))
+		//{
+		//	if (mpViewShell)
+		//	{
+		//		ScAddress aNewCell = mpViewShell->GetViewData()->GetCurPos();
+		//		sal_Bool bNewMarked(mpViewShell->GetViewData()->GetMarkData().GetTableSelect(aNewCell.Tab()) &&
+		//			(mpViewShell->GetViewData()->GetMarkData().IsMarked() ||
+		//			mpViewShell->GetViewData()->GetMarkData().IsMultiMarked()));
+		//		sal_Bool bNewCellSelected(isAccessibleSelected(aNewCell.Row(), aNewCell.Col()));
+		//		if ((bNewMarked != mbHasSelection) ||
+		//			(!bNewCellSelected && bNewMarked) ||
+		//			(bNewCellSelected && mbHasSelection))
+		//		{
+		//			if (mpMarkedRanges)
+		//				DELETEZ(mpMarkedRanges);
+		//			if (mpSortedMarkedCells)
+		//				DELETEZ(mpSortedMarkedCells);
+		//			AccessibleEventObject aEvent;
+		//			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+		//			aEvent.Source = uno::Reference< XAccessibleContext >(this);
+
+		//			mbHasSelection = bNewMarked;
+
+		//			CommitChange(aEvent);
+		//		}
+
+  //              // active descendant changed event (new cell selected)
+  //              bool bFireActiveDescChanged = (aNewCell != maActiveCell) &&
+  //                  (aNewCell.Tab() == maActiveCell.Tab()) && IsFocused();
+
+  //              /*  Remember old active cell and set new active cell.
+  //                  #i82409# always update the class members mpAccCell and
+  //                  maActiveCell, even if the sheet is not focused, e.g. when
+  //                  using the name box in the toolbar. */
+  //              uno::Reference< XAccessible > xOld = mpAccCell;
+  //              mpAccCell->release();
+  //              mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
+  //              mpAccCell->acquire();
+  //              mpAccCell->Init();
+  //              uno::Reference< XAccessible > xNew = mpAccCell;
+  //              maActiveCell = aNewCell;
+
+  //              // #i14108# fire event only if sheet is focused
+  //              if( bFireActiveDescChanged )
+  //              {
+  //                  AccessibleEventObject aEvent;
+  //                  aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
+  //                  aEvent.Source = uno::Reference< XAccessibleContext >(this);
+  //                  aEvent.OldValue <<= xOld;
+  //                  aEvent.NewValue <<= xNew;
+		//			CommitChange(aEvent);
+  //              }
+		//	}
+		//}
+		//else if ((rRef.GetId() == SC_HINT_DATACHANGED))
+		//{
+		//	if (!mbDelIns)
+		//		CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE);
+		//	else
+		//		mbDelIns = sal_False;
+		//}
 		if ((rRef.GetId() == SC_HINT_ACC_CURSORCHANGED))
 		{
 			if (mpViewShell)
 			{
-				ScAddress aNewCell = mpViewShell->GetViewData()->GetCurPos();
-				sal_Bool bNewMarked(mpViewShell->GetViewData()->GetMarkData().GetTableSelect(aNewCell.Tab()) &&
-					(mpViewShell->GetViewData()->GetMarkData().IsMarked() ||
-					mpViewShell->GetViewData()->GetMarkData().IsMultiMarked()));
-				sal_Bool bNewCellSelected(isAccessibleSelected(aNewCell.Row(), aNewCell.Col()));
-				if ((bNewMarked != mbHasSelection) ||
-					(!bNewCellSelected && bNewMarked) ||
-					(bNewCellSelected && mbHasSelection))
+				ScViewData *pViewData = mpViewShell->GetViewData();
+
+				m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode();
+				if ( m_bFormulaMode )
 				{
-					if (mpMarkedRanges)
-						DELETEZ(mpMarkedRanges);
-					if (mpSortedMarkedCells)
-						DELETEZ(mpSortedMarkedCells);
-					AccessibleEventObject aEvent;
-					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-					aEvent.Source = uno::Reference< XAccessibleContext >(this);
-
-					mbHasSelection = bNewMarked;
-
-					CommitChange(aEvent);
+					NotifyRefMode();
+					m_bFormulaLastMode = true;
+					return ;
 				}
+				if (m_bFormulaLastMode)
+				{//Last Notify Mode  Is Formula Mode.
+					m_vecFormulaLastMyAddr.clear();
+					RemoveFormulaSelection(sal_True);
+					if(m_pAccFormulaCell)
+					{
+						m_pAccFormulaCell->release();
+						m_pAccFormulaCell =NULL;
+					}
+					//Remove All Selection
+				}
+				m_bFormulaLastMode = m_bFormulaMode;
 
-                // active descendant changed event (new cell selected)
-                bool bFireActiveDescChanged = (aNewCell != maActiveCell) &&
-                    (aNewCell.Tab() == maActiveCell.Tab()) && IsFocused();
-
-                /*  Remember old active cell and set new active cell.
-                    #i82409# always update the class members mpAccCell and
-                    maActiveCell, even if the sheet is not focused, e.g. when
-                    using the name box in the toolbar. */
-                uno::Reference< XAccessible > xOld = mpAccCell;
-                mpAccCell->release();
-                mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
-                mpAccCell->acquire();
-                mpAccCell->Init();
-                uno::Reference< XAccessible > xNew = mpAccCell;
-                maActiveCell = aNewCell;
-
-                // #i14108# fire event only if sheet is focused
-                if( bFireActiveDescChanged )
-                {
-                    AccessibleEventObject aEvent;
-                    aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
-                    aEvent.Source = uno::Reference< XAccessibleContext >(this);
-                    aEvent.OldValue <<= xOld;
-                    aEvent.NewValue <<= xNew;
+				AccessibleEventObject aEvent;
+				aEvent.Source = uno::Reference< XAccessible >(this);
+				ScAddress aNewCell = pViewData->GetCurPos();
+				if(aNewCell.Tab() != maActiveCell.Tab())
+				{
+					aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
+					ScAccessibleDocument *pAccDoc = 
+						static_cast<ScAccessibleDocument*>(getAccessibleParent().get());
+					if(pAccDoc)
+					{
+						pAccDoc->CommitChange(aEvent);
+					}
+				}
+				sal_Bool bNewPosCell = (aNewCell != maActiveCell);
+				sal_Bool bNewPosCellFocus=sal_False;
+				if ( bNewPosCell && IsFocused() && aNewCell.Tab() == maActiveCell.Tab() )
+				{//single Focus
+					bNewPosCellFocus=sal_True;
+				}
+				ScMarkData &refScMarkData = pViewData->GetMarkData();
+				// MT IA2: Not used
+				// int nSelCount = refScMarkData.GetSelectCount();
+				sal_Bool bIsMark =refScMarkData.IsMarked();
+				sal_Bool bIsMultMark = refScMarkData.IsMultiMarked();
+				sal_Bool bNewMarked = refScMarkData.GetTableSelect(aNewCell.Tab()) && ( bIsMark || bIsMultMark );				
+//				sal_Bool bNewCellSelected = isAccessibleSelected(aNewCell.Row(), aNewCell.Col());
+				sal_uInt16 nTab = pViewData->GetTabNo();
+				ScRange aMarkRange;
+				refScMarkData.GetMarkArea(aMarkRange);
+				aEvent.OldValue <<= ::com::sun::star::uno::Any();
+				//Mark All
+				if ( !bNewPosCellFocus && 
+					(bNewMarked || bIsMark || bIsMultMark ) &&
+					aMarkRange == ScRange( 0,0,nTab, MAXCOL,MAXROW,nTab ) )
+				{
+					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+					aEvent.NewValue <<= ::com::sun::star::uno::Any();
 					CommitChange(aEvent);
-                }
+					return ;
+				}					
+				if (!mpMarkedRanges)
+				{
+					mpMarkedRanges = new ScRangeList();
+				}				
+				refScMarkData.FillRangeListWithMarks(mpMarkedRanges, sal_True);
+	
+				//For Whole Col Row  
+				sal_Bool bWholeRow = ::labs(aMarkRange.aStart.Row() - aMarkRange.aEnd.Row()) == MAXROW ;
+				sal_Bool bWholeCol = ::abs(aMarkRange.aStart.Col() - aMarkRange.aEnd.Col()) == MAXCOL ;
+				if ((bNewMarked || bIsMark || bIsMultMark ) && (bWholeCol || bWholeRow))
+				{
+					if ( aMarkRange != m_aLastWithInMarkRange )
+					{
+						RemoveSelection(refScMarkData);						
+						if(bNewPosCell)
+						{
+							CommitFocusCell(aNewCell);
+						}
+						sal_Bool bLastIsWholeColRow = 
+						::labs(m_aLastWithInMarkRange.aStart.Row() - m_aLastWithInMarkRange.aEnd.Row()) == MAXROW && bWholeRow || 
+						::abs(m_aLastWithInMarkRange.aStart.Col() - m_aLastWithInMarkRange.aEnd.Col()) == MAXCOL && bWholeCol ;
+						sal_Bool bSelSmaller= 
+							bLastIsWholeColRow && 
+							!aMarkRange.In(m_aLastWithInMarkRange) && 
+							aMarkRange.Intersects(m_aLastWithInMarkRange);
+						if( !bSelSmaller )
+						{
+							aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+							aEvent.NewValue <<= ::com::sun::star::uno::Any();
+							CommitChange(aEvent);
+						}
+						m_aLastWithInMarkRange = aMarkRange;
+					}
+					return ;
+				}
+				m_aLastWithInMarkRange = aMarkRange;
+				int nNewMarkCount = mpMarkedRanges->GetCellCount();
+				sal_Bool bSendSingle= (0 == nNewMarkCount) && bNewPosCell;
+				if (bSendSingle)
+				{
+					RemoveSelection(refScMarkData);
+					if(bNewPosCellFocus)
+					{
+						CommitFocusCell(aNewCell);
+					}
+					uno::Reference< XAccessible > xChild ;
+					if (bNewPosCellFocus)
+					{
+						xChild = mpAccCell;
+					}
+					else
+					{
+						xChild = getAccessibleCellAt(aNewCell.Row(),aNewCell.Col());
+						
+						maActiveCell = aNewCell;
+						aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;							
+						aEvent.NewValue <<= xChild;
+						aEvent.OldValue <<= uno::Reference< XAccessible >();
+						CommitChange(aEvent);
+					}
+					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+					aEvent.NewValue <<= xChild;
+					CommitChange(aEvent);
+					OSL_ASSERT(m_mapSelectionSend.count(aNewCell) == 0 );
+					m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(aNewCell,xChild));
+					
+				}
+				else
+				{
+					ScRange aDelRange;
+					sal_Bool bIsDel = pViewData->GetDelMark( aDelRange );
+					if ( (!bIsDel || (bIsDel && aMarkRange != aDelRange)) && 
+						bNewMarked && 
+						nNewMarkCount > 0 && 
+						!IsSameMarkCell() )
+					{
+						RemoveSelection(refScMarkData);						
+						if(bNewPosCellFocus)
+						{
+							CommitFocusCell(aNewCell);
+						}
+						VEC_MYADDR vecNew;
+                        if(CalcScRangeListDifferenceMax(mpMarkedRanges,&m_LastMarkedRanges,10,vecNew))
+						{
+							aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+							aEvent.NewValue <<= ::com::sun::star::uno::Any();
+							CommitChange(aEvent);
+						}
+						else
+						{
+							VEC_MYADDR::iterator viAddr = vecNew.begin(); 
+							for(; viAddr < vecNew.end() ; ++viAddr )
+							{
+								uno::Reference< XAccessible > xChild = getAccessibleCellAt(viAddr->Row(),viAddr->Col());
+								if (!(bNewPosCellFocus && *viAddr == aNewCell) )
+								{
+									aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;							
+									aEvent.NewValue <<= xChild;							
+									CommitChange(aEvent);
+								}
+								aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+								aEvent.NewValue <<= xChild;
+								CommitChange(aEvent);
+								m_mapSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild));
+							}
+						}	
+					}
+				}
+				if (bNewPosCellFocus && maActiveCell != aNewCell)
+				{
+					CommitFocusCell(aNewCell);
+				}
+                m_LastMarkedRanges = *mpMarkedRanges;		
 			}
 		}
 		else if ((rRef.GetId() == SC_HINT_DATACHANGED))
@@ -270,7 +715,41 @@
 				CommitTableModelChange(maRange.aStart.Row(), maRange.aStart.Col(), maRange.aEnd.Row(), maRange.aEnd.Col(), AccessibleTableModelChangeType::UPDATE);
 			else
 				mbDelIns = sal_False;
-		}
+            ScViewData *pViewData = mpViewShell->GetViewData();
+            ScAddress aNewCell = pViewData->GetCurPos();
+            if( maActiveCell == aNewCell)
+            {
+                ScDocument* pScDoc= GetDocument(mpViewShell);
+                if (pScDoc)
+                {
+                    String valStr;
+                    pScDoc->GetString(aNewCell.Col(),aNewCell.Row(),aNewCell.Tab(), valStr);
+                    if(m_strCurCellValue != valStr)
+                    {
+                        AccessibleEventObject aEvent;
+                        aEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+                        mpAccCell->CommitChange(aEvent);
+                        m_strCurCellValue=valStr;
+                    }
+					String tabName;
+					pScDoc->GetName( maActiveCell.Tab(), tabName );
+					if( m_strOldTabName != tabName )
+					{
+						AccessibleEventObject aEvent;
+                        aEvent.EventId = AccessibleEventId::NAME_CHANGED;
+						String sOldName(ScResId(STR_ACC_TABLE_NAME));
+						sOldName.SearchAndReplaceAscii("%1", m_strOldTabName);
+						aEvent.OldValue <<= ::rtl::OUString( sOldName );
+						String sNewName(ScResId(STR_ACC_TABLE_NAME));
+						sNewName.SearchAndReplaceAscii("%1", tabName);
+						aEvent.NewValue <<= ::rtl::OUString( sNewName );
+						CommitChange( aEvent );
+						m_strOldTabName = tabName;
+					}
+                }
+            }
+        }
+//-----IAccessibility2 Implementation 2009
         // no longer needed, because the document calls the VisAreaChanged method
 /*		else if (rRef.GetId() == SC_HINT_ACC_VISAREACHANGED)
 		{
@@ -371,7 +850,62 @@
 
 	ScAccessibleTableBase::Notify(rBC, rHint);
 }
-
+//IAccessibility2 Implementation 2009-----
+void ScAccessibleSpreadsheet::RemoveSelection(ScMarkData &refScMarkData)
+{
+	AccessibleEventObject aEvent;
+	aEvent.Source = uno::Reference< XAccessible >(this);
+	aEvent.OldValue <<= ::com::sun::star::uno::Any();
+	MAP_ADDR_XACC::iterator miRemove = m_mapSelectionSend.begin();
+	for(;  miRemove != m_mapSelectionSend.end() ;)
+	{
+		if (refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),sal_True) ||
+			refScMarkData.IsCellMarked(miRemove->first.Col(),miRemove->first.Row(),sal_False) )
+		{
+			++miRemove;
+			continue;
+		}
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+		aEvent.NewValue <<= miRemove->second;							
+		CommitChange(aEvent);
+		MAP_ADDR_XACC::iterator miNext = miRemove;
+		++miNext;
+		m_mapSelectionSend.erase(miRemove);
+		miRemove = miNext;
+	}
+}
+void ScAccessibleSpreadsheet::CommitFocusCell(const ScAddress &aNewCell)
+{
+	OSL_ASSERT(!IsFormulaMode());
+	if(IsFormulaMode())
+	{
+		return ;
+	}
+	AccessibleEventObject aEvent;
+	aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
+	aEvent.Source = uno::Reference< XAccessible >(this);
+	uno::Reference< XAccessible > xOld = mpAccCell;
+	mpAccCell->release();
+	mpAccCell=NULL;
+	aEvent.OldValue <<= xOld;
+	mpAccCell = GetAccessibleCellAt(aNewCell.Row(), aNewCell.Col());
+	mpAccCell->acquire();
+	mpAccCell->Init();
+	uno::Reference< XAccessible > xNew = mpAccCell;
+	aEvent.NewValue <<= xNew;
+	maActiveCell = aNewCell;
+    ScDocument* pScDoc= GetDocument(mpViewShell);
+    if (pScDoc)
+    {
+        pScDoc->GetString(maActiveCell.Col(),maActiveCell.Row(),maActiveCell.Tab(), m_strCurCellValue);
+    }
+	CommitChange(aEvent);
+}
+sal_Bool ScAccessibleSpreadsheet::IsSameMarkCell()
+{
+    return m_LastMarkedRanges == *mpMarkedRanges;
+}
+//-----IAccessibility2 Implementation 2009
 	//=====  XAccessibleTable  ================================================
 
 uno::Reference< XAccessibleTable > SAL_CALL ScAccessibleSpreadsheet::getAccessibleRowHeaders(  )
@@ -418,6 +952,12 @@
 	ScUnoGuard aGuard;
     IsObjectValid();
 	uno::Sequence<sal_Int32> aSequence;
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return aSequence;
+	}
+//-----IAccessibility2 Implementation 2009
 	if (mpViewShell && mpViewShell->GetViewData())
 	{
 		aSequence.realloc(maRange.aEnd.Row() - maRange.aStart.Row() + 1);
@@ -445,6 +985,12 @@
 	ScUnoGuard aGuard;
     IsObjectValid();
 	uno::Sequence<sal_Int32> aSequence;
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return aSequence;
+	}
+//-----IAccessibility2 Implementation 2009
 	if (mpViewShell && mpViewShell->GetViewData())
 	{
 		aSequence.realloc(maRange.aEnd.Col() - maRange.aStart.Col() + 1);
@@ -471,6 +1017,12 @@
 {
 	ScUnoGuard aGuard;
     IsObjectValid();
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
 
     if ((nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
         throw lang::IndexOutOfBoundsException();
@@ -490,6 +1042,12 @@
 	ScUnoGuard aGuard;
     IsObjectValid();
 
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
     if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0))
         throw lang::IndexOutOfBoundsException();
 
@@ -505,6 +1063,20 @@
 ScAccessibleCell* ScAccessibleSpreadsheet::GetAccessibleCellAt(sal_Int32 nRow, sal_Int32 nColumn)
 {
     ScAccessibleCell* pAccessibleCell = NULL;
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		ScAddress aCellAddress(static_cast<SCCOL>(nColumn), nRow, mpViewShell->GetViewData()->GetTabNo());
+		if ((aCellAddress == m_aFormulaActiveCell) && m_pAccFormulaCell)
+		{
+			pAccessibleCell = m_pAccFormulaCell;
+		}
+		else
+			pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, GetAccessibleIndexFormula(nRow, nColumn), meSplitPos, mpAccDoc);
+	}
+	else
+	{
+//-----IAccessibility2 Implementation 2009
 	ScAddress aCellAddress(static_cast<SCCOL>(maRange.aStart.Col() + nColumn),
 		static_cast<SCROW>(maRange.aStart.Row() + nRow), maRange.aStart.Tab());
     if ((aCellAddress == maActiveCell) && mpAccCell)
@@ -513,6 +1085,7 @@
     }
     else
 	    pAccessibleCell = new ScAccessibleCell(this, mpViewShell, aCellAddress, getAccessibleIndex(nRow, nColumn), meSplitPos, mpAccDoc);
+	}
 
     return pAccessibleCell;
 }
@@ -522,12 +1095,16 @@
 {
 	ScUnoGuard aGuard;
     IsObjectValid();
+//IAccessibility2 Implementation 2009-----
+	if (!IsFormulaMode())
+	{
     if (nRow > (maRange.aEnd.Row() - maRange.aStart.Row()) ||
         nRow < 0 ||
         nColumn > (maRange.aEnd.Col() - maRange.aStart.Col()) ||
         nColumn < 0)
         throw lang::IndexOutOfBoundsException();
-
+	}
+//-----IAccessibility2 Implementation 2009
     uno::Reference<XAccessible> xAccessible;
     ScAccessibleCell* pAccessibleCell = GetAccessibleCellAt(nRow, nColumn);
     xAccessible = pAccessibleCell;
@@ -541,6 +1118,13 @@
 	ScUnoGuard aGuard;
     IsObjectValid();
 
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		ScAddress addr(static_cast<SCCOL>(nColumn), nRow, 0);
+		return IsScAddrFormulaSel(addr);
+	}
+//-----IAccessibility2 Implementation 2009
     if ((nColumn > (maRange.aEnd.Col() - maRange.aStart.Col())) || (nColumn < 0) ||
         (nRow > (maRange.aEnd.Row() - maRange.aStart.Row())) || (nRow < 0))
         throw lang::IndexOutOfBoundsException();
@@ -570,7 +1154,15 @@
 		    SCsCOL nX;
             SCsROW nY;
 		    mpViewShell->GetViewData()->GetPosFromPixel( rPoint.X, rPoint.Y, meSplitPos, nX, nY);
+//IAccessibility2 Implementation 2009-----
+			try{
 		    xAccessible = getAccessibleCellAt(nY, nX);
+			}
+			catch( ::com::sun::star::lang::IndexOutOfBoundsException e)
+			{
+				return NULL;
+			}
+//-----IAccessibility2 Implementation 2009
 	    }
     }
 	return xAccessible;
@@ -678,6 +1270,9 @@
     IsObjectValid();
 	if (mpViewShell)
 	{
+//IAccessibility2 Implementation 2009-----
+		if (!IsFormulaMode())
+//-----IAccessibility2 Implementation 2009
 		mpViewShell->Unmark();
 	}
 }
@@ -690,6 +1285,17 @@
     IsObjectValid();
 	if (mpViewShell)
 	{
+//IAccessibility2 Implementation 2009-----
+		if (IsFormulaMode())
+		{
+			ScViewData *pViewData = mpViewShell->GetViewData();		
+			mpViewShell->InitRefMode( 0, 0, pViewData->GetTabNo(), SC_REFTYPE_REF );
+			pViewData->SetRefStart(0,0,pViewData->GetTabNo());
+			pViewData->SetRefStart(MAXCOL,MAXROW,pViewData->GetTabNo());
+			mpViewShell->UpdateRef(MAXCOL, MAXROW, pViewData->GetTabNo());
+		}
+		else
+//-----IAccessibility2 Implementation 2009
 		mpViewShell->SelectAll();
 	}
 }
@@ -703,16 +1309,27 @@
 	sal_Int32 nResult(0);
 	if (mpViewShell)
 	{
+//IAccessibility2 Implementation 2009-----
+		if (IsFormulaMode())
+		{
+			nResult =  GetRowAll() * GetColAll() ;
+		}
+		else
+		{		
+//-----IAccessibility2 Implementation 2009
 		if (!mpMarkedRanges)
 		{
 			mpMarkedRanges = new ScRangeList();
             ScMarkData aMarkData(mpViewShell->GetViewData()->GetMarkData());
-            aMarkData.MarkToMulti();
+//IAccessibility2 Implementation 2009-----
+            //aMarkData.MarkToMulti();
+//-----IAccessibility2 Implementation 2009
 			aMarkData.FillRangeListWithMarks(mpMarkedRanges, sal_False);
 		}
 		// is possible, because there shouldn't be overlapped ranges in it
 		if (mpMarkedRanges)
 			nResult = mpMarkedRanges->GetCellCount();
+		}
 	}
 	return nResult;
 }
@@ -724,6 +1341,17 @@
 	ScUnoGuard aGuard;
     IsObjectValid();
 	uno::Reference < XAccessible > xAccessible;
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		if(CheckChildIndex(nSelectedChildIndex))
+		{
+			ScAddress addr = GetChildIndexAddress(nSelectedChildIndex);
+			xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
+		}
+		return xAccessible;
+	}
+//-----IAccessibility2 Implementation 2009
 	if (mpViewShell)
 	{
 		if (!mpMarkedRanges)
@@ -733,16 +1361,27 @@
 		}
 		if (mpMarkedRanges)
 		{
-			if (!mpSortedMarkedCells)
-				CreateSortedMarkedCells();
-			if (mpSortedMarkedCells)
+//IAccessibility2 Implementation 2009-----
+			//if (!mpSortedMarkedCells)
+			//	CreateSortedMarkedCells();
+			//if (mpSortedMarkedCells)
+			//{
+			//	if ((nSelectedChildIndex < 0) ||
+			//		(mpSortedMarkedCells->size() <= static_cast<sal_uInt32>(nSelectedChildIndex)))
+			//		throw lang::IndexOutOfBoundsException();
+			//	else
+			//		xAccessible = getAccessibleCellAt((*mpSortedMarkedCells)[nSelectedChildIndex].Row(), (*mpSortedMarkedCells)[nSelectedChildIndex].Col());
+			if ((nSelectedChildIndex < 0) ||
+					(mpMarkedRanges->GetCellCount() <= static_cast<sal_uInt32>(nSelectedChildIndex)))
 			{
-				if ((nSelectedChildIndex < 0) ||
-					(mpSortedMarkedCells->size() <= static_cast<sal_uInt32>(nSelectedChildIndex)))
-					throw lang::IndexOutOfBoundsException();
-				else
-					xAccessible = getAccessibleCellAt((*mpSortedMarkedCells)[nSelectedChildIndex].Row(), (*mpSortedMarkedCells)[nSelectedChildIndex].Col());
+				throw lang::IndexOutOfBoundsException();
 			}
+			ScMyAddress addr = CalcScAddressFromRangeList(mpMarkedRanges,nSelectedChildIndex);
+			if( m_mapSelectionSend.find(addr) != m_mapSelectionSend.end() )
+				xAccessible = m_mapSelectionSend[addr];
+			else			
+				xAccessible = getAccessibleCellAt(addr.Row(), addr.Col());
+//-----IAccessibility2 Implementation 2009
 		}
 	}
 	return xAccessible;
@@ -763,6 +1402,18 @@
 		sal_Int32 nCol(getAccessibleColumn(nChildIndex));
 		sal_Int32 nRow(getAccessibleRow(nChildIndex));
 
+//IAccessibility2 Implementation 2009-----
+		if (IsFormulaMode())
+		{
+			if(IsScAddrFormulaSel(
+				ScAddress(static_cast<SCCOL>(nCol), nRow,mpViewShell->GetViewData()->GetTabNo()))
+				)
+			{
+				SelectCell(nRow, nCol, sal_True);
+			}
+			return ;
+		}
+//-----IAccessibility2 Implementation 2009
 		if (mpViewShell->GetViewData()->GetMarkData().IsCellMarked(static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow)))
 			SelectCell(nRow, nCol, sal_True);
 	}
@@ -770,6 +1421,23 @@
 
 void ScAccessibleSpreadsheet::SelectCell(sal_Int32 nRow, sal_Int32 nCol, sal_Bool bDeselect)
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		if (bDeselect)
+		{//??
+			return ;
+		}
+		else
+		{
+			ScViewData *pViewData = mpViewShell->GetViewData();
+
+			mpViewShell->InitRefMode( static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo(), SC_REFTYPE_REF );
+			mpViewShell->UpdateRef(static_cast<SCCOL>(nCol), nRow, pViewData->GetTabNo());
+		}
+		return ;
+	}
+//-----IAccessibility2 Implementation 2009
 	mpViewShell->SetTabNo( maRange.aStart.Tab() );
 
 	mpViewShell->DoneBlockMode( sal_True ); // continue selecting
@@ -777,41 +1445,41 @@
 
 	mpViewShell->SelectionChanged();
 }
+//IAccessibility2 Implementation 2009-----
+//void ScAccessibleSpreadsheet::CreateSortedMarkedCells()
+//{
+//	mpSortedMarkedCells = new std::vector<ScMyAddress>();
+//	mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount());
+//	ScRange* pRange = mpMarkedRanges->First();
+//	while (pRange)
+//	{
+//		if (pRange->aStart.Tab() != pRange->aEnd.Tab())
+//		{
+//			if ((maActiveCell.Tab() >= pRange->aStart.Tab()) ||
+//				maActiveCell.Tab() <= pRange->aEnd.Tab())
+//			{
+//				ScRange aRange(*pRange);
+//				aRange.aStart.SetTab(maActiveCell.Tab());
+//				aRange.aEnd.SetTab(maActiveCell.Tab());
+//				AddMarkedRange(aRange);
+//			}
+//			else
+//			{
+//				DBG_ERROR("Range of wrong table");
+//			}
+//		}
+//		else if(pRange->aStart.Tab() == maActiveCell.Tab())
+//			AddMarkedRange(*pRange);
+//		else
+//		{
+//			DBG_ERROR("Range of wrong table");
+//		}
+//		pRange = mpMarkedRanges->Next();
+//	}
+//	std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end());
+//}
 
-void ScAccessibleSpreadsheet::CreateSortedMarkedCells()
-{
-	mpSortedMarkedCells = new std::vector<ScMyAddress>();
-	mpSortedMarkedCells->reserve(mpMarkedRanges->GetCellCount());
-	ScRange* pRange = mpMarkedRanges->First();
-	while (pRange)
-	{
-		if (pRange->aStart.Tab() != pRange->aEnd.Tab())
-		{
-			if ((maActiveCell.Tab() >= pRange->aStart.Tab()) ||
-				maActiveCell.Tab() <= pRange->aEnd.Tab())
-			{
-				ScRange aRange(*pRange);
-				aRange.aStart.SetTab(maActiveCell.Tab());
-				aRange.aEnd.SetTab(maActiveCell.Tab());
-				AddMarkedRange(aRange);
-			}
-			else
-			{
-				DBG_ERROR("Range of wrong table");
-			}
-		}
-		else if(pRange->aStart.Tab() == maActiveCell.Tab())
-			AddMarkedRange(*pRange);
-		else
-		{
-			DBG_ERROR("Range of wrong table");
-		}
-		pRange = mpMarkedRanges->Next();
-	}
-	std::sort(mpSortedMarkedCells->begin(), mpSortedMarkedCells->end());
-}
-
-void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange)
+/*void ScAccessibleSpreadsheet::AddMarkedRange(const ScRange& rRange)
 {
 	for (SCROW nRow = rRange.aStart.Row(); nRow <= rRange.aEnd.Row(); ++nRow)
 	{
@@ -821,7 +1489,8 @@
 			mpSortedMarkedCells->push_back(aCell);
 		}
 	}
-}
+}*/
+//-----IAccessibility2 Implementation 2009
 
 	//=====  XServiceInfo  ====================================================
 
@@ -871,7 +1540,8 @@
     IsObjectValid();
     ScAccessibleTableBase::addEventListener(xListener);
 
-    if (!mbIsFocusSend)
+//IAccessibility2 Implementation 2009-----
+/*    if (!mbIsFocusSend)
     {
         mbIsFocusSend = sal_True;
         CommitFocusGained();
@@ -883,6 +1553,8 @@
 
 		CommitChange(aEvent);
     }
+*/
+//-----IAccessibility2 Implementation 2009
 }
 
 	//====  internal  =========================================================
@@ -924,6 +1596,12 @@
 sal_Bool ScAccessibleSpreadsheet::IsEditable(
     const uno::Reference<XAccessibleStateSet>& /* rxParentStates */)
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
 	sal_Bool bProtected(sal_False);
 	if (mpDoc && mpDoc->IsTabProtected(maRange.aStart.Tab()))
 		bProtected = sal_True;
@@ -943,6 +1621,12 @@
 
 sal_Bool ScAccessibleSpreadsheet::IsCompleteSheetSelected()
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
 	sal_Bool bResult(sal_False);
 	if(mpViewShell)
 	{
@@ -993,3 +1677,277 @@
 	else
 		return Rectangle();
 }
+//IAccessibility2 Implementation 2009-----
+sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectRow( sal_Int32 row ) 
+throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 
+{
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+
+	mpViewShell->SetTabNo( maRange.aStart.Tab() );
+	mpViewShell->DoneBlockMode( sal_True ); // continue selecting
+	mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), sal_False, sal_False, sal_True );
+	mpViewShell->MarkCursor( MAXCOL, row, maRange.aStart.Tab(), sal_False, sal_True );
+	mpViewShell->SelectionChanged();
+	return sal_True;
+}
+
+sal_Bool SAL_CALL ScAccessibleSpreadsheet::selectColumn( sal_Int32 column ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+
+	mpViewShell->SetTabNo( maRange.aStart.Tab() );
+	mpViewShell->DoneBlockMode( sal_True ); // continue selecting
+	mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), sal_False, sal_True, sal_False );
+	mpViewShell->MarkCursor( static_cast<SCCOL>(column), MAXROW, maRange.aStart.Tab(), sal_True, sal_False );	
+    mpViewShell->SelectionChanged();
+	return sal_True;
+}
+
+sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectRow( sal_Int32 row ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{	
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+
+	mpViewShell->SetTabNo( maRange.aStart.Tab() );
+	mpViewShell->DoneBlockMode( sal_True ); // continue selecting
+	mpViewShell->InitBlockMode( 0, row, maRange.aStart.Tab(), sal_False, sal_False, sal_True, sal_True );
+	mpViewShell->MarkCursor( MAXCOL, row, maRange.aStart.Tab(), sal_False, sal_True );	
+	mpViewShell->SelectionChanged();
+	mpViewShell->DoneBlockMode( sal_True );
+	return sal_True;
+}
+
+sal_Bool SAL_CALL ScAccessibleSpreadsheet::unselectColumn( sal_Int32 column ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{	
+	if (IsFormulaMode())
+	{
+		return sal_False;
+	}
+
+	mpViewShell->SetTabNo( maRange.aStart.Tab() );
+	mpViewShell->DoneBlockMode( sal_True ); // continue selecting
+	mpViewShell->InitBlockMode( static_cast<SCCOL>(column), 0, maRange.aStart.Tab(), sal_False, sal_True, sal_False, sal_True );
+	mpViewShell->MarkCursor( static_cast<SCCOL>(column), MAXROW, maRange.aStart.Tab(), sal_True, sal_False );	
+	mpViewShell->SelectionChanged();		
+	mpViewShell->DoneBlockMode( sal_True );
+	return sal_True;
+}
+
+void ScAccessibleSpreadsheet::FireFirstCellFocus()
+{	
+	if (IsFormulaMode())
+	{
+		return ;
+	}
+	if (mbIsFocusSend)
+	{
+		return ;
+	}
+	mbIsFocusSend = sal_True;
+	AccessibleEventObject aEvent;
+	aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
+	aEvent.Source = uno::Reference< XAccessible >(this);
+	aEvent.NewValue <<= getAccessibleCellAt(maActiveCell.Row(), maActiveCell.Col());
+	CommitChange(aEvent);
+}
+void ScAccessibleSpreadsheet::NotifyRefMode()
+{
+	ScViewData *pViewData = mpViewShell->GetViewData();
+	sal_uInt16 nRefStartX =pViewData->GetRefStartX();
+	sal_Int32 nRefStartY=pViewData->GetRefStartY();
+	sal_uInt16 nRefEndX=pViewData->GetRefEndX(); 
+	sal_Int32 nRefEndY=pViewData->GetRefEndY(); 
+	ScAddress aFormulaAddr;
+	if(!GetFormulaCurrentFocusCell(aFormulaAddr))
+	{
+		return ;
+	}
+	if (m_aFormulaActiveCell != aFormulaAddr)
+	{//New Focus
+		m_nMinX =std::min(nRefStartX,nRefEndX);
+		m_nMaxX =std::max(nRefStartX,nRefEndX);
+		m_nMinY = std::min(nRefStartY,nRefEndY);
+		m_nMaxY = std::max(nRefStartY,nRefEndY);
+		RemoveFormulaSelection();
+		AccessibleEventObject aEvent;
+		aEvent.Source = uno::Reference< XAccessible >(this);
+		aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED;
+		aEvent.Source = uno::Reference< XAccessible >(this);
+		uno::Reference< XAccessible > xOld = m_pAccFormulaCell;
+		aEvent.OldValue <<= xOld;
+		m_pAccFormulaCell = GetAccessibleCellAt(aFormulaAddr.Row(), aFormulaAddr.Col());
+        m_pAccFormulaCell->acquire();
+        m_pAccFormulaCell->Init();
+		uno::Reference< XAccessible > xNew = m_pAccFormulaCell;
+		aEvent.NewValue <<= xNew;	
+		CommitChange(aEvent);
+		if (nRefStartX == nRefEndX && nRefStartY == nRefEndY)
+		{//Selection Single
+			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+			aEvent.NewValue <<= xNew;
+			CommitChange(aEvent);
+			m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(aFormulaAddr,xNew));
+			m_vecFormulaLastMyAddr.clear();
+			m_vecFormulaLastMyAddr.push_back(aFormulaAddr);
+		}
+		else
+		{
+			VEC_MYADDR vecCurSel;
+			int nCurSize =  (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) ;
+			vecCurSel.reserve(nCurSize);
+			for (sal_uInt16 x = m_nMinX ; x <= m_nMaxX ; ++x)
+			{
+				for (sal_Int32 y = m_nMinY ; y <= m_nMaxY ; ++y)
+				{
+					ScMyAddress aAddr(x,y,0);
+					vecCurSel.push_back(aAddr);
+				}
+			}
+			std::sort(vecCurSel.begin(), vecCurSel.end());
+			VEC_MYADDR vecNew;							
+			std::set_difference(vecCurSel.begin(),vecCurSel.end(),
+				m_vecFormulaLastMyAddr.begin(),m_vecFormulaLastMyAddr.end(),						
+				std::back_insert_iterator<VEC_MYADDR>(vecNew));
+			int nNewSize = vecNew.size();
+			if ( nNewSize > 10 )
+			{
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+				aEvent.NewValue <<= ::com::sun::star::uno::Any();
+				CommitChange(aEvent);
+			}
+			else
+			{
+				VEC_MYADDR::iterator viAddr = vecNew.begin(); 
+				for(; viAddr != vecNew.end() ; ++viAddr )
+				{
+					uno::Reference< XAccessible > xChild;
+					if (*viAddr == aFormulaAddr)
+					{
+						xChild = m_pAccFormulaCell;
+					}
+					else
+					{
+						xChild = getAccessibleCellAt(viAddr->Row(),viAddr->Col());
+						aEvent.EventId = AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS;							
+						aEvent.NewValue <<= xChild;							
+						CommitChange(aEvent);
+					}					
+					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+					aEvent.NewValue <<= xChild;
+					CommitChange(aEvent);
+					m_mapFormulaSelectionSend.insert(MAP_ADDR_XACC::value_type(*viAddr,xChild));
+				}
+			}						
+			m_vecFormulaLastMyAddr.swap(vecCurSel);					
+		}
+	}
+	m_aFormulaActiveCell = aFormulaAddr;
+}
+void ScAccessibleSpreadsheet::RemoveFormulaSelection(sal_Bool bRemoveAll )
+{
+	AccessibleEventObject aEvent;
+	aEvent.Source = uno::Reference< XAccessible >(this);
+	aEvent.OldValue <<= ::com::sun::star::uno::Any();
+	MAP_ADDR_XACC::iterator miRemove = m_mapFormulaSelectionSend.begin();
+	for(;  miRemove != m_mapFormulaSelectionSend.end() ;)
+	{
+		if( !bRemoveAll && IsScAddrFormulaSel(miRemove->first) )
+		{
+			++miRemove;
+			continue;
+		}
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+		aEvent.NewValue <<= miRemove->second;							
+		CommitChange(aEvent);
+		MAP_ADDR_XACC::iterator miNext = miRemove;
+		++miNext;
+		m_mapFormulaSelectionSend.erase(miRemove);
+		miRemove = miNext;
+	}	
+}
+sal_Bool ScAccessibleSpreadsheet::IsScAddrFormulaSel(const ScAddress &addr) const
+{
+	if( addr.Col() >= m_nMinX && addr.Col() <= m_nMaxX &&
+		addr.Row() >= m_nMinY && addr.Row() <= m_nMaxY &&
+		addr.Tab() == mpViewShell->GetViewData()->GetTabNo() )
+	{
+		return sal_True;
+	}
+	return sal_False;
+}
+sal_Bool ScAccessibleSpreadsheet::CheckChildIndex(sal_Int32 nIndex) const
+{
+	sal_Int32 nMaxIndex = (m_nMaxX - m_nMinX +1)*(m_nMaxY - m_nMinY +1) -1 ;
+	return nIndex <= nMaxIndex && nIndex >= 0 ;
+}
+ScAddress ScAccessibleSpreadsheet::GetChildIndexAddress(sal_Int32 nIndex) const
+{
+	sal_Int32 nRowAll = GetRowAll();
+	sal_uInt16  nColAll = GetColAll();
+	if (nIndex < 0 || nIndex >=  nRowAll * nColAll )
+	{
+		return ScAddress();
+	}
+	return ScAddress(		
+		static_cast<SCCOL>((nIndex - nIndex % nRowAll) / nRowAll +  + m_nMinX),
+		nIndex % nRowAll + m_nMinY, 
+		mpViewShell->GetViewData()->GetTabNo()
+		);
+}
+sal_Int32 ScAccessibleSpreadsheet::GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn )
+{
+	sal_uInt16 nColRelative = sal_uInt16(nColumn) - GetColAll();
+	sal_Int32 nRowRelative = nRow - GetRowAll();
+	if (nRow < 0 || nColumn < 0  || nRowRelative >= GetRowAll() || nColRelative >= GetColAll() )
+	{
+		return -1;
+	}
+	return GetRowAll() * nRowRelative + nColRelative;
+}
+sal_Bool ScAccessibleSpreadsheet::IsFormulaMode() 
+{ 
+	ScViewData *pViewData = mpViewShell->GetViewData();
+	m_bFormulaMode = pViewData->IsRefMode() || SC_MOD()->IsFormulaMode();
+	return m_bFormulaMode ;
+}
+sal_Bool ScAccessibleSpreadsheet::GetFormulaCurrentFocusCell(ScAddress &addr)
+{
+	ScViewData *pViewData = mpViewShell->GetViewData();
+	sal_uInt16 nRefX=0;
+	sal_Int32 nRefY=0;
+	if(m_bFormulaLastMode)
+	{
+		nRefX=pViewData->GetRefEndX(); 
+		nRefY=pViewData->GetRefEndY(); 
+	}
+	else
+	{
+		nRefX=pViewData->GetRefStartX(); 
+		nRefY=pViewData->GetRefStartY(); 
+	}
+	if( /* Always true: nRefX >= 0 && */ nRefX <= MAXCOL && nRefY >= 0 && nRefY <= MAXROW)
+	{
+		addr = ScAddress(nRefX,nRefY,pViewData->GetTabNo());
+		return sal_True;
+	}
+	return sal_False;
+}
+uno::Reference < XAccessible > ScAccessibleSpreadsheet::GetActiveCell()
+{
+	if( m_mapSelectionSend.find( maActiveCell ) != m_mapSelectionSend.end() )
+			return m_mapSelectionSend[maActiveCell];
+		else
+			return getAccessibleCellAt(maActiveCell.Row(), maActiveCell .Col());
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/main/sc/source/ui/Accessibility/AccessibleTableBase.cxx
index 1462962..cd1bea7 100644
--- a/main/sc/source/ui/Accessibility/AccessibleTableBase.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleTableBase.cxx
@@ -77,8 +77,23 @@
 uno::Any SAL_CALL ScAccessibleTableBase::queryInterface( uno::Type const & rType )
 	throw (uno::RuntimeException)
 {
-	uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType));
-	return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
+//IAccessibility2 Implementation 2009-----
+	//uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType));
+	//return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
+	uno::Any aRet;
+	if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) )
+    {
+		uno::Reference<XAccessibleTableSelection> xThis( this );
+       	aRet <<= xThis;
+		return aRet;
+    }
+	else
+	{
+		uno::Any aAny (ScAccessibleTableBaseImpl::queryInterface(rType));
+		return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
+	}
+	return aRet;
+//-----IAccessibility2 Implementation 2009
 }
 
 void SAL_CALL ScAccessibleTableBase::acquire()
@@ -153,12 +168,18 @@
 	{
 		SCROW nEndRow(0);
         SCCOL nEndCol(0);
-		if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
-			nEndCol, nEndRow, maRange.aStart.Tab()))
-        {
-		    if (nEndRow > nRow)
-			    nCount = nEndRow - nRow + 1;
-        }
+//IAccessibility2 Implementation 2009-----
+		mpDoc->GetTableByIndex(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
+			ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False, sal_False );
+		if (nEndRow > nRow)
+			   nCount = nEndRow - nRow + 1;
+	//	if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
+	//		nEndCol, nEndRow, maRange.aStart.Tab()))
+        //{
+	//	    if (nEndRow > nRow)
+	//		    nCount = nEndRow - nRow + 1;
+        //}
+//-----IAccessibility2 Implementation 2009
 	}
 
 	return nCount;
@@ -182,12 +203,18 @@
 	{
 		SCROW nEndRow(0);
         SCCOL nEndCol(0);
-		if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
-			nEndCol, nEndRow, maRange.aStart.Tab()))
-        {
-		    if (nEndCol > nColumn)
+//IAccessibility2 Implementation 2009-----
+		mpDoc->GetTableByIndex(maRange.aStart.Tab())->GetColumnByIndex(nColumn)->
+			ExtendMerge( static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow), nRow, nEndCol, nEndRow, sal_False, sal_False );
+		if (nEndCol > nColumn)
 			    nCount = nEndCol - nColumn + 1;
-        }
+	//	if (mpDoc->ExtendMerge(static_cast<SCCOL>(nColumn), static_cast<SCROW>(nRow),
+	//		nEndCol, nEndRow, maRange.aStart.Tab()))
+        //{
+	//	    if (nEndCol > nColumn)
+	//		    nCount = nEndCol - nColumn + 1;
+        //}
+//-----IAccessibility2 Implementation 2009
 	}
 
 	return nCount;
@@ -489,3 +516,27 @@
 
 	CommitChange(aEvent);
 }
+//IAccessibility2 Implementation 2009-----
+sal_Bool SAL_CALL ScAccessibleTableBase::selectRow( sal_Int32 ) 
+throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 
+{
+	return sal_True;
+}
+sal_Bool SAL_CALL ScAccessibleTableBase::selectColumn( sal_Int32 ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	return sal_True;
+}
+sal_Bool SAL_CALL ScAccessibleTableBase::unselectRow( sal_Int32 ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+		return sal_True;
+}
+sal_Bool SAL_CALL ScAccessibleTableBase::unselectColumn( sal_Int32 ) 
+		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	return sal_True;
+}
+//-----IAccessibility2 Implementation 2009
+
+
diff --git a/main/sc/source/ui/Accessibility/AccessibleText.cxx b/main/sc/source/ui/Accessibility/AccessibleText.cxx
index e9014c0..ef59353 100644
--- a/main/sc/source/ui/Accessibility/AccessibleText.cxx
+++ b/main/sc/source/ui/Accessibility/AccessibleText.cxx
@@ -1058,8 +1058,10 @@
 
 
 // ============================================================================
-
-ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin)
+//IAccessibility2 Implementation 2009-----
+//ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin)
+ScAccessibleEditObjectTextData::ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone)
+//-----IAccessibility2 Implementation 2009
 	:
 	mpViewForwarder(NULL),
 	mpEditViewForwarder(NULL),
@@ -1068,13 +1070,22 @@
     mpForwarder(NULL),
     mpWindow(pWin)
 {
-    if (mpEditEngine)
+//IAccessibility2 Implementation 2009-----
+	// Solution: If the object is cloned, do NOT add notify hdl.
+	mbIsCloned = isClone;
+    //if (mpEditEngine)
+    if (mpEditEngine && !mbIsCloned)
+//-----IAccessibility2 Implementation 2009
         mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
 }
 
 ScAccessibleEditObjectTextData::~ScAccessibleEditObjectTextData()
 {
-    if (mpEditEngine)
+//IAccessibility2 Implementation 2009-----
+	// Solution: If the object is cloned, do NOT set notify hdl.
+    //if (mpEditEngine)
+    if (mpEditEngine && !mbIsCloned)
+//-----IAccessibility2 Implementation 2009
         mpEditEngine->SetNotifyHdl(Link());
 	if (mpViewForwarder)
 		delete mpViewForwarder;
@@ -1106,7 +1117,11 @@
 
 ScAccessibleTextData* ScAccessibleEditObjectTextData::Clone() const
 {
-	return new ScAccessibleEditObjectTextData(mpEditView, mpWindow);
+//IAccessibility2 Implementation 2009-----
+	// Solution: Add para to indicate the object is cloned
+	//return new ScAccessibleEditObjectTextData(mpEditView, mpWindow);
+	return new ScAccessibleEditObjectTextData(mpEditView, mpWindow,sal_True);
+//-----IAccessibility2 Implementation 2009
 }
 
 SvxTextForwarder* ScAccessibleEditObjectTextData::GetTextForwarder()
@@ -1115,7 +1130,11 @@
 	{
         if (!mpEditEngine)
             mpEditEngine = mpEditView->GetEditEngine();
-        if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet())
+//IAccessibility2 Implementation 2009-----
+			// Solution: If the object is cloned, do NOT add notify hdl.
+        //if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet())
+	if (mpEditEngine && !mpEditEngine->GetNotifyHdl().IsSet()&&!mbIsCloned)
+//-----IAccessibility2 Implementation 2009
             mpEditEngine->SetNotifyHdl( LINK(this, ScAccessibleEditObjectTextData, NotifyHdl) );
         if(!mpForwarder)
             mpForwarder = new SvxEditEngineForwarder(*mpEditEngine);
diff --git a/main/sc/source/ui/dbgui/dbnamdlg.cxx b/main/sc/source/ui/dbgui/dbnamdlg.cxx
index b89fccf..9b09e54 100644
--- a/main/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/main/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -180,6 +180,11 @@
 						aBtnDoSize, aBtnKeepFmt, aBtnStripData, theCurArea );
 	Init();
 	FreeResource();
+	//IAccessibility2 Implementation 2009-----
+	SynFocusTimer.SetTimeout(150);
+	SynFocusTimer.SetTimeoutHdl(LINK( this, ScDbNameDlg, FocusToComoboxHdl));
+	SynFocusTimer.Start();
+	//-----IAccessibility2 Implementation 2009
 	aRbAssign.SetAccessibleRelationMemberOf(&aFlAssign);
 }
 
@@ -716,8 +721,37 @@
 	String aText = aEdAssign.GetText();
 	if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & SCA_VALID )
 		theCurArea = aTmpRange;
-
+//IAccessibility2 Implementation 2009-----
+    if( aText.Len() > 0 && aEdName.GetText().Len() > 0 )
+    {
+		aBtnAdd.Enable();
+		aBtnHeader.Enable();
+		aBtnDoSize.Enable();
+		aBtnKeepFmt.Enable();
+		aBtnStripData.Enable();
+		aFTSource.Enable();
+		aFTOperations.Enable();
+    }
+    else
+    {
+		aBtnAdd.Disable();
+		aBtnHeader.Disable();
+		aBtnDoSize.Disable();
+		aBtnKeepFmt.Disable();
+		aBtnStripData.Disable();
+		aFTSource.Disable();
+		aFTOperations.Disable();
+    }
+//-----IAccessibility2 Implementation 2009
 	return 0;
 }
 
-
+//IAccessibility2 Implementation 2009-----
+IMPL_LINK( ScDbNameDlg, FocusToComoboxHdl, Timer*, pTi)
+{	
+	(void)pTi;
+	// CallEventListeners is still protected - figure out if we need to make it public, or if the focus stuff can be handled better in VCL directly. First see what AT is expecting...
+	// aEdName.CallEventListeners( VCLEVENT_CONTROL_GETFOCUS );
+	return 0;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/ui/docshell/docsh.cxx b/main/sc/source/ui/docshell/docsh.cxx
index d2de941..4644e60 100644
--- a/main/sc/source/ui/docshell/docsh.cxx
+++ b/main/sc/source/ui/docshell/docsh.cxx
@@ -121,6 +121,9 @@
 
 #include "docsh.hxx"
 #include "docshimp.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <sfx2/viewfrm.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <rtl/logfile.hxx>
 
 #include <comphelper/processfactory.hxx>
@@ -1587,6 +1590,23 @@
 
     PrepareSaveGuard aPrepareGuard( *this);
 
+//IAccessibility2 Implementation 2009-----
+	aDocument.setDocAccTitle(String());
+	// SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this, TYPE(SfxTopViewFrame));
+	SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
+	if (pFrame1)
+	{
+		Window* pWindow = &pFrame1->GetWindow();
+		if ( pWindow )
+		{
+			Window* pSysWin = pWindow->GetSystemWindow();
+			if ( pSysWin )
+			{
+				pSysWin->SetAccessibleName(String());
+			}
+		}
+	}
+//-----IAccessibility2 Implementation 2009
 	//	wait cursor is handled with progress bar
     sal_Bool bRet = SfxObjectShell::SaveAs( rMedium );
 	if( bRet )
diff --git a/main/sc/source/ui/drawfunc/fudraw.cxx b/main/sc/source/ui/drawfunc/fudraw.cxx
index 9a8959d..02c2e50 100644
--- a/main/sc/source/ui/drawfunc/fudraw.cxx
+++ b/main/sc/source/ui/drawfunc/fudraw.cxx
@@ -354,10 +354,16 @@
 					// changeover to the next object
 					if(!pView->MarkNextObj( !aCode.IsShift() ))
 					{
+//IAccessibility2 Implementation 2009-----
+						//If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). 
+						if ( pView->GetMarkableObjCount() > 1 && pView->HasMarkableObj() )
+						{
+//-----IAccessibility2 Implementation 2009
 						// #97016# No next object: go over open end and
 						// get first from the other side
 						pView->UnmarkAllObj();
 						pView->MarkNextObj(!aCode.IsShift());
+						}
 					}
 
 					// #97016# II
diff --git a/main/sc/source/ui/inc/AccessibleCell.hxx b/main/sc/source/ui/inc/AccessibleCell.hxx
index 6448c78..e2f7f0a 100644
--- a/main/sc/source/ui/inc/AccessibleCell.hxx
+++ b/main/sc/source/ui/inc/AccessibleCell.hxx
@@ -32,17 +32,28 @@
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <editeng/AccessibleStaticTextBase.hxx>
 #include <comphelper/uno3.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
 
 class ScTabViewShell;
 class ScAccessibleDocument;
 
+typedef cppu::ImplHelper1< ::com::sun::star::accessibility::XAccessibleExtendedAttributes>
+					ScAccessibleCellAttributeImpl;
+
 /**	@descr
         This base class provides an implementation of the
         <code>AccessibleCell</code> service.
 */
 class ScAccessibleCell
 	:	public	ScAccessibleCellBase,
-        public  accessibility::AccessibleStaticTextBase
+        public  accessibility::AccessibleStaticTextBase,
+//IAccessibility2 Implementation 2009-----
+		public  ScAccessibleCellAttributeImpl
+//-----IAccessibility2 Implementation 2009
 {
 public:
 	//=====  internal  ========================================================
@@ -134,6 +145,14 @@
     	getSupportedServiceNames(void)
         throw (::com::sun::star::uno::RuntimeException);
 
+//IAccessibility2 Implementation 2009-----
+    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+
+	// Override this method to handle cell's ParaIndent attribute specially.
+    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 private:
 	ScTabViewShell* mpViewShell;
     ScAccessibleDocument* mpAccDoc;
@@ -163,6 +182,10 @@
 	void AddRelation(const ScRange& rRange,
 		const sal_uInt16 aRelationType,
 		::utl::AccessibleRelationSetHelper* pRelationSet);
+//IAccessibility2 Implementation 2009-----
+	sal_Bool IsFormulaMode();
+	sal_Bool IsDropdown();
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/AccessibleCellBase.hxx b/main/sc/source/ui/inc/AccessibleCellBase.hxx
index 5a17cc1..6648be8 100644
--- a/main/sc/source/ui/inc/AccessibleCellBase.hxx
+++ b/main/sc/source/ui/inc/AccessibleCellBase.hxx
@@ -142,6 +142,21 @@
 	virtual sal_Bool IsEditable(
 		const com::sun::star::uno::Reference<
 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
+//IAccessibility2 Implementation 2009-----
+protected:
+	virtual ::rtl::OUString SAL_CALL GetNote(void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+	virtual ::rtl::OUString SAL_CALL GetAllDisplayNote(void)
+        throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getShadowAttrs(void) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getBorderAttrs(void) 
+		throw (::com::sun::star::uno::RuntimeException);
+public:
+	const ScAddress& GetCellAddress() const { return maCellAddress; }
+	sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
+//-----IAccessibility2 Implementation 2009
 };
 	
 
diff --git a/main/sc/source/ui/inc/AccessibleDocument.hxx b/main/sc/source/ui/inc/AccessibleDocument.hxx
index 53d652b..9411496 100644
--- a/main/sc/source/ui/inc/AccessibleDocument.hxx
+++ b/main/sc/source/ui/inc/AccessibleDocument.hxx
@@ -29,7 +29,12 @@
 #include "viewdata.hxx"
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
 #include <com/sun/star/view/XSelectionChangeListener.hpp>
-#include <cppuhelper/implbase2.hxx>
+//IAccessibility2 Implementation 2009-----
+//#include <cppuhelper/implbase2.hxx>
+#include <cppuhelper/implbase3.hxx>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
+//-----IAccessibility2 Implementation 2009
 #include <svx/IAccessibleViewForwarder.hxx>
 
 class ScTabViewShell;
@@ -51,13 +56,19 @@
         <code>AccessibleContext</code> service.
 */
 
-typedef cppu::ImplHelper2< ::com::sun::star::accessibility::XAccessibleSelection,
+//IAccessibility2 Implementation 2009-----
+typedef cppu::ImplHelper3< ::com::sun::star::accessibility::XAccessibleSelection,
+							::com::sun::star::accessibility::XAccessibleExtendedAttributes,
+//-----IAccessibility2 Implementation 2009
 							::com::sun::star::view::XSelectionChangeListener >
 					ScAccessibleDocumentImpl;
 
 class ScAccessibleDocument
 	:	public ScAccessibleDocumentBase,
 		public ScAccessibleDocumentImpl,
+//IAccessibility2 Implementation 2009-----
+	       public com::sun::star::accessibility::XAccessibleGetAccFlowTo,
+//-----IAccessibility2 Implementation 2009
         public accessibility::IAccessibleViewForwarder
 {
 public:
@@ -124,6 +135,14 @@
     	getAccessibleStateSet(void)
         throw (::com::sun::star::uno::RuntimeException);
 
+//IAccessibility2 Implementation 2009-----
+	virtual ::rtl::OUString SAL_CALL
+		getAccessibleName(void)
+		throw (::com::sun::star::uno::RuntimeException);
+
+	virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleSelection  ===========================================
 
     virtual void SAL_CALL 
@@ -318,6 +337,24 @@
     rtl::OUString GetCurrentCellDescription() const;
 
     Rectangle GetVisibleArea_Impl() const;
+//IAccessibility2 Implementation 2009-----
+    com::sun::star::uno::Sequence< com::sun::star::uno::Any > GetScAccFlowToSequence();
+public:
+	ScDocument *GetDocument() const ;
+	ScAddress   GetCurCellAddress() const;
+	//=====  XAccessibleGetAccFromXShape  ============================================
+	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	 virtual sal_Int32 SAL_CALL getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+protected:
+	void SwitchViewFireFocus();
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/AccessibleDocumentBase.hxx b/main/sc/source/ui/inc/AccessibleDocumentBase.hxx
index a354441..7db24aa 100644
--- a/main/sc/source/ui/inc/AccessibleDocumentBase.hxx
+++ b/main/sc/source/ui/inc/AccessibleDocumentBase.hxx
@@ -37,6 +37,9 @@
 	ScAccessibleDocumentBase(
         const ::com::sun::star::uno::Reference<
         ::com::sun::star::accessibility::XAccessible>& rxParent);
+//IAccessibility2 Implementation 2009-----
+	virtual void SwitchViewFireFocus();
+//-----IAccessibility2 Implementation 2009
 protected:
 	virtual ~ScAccessibleDocumentBase	(void);
 };
diff --git a/main/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx b/main/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
index e445ac1..5896cdf 100644
--- a/main/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
+++ b/main/sc/source/ui/inc/AccessibleDocumentPagePreview.hxx
@@ -85,6 +85,10 @@
     	getAccessibleStateSet(void)
         throw (::com::sun::star::uno::RuntimeException);
 
+//IAccessibility2 Implementation 2009-----
+	virtual ::rtl::OUString SAL_CALL getAccessibleName(void)
+		throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 	///=====  XServiceInfo  ====================================================
 
     /**	Returns an identifier for the implementation of this object.
diff --git a/main/sc/source/ui/inc/AccessibleEditObject.hxx b/main/sc/source/ui/inc/AccessibleEditObject.hxx
index beca037..b71baec 100644
--- a/main/sc/source/ui/inc/AccessibleEditObject.hxx
+++ b/main/sc/source/ui/inc/AccessibleEditObject.hxx
@@ -27,6 +27,10 @@
 
 #include "AccessibleContextBase.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "global.hxx"
+//-----IAccessibility2 Implementation 2009
 namespace accessibility
 {
     class AccessibleTextHelper;
@@ -46,7 +50,10 @@
         <code>AccessibleCell</code> service.
 */
 class ScAccessibleEditObject
-	:	public	ScAccessibleContextBase
+	:	public	ScAccessibleContextBase,
+//IAccessibility2 Implementation 2009-----
+        public ::com::sun::star::accessibility::XAccessibleSelection 
+//-----IAccessibility2 Implementation 2009
 {
 public:
 	//=====  internal  ========================================================
@@ -71,7 +78,17 @@
     virtual void LostFocus();
 
     virtual void GotFocus();
+//IAccessibility2 Implementation 2009-----
+///=====  XInterface  =====================================================
 
+	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+		::com::sun::star::uno::Type const & rType )
+		throw (::com::sun::star::uno::RuntimeException);
+
+	virtual void SAL_CALL acquire() throw ();
+
+	virtual void SAL_CALL release() throw ();
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleComponent  ============================================
 
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
@@ -110,6 +127,32 @@
     	getAccessibleStateSet(void)
         throw (::com::sun::star::uno::RuntimeException);
 
+	//=====  XAccessibleSelection  ============================================
+		
+		virtual void SAL_CALL selectAccessibleChild( 
+			sal_Int32 nChildIndex ) 
+			throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+			::com::sun::star::uno::RuntimeException );
+		virtual sal_Bool SAL_CALL isAccessibleChildSelected( 
+			sal_Int32 nChildIndex ) 
+			throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+			::com::sun::star::uno::RuntimeException );
+		virtual void SAL_CALL clearAccessibleSelection(  ) 
+			throw ( ::com::sun::star::uno::RuntimeException );
+		virtual void SAL_CALL selectAllAccessibleChildren(  ) 
+			throw ( ::com::sun::star::uno::RuntimeException );
+		virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) 
+			throw ( ::com::sun::star::uno::RuntimeException );
+		virtual ::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);
+		virtual void SAL_CALL deselectAccessibleChild( 
+			sal_Int32 nSelectedChildIndex ) 
+			throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+			::com::sun::star::uno::RuntimeException );
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 protected:
     ///	Return this object's description.
 	virtual ::rtl::OUString SAL_CALL
@@ -168,6 +211,20 @@
 		::com::sun::star::accessibility::XAccessibleStateSet>& rxParentStates);
 
 	void CreateTextHelper();
+//IAccessibility2 Implementation 2009-----
+	ScDocument *m_pScDoc;
+	ScAddress m_curCellAddress;
+
+
+	///=====  XAccessibleComponent  ============================================
+    virtual sal_Int32 SAL_CALL getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+	sal_Int32 GetFgBgColor(  const rtl::OUString &strPropColor) ;
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx b/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx
index 7a97c9c..4065ac1 100644
--- a/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx
+++ b/main/sc/source/ui/inc/AccessibleSpreadsheet.hxx
@@ -30,6 +30,10 @@
 
 #include <vector>
 
+//IAccessibility2 Implementation 2009-----
+#include "rangelst.hxx"
+#include <map>
+//-----IAccessibility2 Implementation 2009
 class ScMyAddress : public ScAddress
 {
 public:
@@ -239,6 +243,17 @@
         	const ::com::sun::star::uno::Reference<
                 ::com::sun::star::accessibility::XAccessibleEventListener>& xListener)
         throw (com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleTableSelection  ============================================
+	virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+//-----IAccessibility2 Implementation 2009
 
 protected:
     ///	Return the object's current bounding box relative to the desktop.
@@ -279,6 +294,55 @@
 	ScDocument* GetDocument(ScTabViewShell* pViewShell);
 	Rectangle	GetVisArea(ScTabViewShell* pViewShell, ScSplitPos eSplitPos);
 	Rectangle	GetVisCells(const Rectangle& rVisArea);
+//IAccessibility2 Implementation 2009-----
+	//void CreateSortedMarkedCells();
+	//void AddMarkedRange(const ScRange& rRange);
+	typedef std::vector<ScMyAddress> VEC_MYADDR;
+
+	typedef std::map<ScMyAddress,com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > > 
+		MAP_ADDR_XACC;
+	MAP_ADDR_XACC m_mapSelectionSend;
+	void RemoveSelection(ScMarkData &refScMarkData);
+	sal_Bool IsSameMarkCell();
+	void CommitFocusCell(const ScAddress &aNewCell);
+public:
+	void FireFirstCellFocus();
+private:
+	sal_Bool m_bFormulaMode;
+	sal_Bool m_bFormulaLastMode;
+	ScAddress m_aFormulaActiveCell;
+	MAP_ADDR_XACC m_mapFormulaSelectionSend;
+	VEC_MYADDR m_vecFormulaLastMyAddr;
+    ScAccessibleCell*   m_pAccFormulaCell;
+	sal_uInt16 m_nMinX;
+	sal_uInt16 m_nMaxX;
+	sal_Int32 m_nMinY;
+	sal_Int32 m_nMaxY;
+	sal_Int32 GetRowAll() const { return m_nMaxY - m_nMinY + 1 ; }
+	sal_uInt16  GetColAll() const { return m_nMaxX - m_nMinX + 1; }
+	void NotifyRefMode();
+	void RemoveFormulaSelection(sal_Bool bRemoveAll =sal_False);
+	sal_Bool CheckChildIndex(sal_Int32)const ;
+	ScAddress GetChildIndexAddress(sal_Int32) const;
+    sal_Int32 GetAccessibleIndexFormula( sal_Int32 nRow, sal_Int32 nColumn );
+	sal_Bool GetFormulaCurrentFocusCell(ScAddress &addr);
+public:
+	sal_Bool IsScAddrFormulaSel (const ScAddress &addr) const ;
+	sal_Bool IsFormulaMode() ;
+	::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetActiveCell();
+	ScRange m_aLastWithInMarkRange;
+    String m_strCurCellValue;
+    ScRangeList m_LastMarkedRanges;
+    typedef std::vector<ScRange*> VEC_RANGE;
+    VEC_RANGE m_vecTempRange;
+    typedef std::pair<sal_uInt16,sal_uInt16> PAIR_COL;
+    typedef std::vector<PAIR_COL> VEC_COL;
+    VEC_COL m_vecTempCol;
+    ScMyAddress CalcScAddressFromRangeList(ScRangeList *pMarkedRanges,sal_Int32 nSelectedChildIndex);
+	sal_Bool CalcScRangeDifferenceMax(ScRange *pSrc,ScRange *pDest,int nMax,VEC_MYADDR &vecRet,int &nSize);
+	sal_Bool CalcScRangeListDifferenceMax(ScRangeList *pSrc,ScRangeList *pDest,int nMax,VEC_MYADDR &vecRet);
+	String m_strOldTabName;
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/AccessibleTableBase.hxx b/main/sc/source/ui/inc/AccessibleTableBase.hxx
index d3e4745..6d66667 100644
--- a/main/sc/source/ui/inc/AccessibleTableBase.hxx
+++ b/main/sc/source/ui/inc/AccessibleTableBase.hxx
@@ -30,6 +30,9 @@
 #include "address.hxx"
 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+//-----IAccessibility2 Implementation 2009
 #include <cppuhelper/implbase2.hxx>
 
 class ScTabViewShell;
@@ -45,6 +48,9 @@
 
 class ScAccessibleTableBase :
 			public ScAccessibleContextBase,
+//IAccessibility2 Implementation 2009-----
+			public	 ::com::sun::star::accessibility::XAccessibleTableSelection,
+//-----IAccessibility2 Implementation 2009
 			public ScAccessibleTableBaseImpl
 {
 public:
@@ -199,6 +205,16 @@
     	getAccessibleChild(sal_Int32 nIndex)
         throw (::com::sun::star::uno::RuntimeException,
 				::com::sun::star::lang::IndexOutOfBoundsException);
+//IAccessibility2 Implementation 2009-----
+	virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+//-----IAccessibility2 Implementation 2009
 
 protected:
     ///	Return this object's description.
diff --git a/main/sc/source/ui/inc/AccessibleText.hxx b/main/sc/source/ui/inc/AccessibleText.hxx
index bfdf7e3..f404db9 100644
--- a/main/sc/source/ui/inc/AccessibleText.hxx
+++ b/main/sc/source/ui/inc/AccessibleText.hxx
@@ -132,7 +132,11 @@
 class ScAccessibleEditObjectTextData : public ScAccessibleTextData
 {
 public:
-						ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin);
+//IAccessibility2 Implementation 2009-----
+	// Solution: Add a para to indicate whether the object is cloned
+						//ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin);
+						ScAccessibleEditObjectTextData(EditView* pEditView, Window* pWin, sal_Bool isClone=sal_False);
+//-----IAccessibility2 Implementation 2009
 	virtual				~ScAccessibleEditObjectTextData();
 
 	virtual	ScAccessibleTextData* Clone() const;
@@ -155,6 +159,9 @@
     EditEngine* mpEditEngine;
     SvxEditEngineForwarder*	mpForwarder;
     Window* mpWindow;
+//IAccessibility2 Implementation 2009-----
+    sal_Bool mbIsCloned;
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/content.hxx b/main/sc/source/ui/inc/content.hxx
index 827eec3..9f4479d 100644
--- a/main/sc/source/ui/inc/content.hxx
+++ b/main/sc/source/ui/inc/content.hxx
@@ -34,6 +34,9 @@
 class ScDocument;
 class ScDocShell;
 class ScAreaLink;
+//IAccessibility2 Implementation 2009-----
+class SdrPage;
+//-----IAccessibility2 Implementation 2009
 
 #define SC_CONTENT_ROOT			0
 #define SC_CONTENT_TABLE		1
@@ -64,6 +67,10 @@
 	String				aHiddenName;		// URL zum Laden
 	String				aHiddenTitle;		// fuer Anzeige
 	ScDocument*			pHiddenDocument;	// temporaer
+//IAccessibility2 Implementation 2009-----
+    sal_Bool                           bisInNavigatoeDlg;
+	String 				sKeyString;
+//-----IAccessibility2 Implementation 2009
 
 	sal_uInt16				pPosList[SC_CONTENT_COUNT];		// fuer die Reihenfolge
 
@@ -112,7 +119,12 @@
 
     DECL_LINK( ContentDoubleClickHdl, ScContentTree* );
 	DECL_STATIC_LINK( ScContentTree, ExecDragHdl, void* );
+//IAccessibility2 Implementation 2009-----
+public:
+	SvLBoxEntry* pTmpEntry;
 
+	bool m_bFirstPaint;
+//-----IAccessibility2 Implementation 2009
 protected:
 //	virtual sal_Bool	Drop( const DropEvent& rEvt );
 //	virtual sal_Bool	QueryDrop( DropEvent& rEvt );
@@ -126,11 +138,21 @@
 
 	virtual void	Command( const CommandEvent& rCEvt );
 	virtual void	RequestHelp( const HelpEvent& rHEvt );
-
+//IAccessibility2 Implementation 2009-----
+	virtual void 	InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&, SvLBoxButtonKind);
+//-----IAccessibility2 Implementation 2009
 public:
 			ScContentTree( Window* pParent, const ResId& rResId );
 			~ScContentTree();
 
+//IAccessibility2 Implementation 2009-----
+    String			getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const;
+    String  		GetEntryAltText( SvLBoxEntry* pEntry ) const;
+    String  		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;
+
+	void     ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry = NULL);
+	sal_Bool     SetNavigatorDlgFlag(sal_Bool isInNavigatoeDlg){ return bisInNavigatoeDlg=isInNavigatoeDlg;};
+//-----IAccessibility2 Implementation 2009
     virtual void    MouseButtonDown( const MouseEvent& rMEvt );
     virtual void    KeyInput( const KeyEvent& rKEvt );
 
diff --git a/main/sc/source/ui/inc/dbnamdlg.hxx b/main/sc/source/ui/inc/dbnamdlg.hxx
index b3b822d..fcbedfc 100644
--- a/main/sc/source/ui/inc/dbnamdlg.hxx
+++ b/main/sc/source/ui/inc/dbnamdlg.hxx
@@ -100,6 +100,10 @@
 	ScDBCollection	aLocalDbCol;
 	ScRange			theCurArea;
 	List			aRemoveList;
+	//IAccessibility2 Implementation 2009-----
+	Timer		SynFocusTimer;
+	DECL_LINK( FocusToComoboxHdl, Timer* );
+	//-----IAccessibility2 Implementation 2009
 
 #ifdef _DBNAMDLG_CXX
 private:
diff --git a/main/sc/source/ui/inc/docsh.hxx b/main/sc/source/ui/inc/docsh.hxx
index c910a76..dfa798e 100644
--- a/main/sc/source/ui/inc/docsh.hxx
+++ b/main/sc/source/ui/inc/docsh.hxx
@@ -406,6 +406,14 @@
 
     const ScOptSolverSave* GetSolverSaveData() const    { return pSolverSaveData; }     // may be null
     void            SetSolverSaveData( const ScOptSolverSave& rData );
+
+//IAccessibility2 Implementation 2009-----
+	virtual void setDocAccTitle( const String& rTitle ) { aDocument.setDocAccTitle( rTitle ); }
+	virtual const String getDocAccTitle() const { return aDocument.getDocAccTitle(); }
+	void setDocReadOnly( sal_Bool b){ aDocument.setDocReadOnly(b);}
+	sal_Bool getDocReadOnly() const { return aDocument.getDocReadOnly(); }
+//-----IAccessibility2 Implementation 2009
+
 	//<!--Added by PengYunQuan for Validity Cell Range Picker
 	sal_Bool		AcceptStateUpdate() const;
 	//-->Added by PengYunQuan for Validity Cell Range Picker
diff --git a/main/sc/source/ui/inc/drawview.hxx b/main/sc/source/ui/inc/drawview.hxx
index f48433a..8d3befb 100644
--- a/main/sc/source/ui/inc/drawview.hxx
+++ b/main/sc/source/ui/inc/drawview.hxx
@@ -155,6 +155,11 @@
 	SdrEndTextEditKind	ScEndTextEdit();	// ruft SetDrawTextUndo(0)
 //UNUSED2009-05 void                    CaptionTextDirection(sal_uInt16 nSlot);
     ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > CopyToTransferable();
+//IAccessibility2 Implementation 2009-----
+	SdrObject*  GetObjectByName(const String& rName);
+	sal_Bool           GetObjectIsMarked(  SdrObject * pObject );
+	sal_Bool           SelectCurrentViewObject( const String& rName );
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/gridwin.hxx b/main/sc/source/ui/inc/gridwin.hxx
index b9a0a1e..cf061da 100644
--- a/main/sc/source/ui/inc/gridwin.hxx
+++ b/main/sc/source/ui/inc/gridwin.hxx
@@ -239,7 +239,9 @@
 	void			ExecPageFieldSelect( SCCOL nCol, SCROW nRow, sal_Bool bHasSelection, const String& rStr );
 
 	sal_Bool			HasScenarioButton( const Point& rPosPixel, ScRange& rScenRange );
-
+//IAccessibility2 Implementation 2009-----
+	sal_Bool			HasScenarioRange( sal_uInt16 nCol, sal_Int32 nRow, ScRange& rScenRange ); 
+//-----IAccessibility2 Implementation 2009
 	sal_Bool			DropScroll( const Point& rMousePos );
 
 	sal_Int8		AcceptPrivateDrop( const AcceptDropEvent& rEvt );
@@ -388,6 +390,9 @@
 	void			DoInvertRect( const Rectangle& rPixel );
 
 	void			CheckNeedsRepaint();
+//IAccessibility2 Implementation 2009-----
+	virtual void SwitchView();
+//-----IAccessibility2 Implementation 2009
 
     void            UpdateDPFromFieldPopupMenu();
 
diff --git a/main/sc/source/ui/inc/preview.hxx b/main/sc/source/ui/inc/preview.hxx
index aacac53..4b63313 100644
--- a/main/sc/source/ui/inc/preview.hxx
+++ b/main/sc/source/ui/inc/preview.hxx
@@ -158,6 +158,9 @@
 	static void StaticInvalidate();
 
     FmFormView* GetDrawView() { return pDrawView; }
+//IAccessibility2 Implementation 2009-----
+	virtual void SwitchView();
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sc/source/ui/inc/scuitphfedit.hxx b/main/sc/source/ui/inc/scuitphfedit.hxx
index ec85b1f..88d0500 100644
--- a/main/sc/source/ui/inc/scuitphfedit.hxx
+++ b/main/sc/source/ui/inc/scuitphfedit.hxx
@@ -91,6 +91,9 @@
 
 	sal_uInt16			nWhich;
 	String			aCmdArr[6];
+	//IAccessibility2 Implementation 2009-----
+	DECL_LINK( ObjectSelectHdl, ScEditWindow* );
+	//-----IAccessibility2 Implementation 2009
 
 private:
 #ifdef _TPHFEDIT_CXX
diff --git a/main/sc/source/ui/inc/tabview.hxx b/main/sc/source/ui/inc/tabview.hxx
index e2b8003..f3ea07d 100644
--- a/main/sc/source/ui/inc/tabview.hxx
+++ b/main/sc/source/ui/inc/tabview.hxx
@@ -472,7 +472,7 @@
                                 sal_Bool bCols = sal_False, sal_Bool bRows = sal_False, sal_Bool bCellSelection = sal_False );
 	void			InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
 									sal_Bool bTestNeg = sal_False,
-									sal_Bool bCols = sal_False, sal_Bool bRows = sal_False );
+									sal_Bool bCols = sal_False, sal_Bool bRows = sal_False, sal_Bool bForceNeg = sal_False );
 	void			InitOwnBlockMode();
 	void			DoneBlockMode( sal_Bool bContinue = sal_False );
 
diff --git a/main/sc/source/ui/inc/tabvwsh.hxx b/main/sc/source/ui/inc/tabvwsh.hxx
index 43f33b5..dcb8f19 100644
--- a/main/sc/source/ui/inc/tabvwsh.hxx
+++ b/main/sc/source/ui/inc/tabvwsh.hxx
@@ -161,7 +161,9 @@
 	sal_Bool					bPrintSelected;				// for result of SvxPrtQryBox
 
 	sal_Bool					bReadOnly;					// um Status-Aenderungen zu erkennen
-
+//IAccessibility2 Implementation 2009-----	
+	sal_Bool 					bIsActive;
+//-----IAccessibility2 Implementation 2009
 	SbxObject*				pScSbxObject;
 
 //UNUSED2008-05  sal_Bool                    bChartDlgIsEdit;            // Datenbereich aendern
@@ -423,6 +425,11 @@
     bool    ExecuteRetypePassDlg(ScPasswordHash eDesiredHash);
 
     using ScTabView::ShowCursor;
+//IAccessibility2 Implementation 2009-----
+	sal_Bool IsActive(){ return bIsActive; }
+	rtl::OUString GetFormula(ScAddress& rAddress);
+	const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const;
+//-----IAccessibility2 Implementation 2009
 };
 
 //==================================================================
diff --git a/main/sc/source/ui/inc/tphfedit.hxx b/main/sc/source/ui/inc/tphfedit.hxx
index e4446ab..2960bcc 100644
--- a/main/sc/source/ui/inc/tphfedit.hxx
+++ b/main/sc/source/ui/inc/tphfedit.hxx
@@ -78,6 +78,9 @@
 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
 
 	inline ScHeaderEditEngine*  GetEditEngine() const {return pEdEngine;}
+	//IAccessibility2 Implementation 2009-----
+	void 			SetObjectSelectHdl( const Link& aLink){ aObjectSelectLink = aLink; };
+	//-----IAccessibility2 Implementation 2009
 protected:
 	virtual void	Paint( const Rectangle& rRec );
 	virtual void	MouseMove( const MouseEvent& rMEvt );
@@ -96,6 +99,11 @@
 
     com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > xAcc;
     ScAccessibleEditObject* pAcc;
+
+	//IAccessibility2 Implementation 2009-----
+    Link				aObjectSelectLink;
+	//-----IAccessibility2 Implementation 2009
+
 };
 
 //===================================================================
diff --git a/main/sc/source/ui/inc/validate.hxx b/main/sc/source/ui/inc/validate.hxx
index 611236c..ec04c4c 100644
--- a/main/sc/source/ui/inc/validate.hxx
+++ b/main/sc/source/ui/inc/validate.hxx
@@ -93,9 +93,8 @@
 	//<!--Added by PengYunQuan for Validity Cell Range Picker
 	typedef ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>	ScValidationDlgBase;
 
-	//Start_Moddify by liliang 03/26/2008 SODC_13677_2
 	DECL_LINK( OkHdl, Button * );
-	//End_Moddify by liliang 03/26/2008 SODC_13677_2
+
 	bool	m_bOwnRefHdlr:1;
 
 	ScTabViewShell *m_pTabVwSh;
diff --git a/main/sc/source/ui/inc/viewfunc.hxx b/main/sc/source/ui/inc/viewfunc.hxx
index f373848..507706d 100644
--- a/main/sc/source/ui/inc/viewfunc.hxx
+++ b/main/sc/source/ui/inc/viewfunc.hxx
@@ -251,8 +251,11 @@
 	ScAutoFormatData* CreateAutoFormatData();
 	void			AutoFormat( sal_uInt16 nFormatNo, sal_Bool bRecord = sal_True );
 
-	void			SearchAndReplace( const SvxSearchItem* pSearchItem,
+//IAccessibility2 Implementation 2009-----
+//	void			SearchAndReplace( const SvxSearchItem* pSearchItem,
+	sal_Bool			SearchAndReplace( const SvxSearchItem* pSearchItem,
 										sal_Bool bAddUndo, sal_Bool bIsApi );
+//-----IAccessibility2 Implementation 2009
 
 	void			Solve( const ScSolveParam& rParam );
 	void			TabOp( const ScTabOpParam& rParam,  sal_Bool bRecord = sal_True );
diff --git a/main/sc/source/ui/miscdlgs/highred.cxx b/main/sc/source/ui/miscdlgs/highred.cxx
index af6c05f..37f67d3 100644
--- a/main/sc/source/ui/miscdlgs/highred.cxx
+++ b/main/sc/source/ui/miscdlgs/highred.cxx
@@ -105,6 +105,7 @@
 
 	Init();
 
+	aFilterCtr.SetAccessibleRelationMemberOf(&aFlFilter);
 }
 
 ScHighlightChgDlg::~ScHighlightChgDlg()
@@ -257,6 +258,9 @@
 		aEdAssign.Show();
 		aRbAssign.Show();
 		aEdAssign.SetText(aFilterCtr.GetRange());
+		//IAccessibility2 Implementation 2009-----
+		aEdAssign.GrabFocus();
+		//-----IAccessibility2 Implementation 2009
 		ScAnyRefDlg::RefInputStart(&aEdAssign,&aRbAssign);
 	}
 	return 0;
diff --git a/main/sc/source/ui/miscdlgs/solveroptions.cxx b/main/sc/source/ui/miscdlgs/solveroptions.cxx
index a61732f..bc56652 100644
--- a/main/sc/source/ui/miscdlgs/solveroptions.cxx
+++ b/main/sc/source/ui/miscdlgs/solveroptions.cxx
@@ -84,10 +84,34 @@
 
     void      SetDoubleValue( double fNew ) { mbIsDouble = true; mfDoubleValue = fNew; }
     void      SetIntValue( sal_Int32 nNew ) { mbIsDouble = false; mnIntValue = nNew; }
-
+	//IAccessibility2 Implementation 2009-----
+// MT: Commented out SV_ITEM_ID_EXTENDRLBOXSTRING and GetExtendText() in svlbitem.hxx - needed?
+//	virtual USHORT IsA() {return SV_ITEM_ID_EXTENDRLBOXSTRING;}
+//	virtual XubString GetExtendText() const;
+	//-----IAccessibility2 Implementation 2009
     virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags, SvLBoxEntry* pEntry );
 };
 
+//IAccessibility2 Implementation 2009-----
+// MT: Commented out SV_ITEM_ID_EXTENDRLBOXSTRING and GetExtendText() in svlbitem.hxx - needed?
+/*
+XubString ScSolverOptionsString::GetExtendText() const
+{
+	String aNormalStr( GetText() );
+	aNormalStr.Append( (sal_Unicode) ':' );
+	String sTxt( ' ' );
+    if ( mbIsDouble )
+        sTxt += (String)rtl::math::doubleToUString( mfDoubleValue,
+            rtl_math_StringFormat_Automatic, rtl_math_DecimalPlaces_Max,
+            ScGlobal::GetpLocaleData()->getNumDecimalSep().GetChar(0), true );
+    else
+        sTxt += String::CreateFromInt32( mnIntValue );
+	aNormalStr.Append(sTxt);
+	return aNormalStr;
+}
+*/
+//-----IAccessibility2 Implementation 2009
+
 void ScSolverOptionsString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16, SvLBoxEntry* /* pEntry */ )
 {
     //! move position? (SvxLinguTabPage: aPos.X() += 20)
diff --git a/main/sc/source/ui/navipi/content.cxx b/main/sc/source/ui/navipi/content.cxx
index 2a14ea3..9eca3f2 100644
--- a/main/sc/source/ui/navipi/content.cxx
+++ b/main/sc/source/ui/navipi/content.cxx
@@ -64,6 +64,10 @@
 #include "navicfg.hxx"
 #include "navsett.hxx"
 #include "postit.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "tabvwsh.hxx"
+#include "drawview.hxx"
+//-----IAccessibility2 Implementation 2009
 #include "clipparam.hxx"
 
 using namespace com::sun::star;
@@ -126,7 +130,10 @@
 	aHCEntryImages	( ScResId( RID_IMAGELIST_H_NAVCONT ) ),
 	nRootType		( SC_CONTENT_ROOT ),
 	bHiddenDoc		( sal_False ),
-	pHiddenDocument	( NULL )
+	pHiddenDocument	( NULL ),
+//IAccessibility2 Implementation 2009-----
+    bisInNavigatoeDlg  ( sal_False )
+//-----IAccessibility2 Implementation 2009
 {
 	sal_uInt16 i;
 	for (i=0; i<SC_CONTENT_COUNT; i++)
@@ -142,12 +149,80 @@
 
     SetDoubleClickHdl( LINK( this, ScContentTree, ContentDoubleClickHdl ) );
 
+	//IAccessibility2 Implementation 2009-----
+	pTmpEntry= NULL;
+	m_bFirstPaint=true;
+	//-----IAccessibility2 Implementation 2009
+
     SetStyle( GetStyle() | WB_QUICK_SEARCH );
 }
 
 ScContentTree::~ScContentTree()
 {
 }
+//IAccessibility2 Implementation 2009-----
+// helper function for 	GetEntryAltText and GetEntryLongDescription
+String ScContentTree::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const
+{
+	SdrObject* pFound = NULL;	
+
+	sal_uInt16 nType;
+	sal_uLong nChild;	
+	GetEntryIndexes( nType, nChild, pEntry );
+	switch( nType )
+	{
+	case SC_CONTENT_OLEOBJECT:
+	case SC_CONTENT_GRAPHIC:
+	case SC_CONTENT_DRAWING:
+		{
+			ScDocument* pDoc = ( const_cast< ScContentTree* >(this) )->GetSourceDocument();
+			SdrIterMode eIter = ( nType == SC_CONTENT_DRAWING ) ? IM_FLAT : IM_DEEPNOGROUPS;
+			ScDrawLayer* pDrawLayer = pDoc->GetDrawLayer();
+			SfxObjectShell* pShell = pDoc->GetDocumentShell();
+			if (pDrawLayer && pShell)
+			{
+				sal_uInt16 nTabCount = pDoc->GetTableCount();
+				for (sal_uInt16 nTab=0; nTab<nTabCount; nTab++)
+				{
+					SdrPage* pPage = pDrawLayer->GetPage(nTab);
+					DBG_ASSERT(pPage,"Page ?");
+					if (pPage)
+					{
+						SdrObjListIter aIter( *pPage, eIter );
+						SdrObject* pObject = aIter.Next();	
+						while (pObject)
+						{
+							if( ScDrawLayer::GetVisibleName( pObject ) == GetEntryText( pEntry ) )
+							{
+								pFound = pObject;
+								break;
+							}
+							pObject = aIter.Next();
+						}
+					}
+				}
+			}
+			 if( pFound )
+			 {
+			 	if( isAltText )
+			 		return pFound->GetTitle();
+				else
+					return pFound->GetDescription();
+			 }
+		}
+		break;
+	}
+	return String();
+}
+String  ScContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const
+{
+	return getAltLongDescText( pEntry, sal_True );
+}
+String ScContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
+{
+	return getAltLongDescText( pEntry, sal_False);
+}
+//-----IAccessibility2 Implementation 2009
 
 void ScContentTree::InitRoot( sal_uInt16 nType )
 {
@@ -175,7 +250,17 @@
 
 void ScContentTree::ClearAll()
 {
+//IAccessibility2 Implementation 2009-----
+    //There are one method in Control::SetUpdateMode(), and one override method SvTreeListBox::SetUpdateMode(). Here although 
+    //SvTreeListBox::SetUpdateMode() is called in refresh method, it only call SvTreeListBox::SetUpdateMode(), not Control::SetUpdateMode(). 
+    //In SvTreeList::Clear(), Broadcast( LISTACTION_CLEARED ) will be called and finally, it will be trapped into the event yield() loop. And 
+    //the InitRoot() method won't be called. Then if a user click or press key to update the navigator tree, crash happens.
+    //So the solution is to disable the UpdateMode of Control, then call Clear(), then recover the update mode
+    sal_Bool bOldUpdate = Control::IsUpdateMode();
+    Control::SetUpdateMode(sal_False);
 	Clear();
+    Control::SetUpdateMode(bOldUpdate);
+//-----IAccessibility2 Implementation 2009
 	for (sal_uInt16 i=1; i<SC_CONTENT_COUNT; i++)
 		InitRoot(i);
 }
@@ -403,10 +488,85 @@
             break;
 		}
 	}
-    StoreSettings();
+//IAccessibility2 Implementation 2009-----
+	//Solution: Make KEY_SPACE has same function as DoubleClick 
+	if ( bisInNavigatoeDlg )
+	{
+		if(aCode.GetCode() == KEY_SPACE )
+		{			
+			bUsed = sal_True;
+		    sal_uInt16 nType;
+		    sal_uLong nChild;
+		    SvLBoxEntry* pEntry = GetCurEntry();
+		    GetEntryIndexes( nType, nChild, pEntry );
+		    if( pEntry && (nType != SC_CONTENT_ROOT) && (nChild != SC_CONTENT_NOCHILD) )
+			{
+				if ( bHiddenDoc )
+					return ;				//! spaeter...
+		              String aText( GetEntryText( pEntry ) );
+				sKeyString = aText;
+				if ( aManualDoc.Len() )
+					pParentWindow->SetCurrentDoc( aManualDoc );
+				switch( nType )
+				{
+				    case SC_CONTENT_OLEOBJECT:
+					case SC_CONTENT_GRAPHIC:
+					case SC_CONTENT_DRAWING:
+					{
+						Window* pWindow=(Window*)GetParent(pEntry);
+						ScNavigatorDlg* pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
+						ScTabViewShell* pScTabViewShell = NULL;
+						ScDrawView* pScDrawView = NULL;
+						if (pScNavigatorDlg!=NULL)
+							  pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
+						if(pScTabViewShell !=NULL)
+							  pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+						if(pScDrawView!=NULL)
+						 {
+							pScDrawView->SelectCurrentViewObject(aText );
+							sal_Bool bHasMakredObject = sal_False;
+							SvLBoxEntry* pParent = pRootNodes[nType];
+							SvLBoxEntry* pBeginEntry = NULL;
+							if( pParent )
+								pBeginEntry = FirstChild(pParent);
+							while( pBeginEntry )
+							{
+								String aTempText( GetEntryText( pBeginEntry ) );
+								 if( pScDrawView->GetObjectIsMarked( pScDrawView->GetObjectByName( aTempText ) ) )
+								 {
+									bHasMakredObject = sal_True;
+									break;
+								  }
+								pBeginEntry =  Next( pBeginEntry );
+							}
+							if(  !bHasMakredObject && pScTabViewShell)
+								pScTabViewShell->SetDrawShell(sal_False);
+							ObjectFresh( nType,pEntry );
+						}							 	       					
+					}				
+		            break;
+			     }
+			}
+		   }
+	   }
+    //StoreSettings();
+    //-----IAccessibility2 Implementation 2009
 
     if( !bUsed )
+    //IAccessibility2 Implementation 2009-----
+	{
+		if(aCode.GetCode() == KEY_F5 )
+		{
+			StoreSettings();
 		SvTreeListBox::KeyInput(rKEvt);
+		}
+		else
+		{
+			SvTreeListBox::KeyInput(rKEvt);
+			StoreSettings();
+		}
+	}
+    //-----IAccessibility2 Implementation 2009
 }
 
 //sal_Bool __EXPORT ScContentTree::Drop( const DropEvent& rEvt )
@@ -607,6 +767,56 @@
 	return NULL;
 }
 
+//IAccessibility2 Implementation 2009-----
+//Solution: move along and draw "*" sign .
+void ScContentTree::ObjectFresh( sal_uInt16 nType,SvLBoxEntry* pEntry )
+{
+	if ( bHiddenDoc && !pHiddenDocument )
+		return;		// anderes Dokument angezeigt
+      if(nType ==SC_CONTENT_GRAPHIC||nType ==SC_CONTENT_OLEOBJECT||nType ==SC_CONTENT_DRAWING)
+      	{
+		SetUpdateMode(sal_False);
+		ClearType( nType );
+		/*sal_uInt16 nId = OBJ_GRAF;
+		switch( nType ) 
+		{
+			case SC_CONTENT_OLEOBJECT:
+				nId = OBJ_OLE2;
+				break;
+			case SC_CONTENT_DRAWING:
+				nId = OBJ_GRUP;
+				break;
+		}*/
+		GetDrawNames( nType/*, nId*/ );
+		if( !pEntry )
+			ApplySettings();  
+		SetUpdateMode(sal_True);
+		if( pEntry )
+		{
+			SvLBoxEntry* pParent = pRootNodes[nType];
+			SvLBoxEntry* pBeginEntry = NULL;
+			SvLBoxEntry* pOldEntry = NULL;
+			if( pParent )
+				pBeginEntry = FirstChild(pParent);
+			while( pBeginEntry )
+			{
+				String aTempText( GetEntryText( pBeginEntry ) );
+				 if( aTempText ==  sKeyString )
+				 {
+					pOldEntry = pBeginEntry;
+					break;
+				  }
+				pBeginEntry =  Next( pBeginEntry );
+			}
+			if( pOldEntry )
+			{
+				Expand(pParent);
+				Select( pOldEntry,sal_True);
+			}
+		}
+      	}	
+}
+//-----IAccessibility2 Implementation 2009
 void ScContentTree::Refresh( sal_uInt16 nType )
 {
 	if ( bHiddenDoc && !pHiddenDocument )
@@ -793,9 +1003,46 @@
 					{
 						String aName = ScDrawLayer::GetVisibleName( pObject );
 						if (aName.Len())
-							InsertContent( nType, aName );
+						{
+							//IAccessibility2 Implementation 2009-----
+							//InsertContent( nType, aName );
+							if( bisInNavigatoeDlg )
+							{
+								if (nType >= SC_CONTENT_COUNT)
+								{
+									DBG_ERROR("ScContentTree::InsertContent mit falschem Typ");
+									return;
 					}
-
+								SvLBoxEntry* pParent = pRootNodes[nType];
+								if (pParent)
+								{
+									SvLBoxEntry* pChild=InsertEntry( aName, pParent );
+									if(pChild)
+											pChild->SetMarked( sal_False);
+									Window* pWindow=NULL;
+									ScTabViewShell* pScTabViewShell=NULL;
+									ScDrawView* pScDrawView=NULL;
+									ScNavigatorDlg* pScNavigatorDlg=NULL;
+									if(pChild)
+										 pWindow=(Window*)GetParent(pChild);
+									if(pWindow)
+											pScNavigatorDlg = (ScNavigatorDlg*)pWindow;
+									if (pScNavigatorDlg!=NULL)
+										  pScTabViewShell=pScNavigatorDlg->GetTabViewShell();
+									if(pScTabViewShell !=NULL)
+										  pScDrawView =pScTabViewShell->GetViewData()->GetScDrawView();
+									if(pScDrawView!=NULL)
+									 {
+										 sal_Bool bMarked =pScDrawView->GetObjectIsMarked(pObject);
+										 pChild->SetMarked( bMarked );
+									  }									 	       
+								}//end if parent						
+								else
+									DBG_ERROR("InsertContent ohne Parent");
+							}
+						}
+					}
+					//-----IAccessibility2 Implementation 2009
 					pObject = aIter.Next();
 				}
 			}
@@ -1515,7 +1762,50 @@
     }
 }
 
+//IAccessibility2 Implementation 2009-----
+class ScContentLBoxString : public SvLBoxString
+{
+public:
+	ScContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
+		const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr)	{}
 
+	virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+		SvLBoxEntry* pEntry);
+};
+void ScContentTree::InitEntry(SvLBoxEntry* pEntry,
+		const XubString& rStr ,const Image& rImg1,const Image& rImg2, SvLBoxButtonKind eButtonKind)
+{
+	sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
+	SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+	SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
+	ScContentLBoxString* pStr = new ScContentLBoxString( pEntry, 0, pCol->GetText() );
+	pEntry->ReplaceItem( pStr, nColToHilite );
+}
+void ScContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+	SvLBoxEntry* pEntry )
+{
+	// IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+	/*
+	if (pEntry->IsMarked())
+	{
+			rDev.DrawText( rPos, GetText() );
+			XubString str;
+			str = XubString::CreateFromAscii("*");
+			Point rPosStar(rPos.X()-6,rPos.Y());
+			Font aOldFont( rDev.GetFont());
+			Font aFont(aOldFont);
+			Color aCol( aOldFont.GetColor() );
+			aCol.DecreaseLuminance( 200 );
+			aFont.SetColor( aCol );
+			rDev.SetFont( aFont );
+			rDev.DrawText( rPosStar, str);
+			rDev.SetFont( aOldFont );
+	}
+	else 
+	*/
+		SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
+}
+//-----IAccessibility2 Implementation 2009
 //
 //------------------------------------------------------------------------
 //
diff --git a/main/sc/source/ui/navipi/navipi.cxx b/main/sc/source/ui/navipi/navipi.cxx
index 844147b..a31b2a3 100644
--- a/main/sc/source/ui/navipi/navipi.cxx
+++ b/main/sc/source/ui/navipi/navipi.cxx
@@ -785,6 +785,9 @@
         aTbxCmd.Select(IID_ZOOMOUT);
         aTbxCmd.RemoveItem(aTbxCmd.GetItemPos(IID_ZOOMOUT));
     }
+	//IAccessibility2 Implementation 2009-----
+	aLbEntries.SetNavigatorDlgFlag(sal_True);
+	//-----IAccessibility2 Implementation 2009
 }
 
 //------------------------------------------------------------------------
@@ -983,7 +986,13 @@
 				case FID_ANYDATACHANGED:
 					aContentTimer.Start();		// Notizen nicht sofort suchen
 					break;
-
+				//IAccessibility2 Implementation 2009-----
+				case FID_KILLEDITVIEW:
+					aLbEntries.ObjectFresh( SC_CONTENT_OLEOBJECT );
+					aLbEntries.ObjectFresh( SC_CONTENT_DRAWING );
+					aLbEntries.ObjectFresh( SC_CONTENT_GRAPHIC );
+				      break;
+				//-----IAccessibility2 Implementation 2009
 				default:
 					break;
 			}
diff --git a/main/sc/source/ui/pagedlg/scuitphfedit.cxx b/main/sc/source/ui/pagedlg/scuitphfedit.cxx
index 5fe86bc..0448ed8 100644
--- a/main/sc/source/ui/pagedlg/scuitphfedit.cxx
+++ b/main/sc/source/ui/pagedlg/scuitphfedit.cxx
@@ -166,6 +166,18 @@
 	aWndCenter. SetFont( aPatAttr );
 	aWndRight.	SetFont( aPatAttr );
 
+	//IAccessibility2 Implementation 2009-----
+	aWndLeft.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+	aWndCenter.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+	aWndRight.SetObjectSelectHdl( LINK(this,ScHFEditPage,ObjectSelectHdl) );
+	aBtnText.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnFile.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnTable.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnPage.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnLastPage.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnDate.SetAccessibleRelationMemberOf( &maFtCustomHF );
+	aBtnTime.SetAccessibleRelationMemberOf( &maFtCustomHF );	
+	//-----IAccessibility2 Implementation 2009
 	FillCmdArr();
 
 	aWndLeft.GrabFocus();
@@ -174,6 +186,14 @@
 
 	FreeResource();
 }
+	//IAccessibility2 Implementation 2009-----
+    IMPL_LINK( ScHFEditPage, ObjectSelectHdl, ScEditWindow*, pEdit )
+	{
+		(void)pEdit;
+	    aBtnText.GrabFocus();
+	    return NULL;	
+	}
+	//-----IAccessibility2 Implementation 2009
 
 // -----------------------------------------------------------------------
 
diff --git a/main/sc/source/ui/pagedlg/tphfedit.cxx b/main/sc/source/ui/pagedlg/tphfedit.cxx
index 3e2223f..86c07b4 100644
--- a/main/sc/source/ui/pagedlg/tphfedit.cxx
+++ b/main/sc/source/ui/pagedlg/tphfedit.cxx
@@ -553,6 +553,10 @@
 	Control::Paint(	rRec );
 
 	pEdView->Paint( rRec );
+	//IAccessibility2 Implementation 2009-----
+	if( HasFocus() )
+		pEdView->ShowCursor(sal_True,sal_True);
+	//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
@@ -594,6 +598,14 @@
 	{
 		Control::KeyInput( rKEvt );
 	}
+	//IAccessibility2 Implementation 2009-----
+	else if ( !rKEvt.GetKeyCode().IsMod1() && !rKEvt.GetKeyCode().IsShift() &&
+		    	rKEvt.GetKeyCode().IsMod2() && rKEvt.GetKeyCode().GetCode() == KEY_DOWN )
+	{
+		if (aObjectSelectLink.IsSet() )			
+			aObjectSelectLink.Call(this);
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
@@ -607,6 +619,9 @@
 
 void __EXPORT ScEditWindow::GetFocus()
 {
+	//IAccessibility2 Implementation 2009-----
+	pEdView->ShowCursor(sal_True,sal_True);
+	//-----IAccessibility2 Implementation 2009
 	pActiveEdWnd = this;
 
     ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTemp = xAcc;
diff --git a/main/sc/source/ui/view/drawview.cxx b/main/sc/source/ui/view/drawview.cxx
index 1a32385..3640ccf 100644
--- a/main/sc/source/ui/view/drawview.cxx
+++ b/main/sc/source/ui/view/drawview.cxx
@@ -689,6 +689,90 @@
 #pragma optimize ( "", on )
 #endif
 
+//IAccessibility2 Implementation 2009-----
+SdrObject* ScDrawView::GetObjectByName(const String& rName)
+{
+	SfxObjectShell*	pShell = pDoc->GetDocumentShell();
+	if (pShell)
+	{
+		SdrModel* pDrawLayer = GetModel();
+		sal_uInt16 nTabCount = pDoc->GetTableCount();
+		for (sal_uInt16 i=0; i<nTabCount; i++)
+		{
+			SdrPage* pPage = pDrawLayer->GetPage(i);
+			DBG_ASSERT(pPage,"Page ?");
+			if (pPage)
+			{
+				SdrObjListIter aIter( *pPage, IM_DEEPNOGROUPS );
+				SdrObject* pObject = aIter.Next();
+				while (pObject)
+				{
+					if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
+					{
+						return pObject;
+					}
+					pObject = aIter.Next();
+				}
+			}
+		}
+	}
+	return 0;
+}
+//Solution: realize multi-selection of objects
+//==================================================
+sal_Bool ScDrawView::SelectCurrentViewObject( const String& rName )
+{
+	sal_uInt16 nObjectTab = 0;
+	SdrObject* pFound = NULL;
+       sal_Bool bUnMark=sal_False;
+	SfxObjectShell*	pShell = pDoc->GetDocumentShell();
+	if (pShell)
+	{
+		SdrModel* pDrawLayer = GetModel();
+		sal_uInt16 nTabCount = pDoc->GetTableCount();
+		for (sal_uInt16 i=0; i<nTabCount && !pFound; i++)
+		{
+			SdrPage* pPage = pDrawLayer->GetPage(i);
+			DBG_ASSERT(pPage,"Page ?");
+			if (pPage)
+			{
+				SdrObjListIter aIter( *pPage, IM_DEEPWITHGROUPS );
+				SdrObject* pObject = aIter.Next();
+				while (pObject && !pFound)
+				{
+					if ( ScDrawLayer::GetVisibleName( pObject ) == rName )
+					{
+						pFound = pObject;
+						nObjectTab = i;
+					}
+					pObject = aIter.Next();
+				}
+			}
+		}
+	}
+	if ( pFound )
+	{
+		ScTabView* pView = pViewData->GetView();
+		if ( nObjectTab != nTab )								// Tabelle umschalten
+			pView->SetTabNo( nObjectTab );
+		DBG_ASSERT( nTab == nObjectTab, "Tabellen umschalten hat nicht geklappt" );
+		pView->ScrollToObject( pFound );
+		if ( pFound->GetLayer() == SC_LAYER_BACK &&
+				!pViewData->GetViewShell()->IsDrawSelMode() &&
+				!pDoc->IsTabProtected( nTab ) &&
+				!pViewData->GetSfxDocShell()->IsReadOnly() )
+		{
+			SdrLayer* pLayer = GetModel()->GetLayerAdmin().GetLayerPerID(SC_LAYER_BACK);
+			if (pLayer)
+				SetLayerLocked( pLayer->GetName(), sal_False );
+		}
+		SdrPageView* pPV = GetSdrPageView();
+              bUnMark = IsObjMarked(pFound);
+	       MarkObj( pFound, pPV, bUnMark);
+	}
+	return ( bUnMark );
+}
+//-----IAccessibility2 Implementation 2009
 sal_Bool ScDrawView::SelectObject( const String& rName )
 {
 	UnmarkAll();
@@ -750,6 +834,19 @@
 	return ( pFound != NULL );
 }
 
+//IAccessibility2 Implementation 2009-----
+//Solution: If  object  is marked , return true , else return false . 
+//==================================================
+sal_Bool ScDrawView::GetObjectIsMarked(  SdrObject* pObject  )
+{
+       sal_Bool bisMarked =false;
+	if (pObject )
+	{
+	      bisMarked = IsObjMarked(pObject);
+	}
+	return  bisMarked;
+}
+//-----IAccessibility2 Implementation 2009
 //UNUSED2008-05  String ScDrawView::GetSelectedChartName() const
 //UNUSED2008-05  {
 //UNUSED2008-05      //  used for modifying a chart's data area - PersistName must always be used
diff --git a/main/sc/source/ui/view/gridwin.cxx b/main/sc/source/ui/view/gridwin.cxx
index 47224e8..9ee5f1f 100644
--- a/main/sc/source/ui/view/gridwin.cxx
+++ b/main/sc/source/ui/view/gridwin.cxx
@@ -866,6 +866,45 @@
 	CaptureMouse();
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool ScGridWindow::HasScenarioRange( sal_uInt16 nCol, sal_Int32 nRow, ScRange& rScenRange )
+{
+	ScDocument* pDoc = pViewData->GetDocument();
+	sal_uInt16 nTab = pViewData->GetTabNo();
+	sal_uInt16 nTabCount = pDoc->GetTableCount();
+	if ( nTab+1<nTabCount && pDoc->IsScenario(nTab+1) && !pDoc->IsScenario(nTab) )
+	{
+		sal_uInt16 i;
+		ScMarkData aMarks;
+		for (i=nTab+1; i<nTabCount && pDoc->IsScenario(i); i++)
+			pDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME );
+		ScRangeList aRanges;
+		aMarks.FillRangeListWithMarks( &aRanges, sal_False );
+		sal_uInt16 nRangeCount = (sal_uInt16)aRanges.Count();
+		for (i=0; i<nRangeCount; i++)
+		{
+			ScRange aRange = *aRanges.GetObject(i);
+			pDoc->ExtendTotalMerge( aRange );
+			sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 );
+			sal_Bool bIsInScen = sal_False;
+			if ( bTextBelow )
+			{
+				bIsInScen = (aRange.aStart.Col() == nCol && aRange.aEnd.Row() == nRow-1);
+			}
+			else
+			{
+				bIsInScen = (aRange.aStart.Col() == nCol && aRange.aStart.Row() == nRow+1);
+			}
+			if (bIsInScen)
+			{
+				rScenRange = aRange;
+				return sal_True;
+			}
+		}
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
 void ScGridWindow::DoAutoFilterMenue( SCCOL nCol, SCROW nRow, sal_Bool bDataSelect )
 {
 	delete pFilterBox;
@@ -2234,6 +2273,9 @@
 
 			pViewData->GetView()->InvalidateAttribs();
 		}
+//IAccessibility2 Implementation 2009-----
+		pViewData->GetViewShell()->SelectionChanged();
+//-----IAccessibility2 Implementation 2009
 		return;
 	}
 }
@@ -3068,7 +3110,9 @@
         if( !rKeyCode.GetModifier() && (rKeyCode.GetCode() == KEY_F2) )
         {
             SC_MOD()->EndReference();
-            return;
+//IAccessibility2 Implementation 2009-----
+            //return;
+//-----IAccessibility2 Implementation 2009
         }
         else if( pViewData->GetViewShell()->MoveCursorKeyInput( rKEvt ) )
         {
@@ -3076,8 +3120,14 @@
                 pViewData->GetRefStartX(), pViewData->GetRefStartY(), pViewData->GetRefStartZ(),
                 pViewData->GetRefEndX(), pViewData->GetRefEndY(), pViewData->GetRefEndZ() );
             SC_MOD()->SetReference( aRef, pViewData->GetDocument() );
-            return;
+//IAccessibility2 Implementation 2009-----
+            //return;
+//-----IAccessibility2 Implementation 2009
         }
+//IAccessibility2 Implementation 2009-----
+		pViewData->GetViewShell()->SelectionChanged();
+		return ;
+//-----IAccessibility2 Implementation 2009
     }
 	// wenn semi-Modeless-SfxChildWindow-Dialog oben, keine KeyInputs:
     else if( !pViewData->IsAnyFillMode() )
diff --git a/main/sc/source/ui/view/gridwin3.cxx b/main/sc/source/ui/view/gridwin3.cxx
index 742881f..e287a9d 100644
--- a/main/sc/source/ui/view/gridwin3.cxx
+++ b/main/sc/source/ui/view/gridwin3.cxx
@@ -179,6 +179,10 @@
 					if ( !bOldMarked &&
 						rKEvt.GetKeyCode().GetCode() == KEY_DELETE )
 						bUsed = sal_False;					// nichts geloescht
+//IAccessibility2 Implementation 2009-----
+					if(bOldMarked)
+						GetFocus();					
+//-----IAccessibility2 Implementation 2009
 				}
 			if (!bLeaveDraw)
 				UpdateStatusPosSize();		// #108137# for moving/resizing etc. by keyboard
diff --git a/main/sc/source/ui/view/gridwin5.cxx b/main/sc/source/ui/view/gridwin5.cxx
index 965508d..102ce06 100644
--- a/main/sc/source/ui/view/gridwin5.cxx
+++ b/main/sc/source/ui/view/gridwin5.cxx
@@ -58,6 +58,9 @@
 #include "tabvwsh.hxx"
 #include "userdat.hxx"
 #include "postit.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <vcl/svapp.hxx>
+//-----IAccessibility2 Implementation 2009
 
 // -----------------------------------------------------------------------
 
@@ -423,13 +426,42 @@
 com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
 	ScGridWindow::CreateAccessible()
 {
+//IAccessibility2 Implementation 2009-----
+	com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc= GetAccessible(sal_False);
+	if (xAcc.is())
+	{
+		return xAcc;
+	}
+//-----IAccessibility2 Implementation 2009
 	ScAccessibleDocument* pAccessibleDocument =
 		new ScAccessibleDocument(GetAccessibleParentWindow()->GetAccessible(),
 			pViewData->GetViewShell(), eWhich);
-
-	com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccessible = pAccessibleDocument;
+//IAccessibility2 Implementation 2009-----
+	//com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccessible = pAccessibleDocument;
+	xAcc = pAccessibleDocument;
+	SetAccessible(xAcc);
+//-----IAccessibility2 Implementation 2009
 
 	pAccessibleDocument->Init();
-
-	return xAccessible;
+//IAccessibility2 Implementation 2009-----
+	//return xAccessible;
+	return xAcc;
+//-----IAccessibility2 Implementation 2009
 }
+//IAccessibility2 Implementation 2009-----
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void ScGridWindow::SwitchView()
+{
+	if (!Application::IsAccessibilityEnabled())
+	{
+		return ;
+	}
+	ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
+	if (pAccDoc)
+	{
+		pAccDoc->SwitchViewFireFocus();
+	}		
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sc/source/ui/view/output.cxx b/main/sc/source/ui/view/output.cxx
index d124740..3149b86 100644
--- a/main/sc/source/ui/view/output.cxx
+++ b/main/sc/source/ui/view/output.cxx
@@ -80,6 +80,9 @@
 //	Hilfsklasse, fuer die Farbzuordnung,
 //	um nicht mehrfach hintereinander denselben User aus der Liste zu suchen
 
+//IAccessibility2 Implementation 2009-----
+//Move this class declare to Chgtrack.hxx
+/*
 class ScActionColorChanger
 {
 private:
@@ -96,6 +99,8 @@
 	void		Update( const ScChangeAction& rAction );
 	ColorData	GetColor() const	{ return nColor; }
 };
+*/
+//-----IAccessibility2 Implementation 2009
 
 //------------------------------------------------------------------
 
diff --git a/main/sc/source/ui/view/preview.cxx b/main/sc/source/ui/view/preview.cxx
index 7cdac56..fa079bc 100644
--- a/main/sc/source/ui/view/preview.cxx
+++ b/main/sc/source/ui/view/preview.cxx
@@ -1474,13 +1474,42 @@
 
 com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> ScPreview::CreateAccessible()
 {
+//IAccessibility2 Implementation 2009-----
+	com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> xAcc= GetAccessible(sal_False);
+	if (xAcc.is())
+	{
+		return xAcc;
+	}
+//-----IAccessibility2 Implementation 2009
 	ScAccessibleDocumentPagePreview* pAccessible =
 		new ScAccessibleDocumentPagePreview( GetAccessibleParentWindow()->GetAccessible(), pViewShell );
-	com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xAccessible = pAccessible;
+//IAccessibility2 Implementation 2009-----
+	//com::sun::star::uno::Reference < com::sun::star::accessibility::XAccessible > xAccessible = pAccessible;
+	xAcc = pAccessible;
+	SetAccessible(xAcc);
+//-----IAccessibility2 Implementation 2009
 	pAccessible->Init();
-	return xAccessible;
+//IAccessibility2 Implementation 2009-----
+	//return xAccessible;
+	return xAcc;
+//-----IAccessibility2 Implementation 2009
 }
-
+//IAccessibility2 Implementation 2009-----
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void ScPreview::SwitchView()
+{
+	if (!Application::IsAccessibilityEnabled())
+	{
+		return ;
+	}
+	ScAccessibleDocumentBase* pAccDoc = static_cast<ScAccessibleDocumentBase*>(GetAccessible(sal_False).get());
+	if (pAccDoc)
+	{
+		pAccDoc->SwitchViewFireFocus();
+	}		
+}
+//-----IAccessibility2 Implementation 2009
 //Issue51656 Add resizeable margin on page preview from maoyg
 void ScPreview::DragMove( long nDragMovePos, sal_uInt16 nFlags )
 {
diff --git a/main/sc/source/ui/view/select.cxx b/main/sc/source/ui/view/select.cxx
index dc8f378..bceb17d 100644
--- a/main/sc/source/ui/view/select.cxx
+++ b/main/sc/source/ui/view/select.cxx
@@ -369,6 +369,9 @@
 			}
 
 			pView->UpdateRef( nPosX, nPosY, pViewData->GetTabNo() );
+//IAccessibility2 Implementation 2009-----
+			pView->SelectionChanged();
+//-----IAccessibility2 Implementation 2009
 		}
 	}
 	else if (pViewData->IsFillMode() ||
diff --git a/main/sc/source/ui/view/tabview2.cxx b/main/sc/source/ui/view/tabview2.cxx
index 12c9c49..4526fa0 100644
--- a/main/sc/source/ui/view/tabview2.cxx
+++ b/main/sc/source/ui/view/tabview2.cxx
@@ -118,7 +118,7 @@
 }
 
 void ScTabView::InitBlockMode( SCCOL nCurX, SCROW nCurY, SCTAB nCurZ,
-								sal_Bool bTestNeg, sal_Bool bCols, sal_Bool bRows )
+								sal_Bool bTestNeg, sal_Bool bCols, sal_Bool bRows, sal_Bool bForceNeg )
 {
 	if (!bIsBlockMode)
 	{
@@ -129,7 +129,11 @@
 		SCTAB nTab = aViewData.GetTabNo();
 
 		//	Teil von Markierung aufheben?
-		if (bTestNeg)
+//IAccessibility2 Implementation 2009-----
+		if (bForceNeg)
+			bBlockNeg = sal_True;
+//-----IAccessibility2 Implementation 2009
+		else if (bTestNeg)
 		{
 			if ( bCols )
 				bBlockNeg = rMark.IsColumnMarked( nCurX );
diff --git a/main/sc/source/ui/view/tabvwsh.cxx b/main/sc/source/ui/view/tabvwsh.cxx
index 7e8f2b4..0ecc7b8 100644
--- a/main/sc/source/ui/view/tabvwsh.cxx
+++ b/main/sc/source/ui/view/tabvwsh.cxx
@@ -41,6 +41,11 @@
 #include <sfx2/sidebar/SidebarChildWindow.hxx>
 #include <avmedia/mediaplayer.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include "cell.hxx"
+#include "docoptio.hxx"
+//-----IAccessibility2 Implementation 2009
+
 #include "tabvwsh.hxx"
 #include "docsh.hxx"
 #include "reffact.hxx"
@@ -106,3 +111,20 @@
     GetViewFrame()->GetBindings().Invalidate(SID_DRAW_TEXT_MARQUEE);
     return 0;
 }
+
+//IAccessibility2 Implementation 2009-----
+rtl::OUString ScTabViewShell::GetFormula(ScAddress& rAddress)
+{
+	String sFormula;
+	ScDocument* pDoc = GetViewData()->GetDocument();
+	ScBaseCell* pCell = pDoc->GetCell(rAddress);
+	if (pCell && pCell->GetCellType()==CELLTYPE_FORMULA)
+	{
+		static_cast<ScFormulaCell*>(pCell)->GetFormula(sFormula);
+	}
+	return sFormula;
+}
+//-----IAccessibility2 Implementation 2009
+
+
+
diff --git a/main/sc/source/ui/view/tabvwsh4.cxx b/main/sc/source/ui/view/tabvwsh4.cxx
index f0e9c8a..098af63 100644
--- a/main/sc/source/ui/view/tabvwsh4.cxx
+++ b/main/sc/source/ui/view/tabvwsh4.cxx
@@ -93,6 +93,9 @@
 #include "sc.hrc" //CHINA001
 #include "scabstdlg.hxx" //CHINA001
 #include "externalrefmgr.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <svx/fmpage.hxx>
+//-----IAccessibility2 Implementation 2009
 
 void ActivateOlk( ScViewData* pViewData );
 void DeActivateOlk( ScViewData* pViewData );
@@ -112,7 +115,9 @@
 void __EXPORT ScTabViewShell::Activate(sal_Bool bMDI)
 {
 	SfxViewShell::Activate(bMDI);
-
+//IAccessibility2 Implementation 2009-----
+	bIsActive = sal_True;
+//-----IAccessibility2 Implementation 2009
 	//	hier kein GrabFocus, sonst gibt's Probleme wenn etwas inplace editiert wird!
 
 	if ( bMDI )
@@ -242,7 +247,9 @@
 	}
 
 	SfxViewShell::Deactivate(bMDI);
-
+//IAccessibility2 Implementation 2009-----
+	bIsActive = sal_False;
+//-----IAccessibility2 Implementation 2009
 	ScInputHandler* pHdl = SC_MOD()->GetInputHdl(this);
 
 	if( bMDI )
@@ -1481,6 +1488,52 @@
 		}
 	}
 
+//IAccessibility2 Implementation 2009-----
+	// use Ctrl+Alt+Shift+arrow keys to move the cursor in cells 
+	// while keeping the last selection
+	if ( !bUsed && bAlt && bControl && bShift)
+	{
+		sal_uInt16 nSlotId = 0;
+		switch (nCode)
+		{
+			case KEY_UP:
+				nSlotId = SID_CURSORUP;
+				break;
+			case KEY_DOWN:
+				nSlotId = SID_CURSORDOWN;
+				break;
+			case KEY_LEFT:
+				nSlotId = SID_CURSORLEFT;
+				break;
+			case KEY_RIGHT:
+				nSlotId = SID_CURSORRIGHT;
+				break;
+			case KEY_PAGEUP:
+				nSlotId = SID_CURSORPAGEUP;
+				break;
+			case KEY_PAGEDOWN:
+				nSlotId = SID_CURSORPAGEDOWN;
+				break;
+			case KEY_HOME:
+				nSlotId = SID_CURSORHOME;
+				break;
+			case KEY_END:
+				nSlotId = SID_CURSOREND;
+				break;
+			default:
+				nSlotId = 0;
+				break;
+		}
+		if ( nSlotId )
+		{
+			sal_uInt16 nMode = GetLockedModifiers();
+			LockModifiers(KEY_MOD1);
+			GetViewData()->GetDispatcher().Execute( nSlotId, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD );
+			LockModifiers(nMode);
+			bUsed = sal_True;
+		}
+	}
+//-----IAccessibility2 Implementation 2009
 	if (bHideCursor)
 		ShowAllCursors();
 
@@ -1556,6 +1609,9 @@
 	ScDocument* pDoc = pDocSh->GetDocument();
 
 	bReadOnly = pDocSh->IsReadOnly();
+//IAccessibility2 Implementation 2009-----
+	bIsActive = sal_False;
+//-----IAccessibility2 Implementation 2009
 
 	SetName( String::CreateFromAscii(RTL_CONSTASCII_STRINGPARAM("View")) );	// fuer SBX
 	Color aColBlack( COL_BLACK );
@@ -1980,3 +2036,13 @@
 
 
 
+//IAccessibility2 Implementation 2009-----
+const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & ScTabViewShell::GetForms() const
+{
+	if( !pFormShell || !pFormShell->GetCurPage() ){
+		static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > aRef;
+		return aRef;
+	}
+	return pFormShell->GetCurPage()->GetForms();
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sc/source/ui/view/tabvwshe.cxx b/main/sc/source/ui/view/tabvwshe.cxx
index 9d23e16..1e86709 100644
--- a/main/sc/source/ui/view/tabvwshe.cxx
+++ b/main/sc/source/ui/view/tabvwshe.cxx
@@ -48,6 +48,9 @@
 #include "editsh.hxx"
 #include "dociter.hxx"
 #include "inputhdl.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <svx/srchdlg.hxx>
+//-----IAccessibility2 Implementation 2009
 #include "document.hxx"
 
 //==================================================================
@@ -254,7 +257,29 @@
 					const SvxSearchItem* pSearchItem = (const SvxSearchItem*) pItem;
 
 					ScGlobal::SetSearchItem( *pSearchItem );
-					SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() );
+					//IAccessibility2 Implementation 2009-----
+					//SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() );
+					sal_Bool bSuccess = SearchAndReplace( pSearchItem, sal_True, rReq.IsAPI() );
+					if ( Application::IsAccessibilityEnabled() )
+					{
+						SvxSearchDialog* pSearchDlg = 
+							((SvxSearchDialog*)(SfxViewFrame::Current()->GetChildWindow(
+							SvxSearchDialogWrapper::GetChildWindowId())->GetWindow()));
+						if( pSearchDlg )
+						{
+							ScTabView* pTabView = GetViewData()->GetView();
+							if( pTabView )
+							{
+								Window* pWin = pTabView->GetActiveWin();
+								if( pWin )
+								{
+									pSearchDlg->SetDocWin( pWin );
+									pSearchDlg->SetSrchFlag( bSuccess );
+								}
+							}
+						}
+					}
+					//-----IAccessibility2 Implementation 2009
 					rReq.Done();
 				}
 			}
@@ -306,6 +331,27 @@
 							rReq.IsAPI() ? SFX_CALLMODE_API|SFX_CALLMODE_SYNCHRON :
 											SFX_CALLMODE_STANDARD,
 							&aSearchItem, 0L );
+					//IAccessibility2 Implementation 2009-----
+					if ( Application::IsAccessibilityEnabled() )
+					{
+						SvxSearchDialog* pSearchDlg = 
+							((SvxSearchDialog*)(SfxViewFrame::Current()->GetChildWindow(
+							SvxSearchDialogWrapper::GetChildWindowId())->GetWindow()));
+						if( pSearchDlg )
+						{
+							ScTabView* pTabView = GetViewData()->GetView();
+							if( pTabView )
+							{
+								Window* pWin = pTabView->GetActiveWin();
+								if( pWin )
+								{
+									pSearchDlg->SetDocWin( pWin );
+									pSearchDlg->SetSrchFlag();
+								}
+							}
+						}	
+					}
+					//-----IAccessibility2 Implementation 2009
 				}
 				else
 				{
diff --git a/main/sc/source/ui/view/viewfun2.cxx b/main/sc/source/ui/view/viewfun2.cxx
index a1f984a..aaa4a2a 100644
--- a/main/sc/source/ui/view/viewfun2.cxx
+++ b/main/sc/source/ui/view/viewfun2.cxx
@@ -1616,8 +1616,11 @@
 //----------------------------------------------------------------------------
 //	Suchen & Ersetzen
 
-void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
+//IAccessibility2 Implementation 2009-----
+//void ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
+sal_Bool ScViewFunc::SearchAndReplace( const SvxSearchItem* pSearchItem,
 										sal_Bool bAddUndo, sal_Bool bIsApi )
+//-----IAccessibility2 Implementation 2009
 {
 	ScDocShell* pDocSh = GetViewData()->GetDocShell();
 	ScDocument* pDoc = pDocSh->GetDocument();
@@ -1669,7 +1672,10 @@
 				if ( pOldSelectedTables )
 					delete [] pOldSelectedTables;
 				ErrorMessage(STR_PROTECTIONERR);
-				return;
+				//IAccessibility2 Implementation 2009-----
+				//return;
+				return sal_False;
+				//-----IAccessibility2 Implementation 2009
 			}
 		}
 	}
@@ -1843,6 +1849,9 @@
 
 	delete pUndoDoc;			// loeschen wenn nicht benutzt
 	delete pUndoMark;			// kann immer geloescht werden
+//IAccessibility2 Implementation 2009-----
+	return bFound;
+//-----IAccessibility2 Implementation 2009
 }
 
 
diff --git a/main/scp2/source/ooo/file_library_ooo.scp b/main/scp2/source/ooo/file_library_ooo.scp
index 726783b..cd94075 100644
--- a/main/scp2/source/ooo/file_library_ooo.scp
+++ b/main/scp2/source/ooo/file_library_ooo.scp
@@ -22,6 +22,21 @@
 
 #include "macros.inc"
 
+// IAccessible2 implementation
+#if defined(WNT) && !defined(DISABLE_ATL)
+File gid_File_Lib_Winaccessibility
+	TXT_FILE_BODY;
+	Styles	= (PACKED);
+	Dir	= SCP2_OOO_BIN_DIR;
+	Name	= "winaccessibility.dll";
+End
+File gid_File_Lib_UAccCOM
+	BIN_FILE_BODY;
+	Styles	= (PACKED);
+	Dir	= SCP2_OOO_BIN_DIR;
+	Name	= "UAccCOM.dll";
+End
+#endif
 #ifdef WNT
 File gid_File_Lib_Accessbridge
     BIN_FILE_BODY;
diff --git a/main/scp2/source/ooo/module_hidden_ooo.scp b/main/scp2/source/ooo/module_hidden_ooo.scp
index d014a3a..3f8d2ea 100644
--- a/main/scp2/source/ooo/module_hidden_ooo.scp
+++ b/main/scp2/source/ooo/module_hidden_ooo.scp
@@ -388,6 +388,8 @@
 	gid_File_Lib_Stdc_3,
 	gid_File_Lib_Stdc_5,
 	gid_File_Lib_Accessbridge,
+	gid_File_Lib_Winaccessibility,
+	gid_File_Lib_UAccCOM,
 	gid_File_Lib_Ado,
 	gid_File_Lib_Dl,
 	gid_File_Lib_Dnd,
diff --git a/main/sd/inc/drawdoc.hxx b/main/sd/inc/drawdoc.hxx
index 8f4ee83..7316251 100644
--- a/main/sd/inc/drawdoc.hxx
+++ b/main/sd/inc/drawdoc.hxx
@@ -157,6 +157,18 @@
 class SdDrawDocument : public FmFormModel
 {
 private:
+//IAccessibility2 Implementation 2009-----
+	String msDocAccTitle;
+public:
+	virtual void setDocAccTitle( const String& rTitle ) { msDocAccTitle = rTitle; }
+	virtual const String getDocAccTitle() const { return msDocAccTitle; }
+private:	
+	sal_Bool bReadOnly;
+public:
+	virtual void setDocReadOnly( sal_Bool b){ bReadOnly = b; }
+	virtual sal_Bool getDocReadOnly() const { return bReadOnly; }
+private:
+//IAccessibility2 Implementation 2009-----
 	::sd::Outliner*		mpOutliner;		    // local outliner for outline mode
 	::sd::Outliner*		mpInternalOutliner;  // internal outliner for creation of text objects
 	Timer*			    mpWorkStartupTimer;
@@ -671,6 +683,9 @@
 	// #109538#
 	virtual void PageListChanged();
 	virtual void MasterPageListChanged();
+//IAccessibility2 Implementation 2009-----
+	virtual ImageMap* GetImageMapForObject(SdrObject* pObj);
+//-----IAccessibility2 Implementation 2009
 };
 
 namespace sd
diff --git a/main/sd/inc/glob.hxx b/main/sd/inc/glob.hxx
index 59b42bc..56aa0d2 100644
--- a/main/sd/inc/glob.hxx
+++ b/main/sd/inc/glob.hxx
@@ -38,6 +38,9 @@
 #define SD_IF_SDDRAWDOCSHELL            SFX_INTERFACE_SD_START + 1
 #define SD_IF_SDVIEWSHELL               SFX_INTERFACE_SD_START + 2
 #define SD_IF_SDDRAWVIEWSHELL           SFX_INTERFACE_SD_START + 3
+//IAccessibility2 Implementation 2009-----
+#define SD_IF_SDSLIDEVIEWSHELL          SFX_INTERFACE_SD_START + 4
+//-----IAccessibility2 Implementation 2009
 #define SD_IF_SDOUTLINEVIEWSHELL        SFX_INTERFACE_SD_START + 5
 #define SD_IF_SDDRAWSTDOBJECTBAR        SFX_INTERFACE_SD_START + 6
 #define SD_IF_SDDRAWTEXTOBJECTBAR       SFX_INTERFACE_SD_START + 7
diff --git a/main/sd/source/core/drawdoc.cxx b/main/sd/source/core/drawdoc.cxx
index e84c047..369a474 100644
--- a/main/sd/source/core/drawdoc.cxx
+++ b/main/sd/source/core/drawdoc.cxx
@@ -148,6 +148,7 @@
 
 SdDrawDocument::SdDrawDocument(DocumentType eType, SfxObjectShell* pDrDocSh)
 : FmFormModel( SvtPathOptions().GetPalettePath(), NULL, pDrDocSh )
+, bReadOnly(sal_False)
 , mpOutliner(NULL)
 , mpInternalOutliner(NULL)
 , mpWorkStartupTimer(NULL)
diff --git a/main/sd/source/core/drawdoc2.cxx b/main/sd/source/core/drawdoc2.cxx
index e2c012f..cac2e7a 100644
--- a/main/sd/source/core/drawdoc2.cxx
+++ b/main/sd/source/core/drawdoc2.cxx
@@ -1198,6 +1198,17 @@
 	return pIMapObj;
 }
 
+//IAccessibility2 Implementation 2009-----
+ImageMap* SdDrawDocument::GetImageMapForObject(SdrObject* pObj)
+{
+	SdIMapInfo* pIMapInfo = GetIMapInfo( pObj );
+	if ( pIMapInfo )
+	{
+		return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) );
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
 /** this method enforces that the masterpages are in the currect order,
 	that is at position 1 is a PK_STANDARD masterpage followed by a
 	PK_NOTES masterpage and so on. #
diff --git a/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx b/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
index f1b57c4..d8d0256 100644
--- a/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleDocumentViewBase.cxx
@@ -37,7 +37,10 @@
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <rtl/ustring.h>
 #include<sfx2/viewfrm.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <sfx2/objsh.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <svx/AccessibleShape.hxx>
 
 #include <svx/svdobj.hxx>
@@ -46,8 +49,16 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include "Window.hxx"
 #include <vcl/svapp.hxx>
+//IAccessibility2 Implementation 2009-----
+#include "OutlineViewShell.hxx"
 
+#include "SlideViewShell.hxx"
 
+#include <svx/svdlayer.hxx>
+#include <editeng/editobj.hxx>
+#include "LayerTabBar.hxx"
+#include <svtools/colorcfg.hxx>
+//-----IAccessibility2 Implementation 2009
 #include "ViewShell.hxx"
 #include "View.hxx"
 #include <memory>
@@ -88,6 +99,9 @@
     maShapeTreeInfo.SetViewForwarder (&maViewForwarder);
 
     mxWindow = ::VCLUnoHelper::GetInterface (pSdWindow);
+//IAccessibility2 Implementation 2009-----
+	mpViewShell = pViewShell;
+//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -159,6 +173,11 @@
             }
         }
     }
+//IAccessibility2 Implementation 2009-----
+	SfxObjectShell* pObjShell = mpViewShell->GetViewFrame()->GetObjectShell();
+	if(!pObjShell->IsReadOnly())
+		SetState(AccessibleStateType::EDITABLE);
+//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -434,6 +453,10 @@
             static_cast<beans::XPropertyChangeListener*>(this),
             static_cast<awt::XWindowListener*>(this),
             static_cast<awt::XFocusListener*>(this)
+//IAccessibility2 Implementation 2009-----
+		   ,static_cast<XAccessibleExtendedAttributes*>(this)
+		   ,static_cast<XAccessibleGetAccFlowTo*>(this)
+//-----IAccessibility2 Implementation 2009
             );
     return aReturn;
 }
@@ -835,4 +858,150 @@
 {
 }
 
+//IAccessibility2 Implementation 2009-----
+uno::Any SAL_CALL AccessibleDocumentViewBase::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any anyAtrribute;
+	rtl::OUString sValue;
+	if (mpViewShell && mpViewShell->ISA(::sd::DrawViewShell))
+	{
+		::sd::DrawViewShell* pDrViewSh = (::sd::DrawViewShell*) mpViewShell;
+		rtl::OUString sName;
+		String sDisplay;
+			sName = rtl::OUString::createFromAscii("page-name:");
+			// MT IA2: Not used...
+			// SdPage*	pCurrPge = pDrViewSh->getCurrentPage();
+			SdDrawDocument* pDoc = pDrViewSh->GetDoc();
+			sDisplay = pDrViewSh->getCurrentPage()->GetName();
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) );
+			sValue = sName + sDisplay ;
+			sName = rtl::OUString::createFromAscii(";page-number:");
+			sValue += sName;
+			sValue += String::CreateFromInt32((sal_Int16)((sal_uInt16)((pDrViewSh->getCurrentPage()->GetPageNum()-1)>>1) + 1)) ;
+			sName = rtl::OUString::createFromAscii(";total-pages:");
+			sValue += sName;
+			sValue += String::CreateFromInt32(pDrViewSh->GetPageTabControl()->GetPageCount()) ;
+			sValue +=  rtl::OUString::createFromAscii(";");
+		if(pDrViewSh->IsLayerModeActive() )
+		{
+			sName = rtl::OUString::createFromAscii("page-name:");
+			sValue = sName;
+			sDisplay = pDrViewSh->GetLayerTabControl()->GetPageText(pDrViewSh->GetLayerTabControl()->GetCurPageId());
+			if( pDoc )
+			{
+				SdrLayerAdmin& rLayerAdmin = pDoc->GetLayerAdmin();
+				SdrLayer* aSdrLayer = rLayerAdmin.GetLayer(sDisplay, sal_False);
+				if( aSdrLayer )
+				{
+					String layerAltText = aSdrLayer->GetTitle();
+					if(  layerAltText.Len() > 0)
+					{
+						sName = rtl::OUString::createFromAscii(" ");
+						sDisplay = sDisplay + sName; 
+						sDisplay += layerAltText;
+					}
+				}
+			}
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ));
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ));
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ));
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ));
+			sValue +=  sDisplay;
+			sName = rtl::OUString::createFromAscii(";page-number:");
+			sValue += sName;
+			sValue += String::CreateFromInt32(pDrViewSh->GetActiveTabLayerIndex()+1) ;
+			sName = rtl::OUString::createFromAscii(";total-pages:");
+			sValue += sName;
+			sValue += String::CreateFromInt32(pDrViewSh->GetLayerTabControl()->GetPageCount()) ;
+			sValue +=  rtl::OUString::createFromAscii(";");
+		}
+	}	
+	if (mpViewShell && mpViewShell->ISA(::sd::PresentationViewShell))
+	{
+		::sd::PresentationViewShell* pPresViewSh = (::sd::PresentationViewShell*) mpViewShell;
+		SdPage*	pCurrPge = pPresViewSh->getCurrentPage();
+		SdDrawDocument* pDoc = pPresViewSh->GetDoc();
+		SdPage*	pNotesPge = (SdPage*)pDoc->GetSdPage((pCurrPge->GetPageNum()-1)>>1, PK_NOTES);
+		if (pNotesPge)
+		{
+			SdrObject* pNotesObj = pNotesPge->GetPresObj(PRESOBJ_NOTES);
+			if (pNotesObj)
+			{
+				OutlinerParaObject* pPara = pNotesObj->GetOutlinerParaObject();
+				if (pPara)
+				{
+					sValue += rtl::OUString::createFromAscii("note:");
+					const EditTextObject& rEdit = pPara->GetTextObject();
+					for (sal_uInt16 i=0;i<rEdit.GetParagraphCount();i++)
+					{
+						String strNote = rEdit.GetText(i);
+						strNote.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
+						strNote.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ));
+						strNote.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ));
+						strNote.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ));
+						strNote.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ));
+						sValue += rtl::OUString( strNote );
+						sValue += rtl::OUString::createFromAscii(";");//to divide each paragraph
+					}
+				}
+			}
+		}
+	}
+	if (mpViewShell && mpViewShell->ISA(::sd::OutlineViewShell) )
+	{
+		rtl::OUString sName;
+		String sDisplay;
+		SdPage*	pCurrPge = mpViewShell->GetActualPage();
+		SdDrawDocument* pDoc = mpViewShell->GetDoc();
+		if(pCurrPge && pDoc)
+		{
+			sName = rtl::OUString::createFromAscii("page-name:");
+			sDisplay = pCurrPge->GetName();
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) );
+			sDisplay.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) );
+			sValue = sName + sDisplay ;
+			sName = rtl::OUString::createFromAscii(";page-number:");
+			sValue += sName;
+			sValue += String::CreateFromInt32((sal_Int16)((sal_uInt16)((pCurrPge->GetPageNum()-1)>>1) + 1)) ;
+			sName = rtl::OUString::createFromAscii(";total-pages:");
+			sValue += sName;
+			sValue += String::CreateFromInt32(pDoc->GetSdPageCount(PK_STANDARD)) ;
+			sValue +=  rtl::OUString::createFromAscii(";");
+		}
+	}	
+	if (sValue.getLength())
+		anyAtrribute <<= sValue;
+	return anyAtrribute;	
+}
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL AccessibleDocumentViewBase::get_AccFlowTo(const ::com::sun::star::uno::Any&, sal_Int32 )
+		throw ( ::com::sun::star::uno::RuntimeException )
+{
+	::com::sun::star::uno::Sequence< uno::Any> aRet;
+
+	return aRet;
+}
+
+sal_Int32 SAL_CALL AccessibleDocumentViewBase::getForeground(  )
+        throw (uno::RuntimeException)
+{
+    return COL_BLACK;
+}
+
+sal_Int32 SAL_CALL AccessibleDocumentViewBase::getBackground(  )
+        throw (uno::RuntimeException)
+{
+	 ThrowIfDisposed ();
+    ::osl::MutexGuard aGuard (maMutex);
+    return mpViewShell->GetView()->getColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace accessibility
diff --git a/main/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/main/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
index ccfde19..4cef6a5 100644
--- a/main/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx
@@ -52,6 +52,14 @@
 
 #include "ViewShell.hxx"
 #include "View.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "DrawDocShell.hxx"
+#include <drawdoc.hxx>
+#include <algorithm>
+#include "sdpage.hxx"
+#include "slideshow.hxx"
+#include "anminfo.hxx"
+//-----IAccessibility2 Implementation 2009
 #include <memory>
 
 #include "accessibility.hrc"
@@ -70,6 +78,22 @@
 namespace accessibility {
 
 
+//IAccessibility2 Implementation 2009-----
+struct XShapePosCompareHelper
+{
+	bool operator() ( const uno::Reference<drawing::XShape>& xshape1, 
+		const uno::Reference<drawing::XShape>& xshape2 ) const
+	{
+		// modify the compare method to return the Z-Order, not layout order
+		SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1);
+		SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2);		
+		if(pObj1 && pObj2)
+			return pObj1->GetOrdNum() < pObj2->GetOrdNum();
+		else
+			return 0;
+	}
+};
+//-----IAccessibility2 Implementation 2009
 //=====  internal  ============================================================
 
 AccessibleDrawDocumentView::AccessibleDrawDocumentView (
@@ -78,6 +102,7 @@
     const uno::Reference<frame::XController>& rxController,
     const uno::Reference<XAccessible>& rxParent)
     : AccessibleDocumentViewBase (pSdWindow, pViewShell, rxController, rxParent),
+      mpSdViewSh( pViewShell ),
       mpChildrenManager (NULL)
 {
     OSL_TRACE ("AccessibleDrawDocumentView");
@@ -260,9 +285,44 @@
             static_cast<uno::XWeak*>(this));
 }
 
+//IAccessibility2 Implementation 2009-----
+OUString SAL_CALL
+	AccessibleDrawDocumentView::getAccessibleName(void)
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	OUString sName = String( SdResId(SID_SD_A11Y_D_PRESENTATION) );
+	::sd::View* pSdView = static_cast< ::sd::View* >( maShapeTreeInfo.GetSdrView() );
+	if ( pSdView )
+	{
+		SdDrawDocument* pDoc = pSdView->GetDoc();
+		if ( pDoc )
+		{
+			rtl::OUString sFileName = pDoc->getDocAccTitle();
+			if ( !sFileName.getLength() )
+			{
+				::sd::DrawDocShell* pDocSh = pSdView->GetDocSh();
+				if ( pDocSh )
+				{
+					sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
+				}			
+			}
 
+			OUString sReadOnly;
+			if(pDoc->getDocReadOnly())
+			{				
+				sReadOnly = String(SdResId(SID_SD_A11Y_D_PRESENTATION_READONLY));				
+			}
 
+			if ( sFileName.getLength() )
+			{
+				sName = sFileName + sReadOnly + OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName;
+			}			
+		}
+	}
 
+	return sName;
+}
+//-----IAccessibility2 Implementation 2009
 //=====  XEventListener  ======================================================
 
 void SAL_CALL
@@ -295,7 +355,9 @@
     AccessibleDocumentViewBase::propertyChange (rEventObject);
 
     OSL_TRACE ("AccessibleDrawDocumentView::propertyChange");
-    if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")))
+    // add page switch event for slide show mode
+    if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")) ||
+		rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("PageChange")) )
     {
         OSL_TRACE ("    current page changed");
 
@@ -329,6 +391,9 @@
         }
         else
             OSL_TRACE ("View invalid");
+//IAccessibility2 Implementation 2009-----
+		CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue);
+//-----IAccessibility2 Implementation 2009
     }
     else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("VisibleArea")))
     {
@@ -338,6 +403,59 @@
                 IAccessibleViewForwarderListener::VISIBLE_AREA, 
                 &maViewForwarder);
     }
+//IAccessibility2 Implementation 2009-----
+	else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("ActiveLayer")))
+	{
+		CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue);
+	}
+    else if (rEventObject.PropertyName == OUString (RTL_CONSTASCII_USTRINGPARAM("UpdateAcc")))
+    {
+        OSL_TRACE ("    acc on current page should be updated");
+
+        // The current page changed.  Update the children manager accordingly.
+        uno::Reference<drawing::XDrawView> xView (mxController, uno::UNO_QUERY);
+        if (xView.is() && mpChildrenManager!=NULL)
+        {
+            // Inform the children manager to forget all children and give
+            // him the new ones.
+            mpChildrenManager->ClearAccessibleShapeList ();
+			// update the slide show page's accessible info
+            //mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> (
+            //    xView->getCurrentPage(), uno::UNO_QUERY));
+	    rtl::Reference< sd::SlideShow > xSlideshow( sd::SlideShow::GetSlideShow( mpSdViewSh->GetViewShellBase() ) );
+	    if( xSlideshow.is() && xSlideshow->isRunning() && xSlideshow->isFullScreen() )
+	    {
+		    ::com::sun::star::uno::Reference< drawing::XDrawPage > xSlide;
+			// MT IA2: Not used...
+			// sal_Int32 currentPageIndex = xSlideshow->getCurrentPageIndex();
+			::com::sun::star::uno::Reference< ::com::sun::star::presentation::XSlideShowController > mpSlideController = xSlideshow->getController();
+			if( mpSlideController.is() )
+			{
+				xSlide = mpSlideController->getCurrentSlide();
+				if (xSlide.is())
+				{
+					mpChildrenManager->SetShapeList (uno::Reference<drawing::XShapes> (
+				                xSlide, uno::UNO_QUERY));
+				}
+			}
+	    }			
+            // Create the page shape and initialize it.  The shape is
+            // acquired before initialization and released after
+            // transferring ownership to the children manager to prevent
+            // premature disposing of the shape.
+            AccessiblePageShape* pPage = CreateDrawPageShape ();
+            if (pPage != NULL)
+            {
+                pPage->acquire();
+                pPage->Init();
+                mpChildrenManager->AddAccessibleShape (
+                    std::auto_ptr<AccessibleShape>(pPage));
+                mpChildrenManager->Update (false);
+                pPage->release();
+            }
+	}
+    }
+//-----IAccessibility2 Implementation 2009
     else
     {
         OSL_TRACE ("  unhandled");
@@ -379,9 +497,137 @@
     return aServiceNames;
 }
 
+//IAccessibility2 Implementation 2009-----
+//=====  XInterface  ==========================================================
+    
+uno::Any SAL_CALL
+    AccessibleDrawDocumentView::queryInterface (const uno::Type & rType)
+    throw (uno::RuntimeException)
+{
+    uno::Any aReturn = AccessibleDocumentViewBase::queryInterface (rType);
+    if ( ! aReturn.hasValue())
+        aReturn = ::cppu::queryInterface (rType,
+            static_cast<XAccessibleGroupPosition*>(this)
+            );
+    return aReturn;
+}
 
-        
-
+void SAL_CALL
+    AccessibleDrawDocumentView::acquire (void) 
+    throw ()
+{
+    AccessibleDocumentViewBase::acquire ();
+}
+void SAL_CALL
+    AccessibleDrawDocumentView::release (void)
+    throw ()
+{
+    AccessibleDocumentViewBase::release ();
+}
+//=====  XAccessibleGroupPosition  =========================================
+uno::Sequence< sal_Int32 > SAL_CALL
+    AccessibleDrawDocumentView::getGroupPosition( const uno::Any& rAny )
+    throw (uno::RuntimeException)
+{
+	// we will return the:
+	// [0] group level(always be 0 now)
+	// [1] similar items counts in the group
+	// [2] the position of the object in the group
+	uno::Sequence< sal_Int32 > aRet( 3 );
+	//get the xShape of the current selected drawing object
+	uno::Reference<XAccessibleContext> xAccContent;
+	rAny >>= xAccContent;
+	if ( !xAccContent.is() )
+	{
+		return aRet;
+	}
+	AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent );
+	if ( !pAcc )
+	{
+		return aRet;
+	}
+	uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape();
+	if ( !xCurShape.is() )
+	{
+		return aRet;
+	}
+	//find all the child in the page, insert them into a vector and sort
+	if ( mpChildrenManager == NULL )
+	{
+		return aRet;
+	}
+	std::vector< uno::Reference<drawing::XShape> > vXShapes;
+	sal_Int32 nCount = mpChildrenManager->GetChildCount();
+	//get pointer of SdView & SdrPageView for further use.
+	SdrPageView* pPV = NULL;
+	::sd::View* pSdView = NULL;
+	if ( mpSdViewSh )
+	{
+		pSdView = mpSdViewSh->GetView();
+		pPV = pSdView->GetSdrPageView();
+	}
+	for ( sal_Int32 i = 0; i < nCount; i++ )
+	{
+		uno::Reference< drawing::XShape > xShape = mpChildrenManager->GetChildShape(i);
+		if ( xShape.is() )
+		{
+			//if the object is visable in the page, we add it into the group list.
+			SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+			if ( pObj && pPV && pSdView && pSdView->IsObjMarkable( pObj, pPV ) )
+			{
+				vXShapes.push_back( xShape );
+			}
+		}
+	}
+	std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );
+	//get the the index of the selected object in the group
+	std::vector< uno::Reference<drawing::XShape> >::iterator aIter;
+	//we start counting position from 1
+	sal_Int32 nPos = 1;
+	for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ )
+	{
+		if ( (*aIter).get() == xCurShape.get() )
+		{
+			sal_Int32* pArray = aRet.getArray();
+			pArray[0] = 1; //it should be 1 based, not 0 based.
+			pArray[1] = vXShapes.size();
+			pArray[2] = nPos;
+			break;
+		}
+	}
+	return aRet;
+}
+::rtl::OUString AccessibleDrawDocumentView::getObjectLink( const uno::Any& rAny )
+	throw (uno::RuntimeException)
+{
+	::rtl::OUString aRet;
+	//get the xShape of the current selected drawing object
+	uno::Reference<XAccessibleContext> xAccContent;
+	rAny >>= xAccContent;
+	if ( !xAccContent.is() )
+	{
+		return aRet;
+	}
+	AccessibleShape* pAcc = AccessibleShape::getImplementation( xAccContent );
+	if ( !pAcc )
+	{
+		return aRet;
+	}
+	uno::Reference< drawing::XShape > xCurShape = pAcc->GetXShape();
+	if ( !xCurShape.is() )
+	{
+		return aRet;
+	}
+	SdrObject* pObj = GetSdrObjectFromXShape(xCurShape);
+	if (pObj)
+	{
+		SdAnimationInfo* pInfo = SdDrawDocument::GetShapeUserData(*pObj);
+		if( pInfo && (pInfo->meClickAction == presentation::ClickAction_DOCUMENT) )
+			aRet = (::rtl::OUString)pInfo->GetBookmark();
+	}
+	return aRet;
+}
+//-----IAccessibility2 Implementation 2009
 ///	Create a name for this view.
 ::rtl::OUString
     AccessibleDrawDocumentView::CreateAccessibleName (void)
@@ -637,13 +883,25 @@
 {
     if (mpChildrenManager != NULL)
     {
-        mpChildrenManager->UpdateSelection();
+//IAccessibility2 Implementation 2009-----
+        //mpChildrenManager->UpdateSelection();
+	sal_Bool bChange = sal_False;
+//-----IAccessibility2 Implementation 2009
         // When none of the children has the focus then claim it for the
         // view.
         if ( ! mpChildrenManager->HasFocus())
+	{
             SetState (AccessibleStateType::FOCUSED);
+	    bChange = sal_True;
+	}
         else
             ResetState (AccessibleStateType::FOCUSED);
+//IAccessibility2 Implementation 2009-----
+	mpChildrenManager->UpdateSelection();
+	// if the child gets focus in UpdateSelection(), needs to reset the focus on document.
+	if (mpChildrenManager->HasFocus() && bChange)
+		ResetState (AccessibleStateType::FOCUSED);
+//-----IAccessibility2 Implementation 2009
     }
 }
 
@@ -690,8 +948,158 @@
     AccessibleDocumentViewBase::disposing ();
 }
 
+//IAccessibility2 Implementation 2009-----
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL AccessibleDrawDocumentView::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException )
+{
+	const sal_Int32 SPELLCHECKFLOWTO = 1;
+	const sal_Int32 FINDREPLACEFLOWTO = 2;
+	if ( nType == SPELLCHECKFLOWTO )
+	{
+		uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+		rAny >>= xShape;
+		if ( mpChildrenManager && xShape.is() )
+		{
+			uno::Reference < XAccessible > xAcc = mpChildrenManager->GetChild(xShape);
+			uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
+			if ( xAccSelection.is() )
+			{
+				if ( xAccSelection->getSelectedAccessibleChildCount() ) 
+				{
+					uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
+					if ( xSel.is() )
+					{
+						uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+						if ( xSelContext.is() )
+						{
+							//if in sw we find the selected paragraph here
+							if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+							{
+								uno::Sequence<uno::Any> aRet( 1 );
+								aRet[0] = uno::makeAny( xSel );
+								return aRet;							
+							}
+						}
+					}
+				}
+			}
+			uno::Reference<XAccessible> xPara = GetSelAccContextInTable();
+			if ( xPara.is() )
+			{
+				uno::Sequence<uno::Any> aRet( 1 );
+				aRet[0] = uno::makeAny( xPara );
+				return aRet;
+			}			
+		}
+		else
+		{
+			goto Rt;
+		}
+	}
+	else if ( nType == FINDREPLACEFLOWTO )
+	{
+		sal_Int32 nChildCount = getSelectedAccessibleChildCount();
+		if ( nChildCount )
+		{
+			uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 );
+			if ( xSel.is() )
+			{
+				uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY );
+				if ( xAccChildSelection.is() )
+				{
+					if ( xAccChildSelection->getSelectedAccessibleChildCount() )
+					{
+						uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 );
+						if ( xChildSel.is() )
+						{
+							uno::Reference < XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() );
+							if ( xChildSelContext.is() &&
+								xChildSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+							{
+								uno::Sequence<uno::Any> aRet( 1 );
+								aRet[0] = uno::makeAny( xChildSel );
+								return aRet;
+							}
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			uno::Reference<XAccessible> xPara = GetSelAccContextInTable();
+			if ( xPara.is() )
+			{
+				uno::Sequence<uno::Any> aRet( 1 );
+				aRet[0] = uno::makeAny( xPara );
+				return aRet;
+			}
+		}
+	}
+	
+Rt:
+	::com::sun::star::uno::Sequence< uno::Any> aRet;
+	return aRet;
+}
+uno::Reference<XAccessible> AccessibleDrawDocumentView::GetSelAccContextInTable()
+{
+	uno::Reference<XAccessible> xRet;
+	sal_Int32 nCount = mpChildrenManager ? mpChildrenManager->GetChildCount() : 0;
+	if ( nCount )
+	{
+		for ( sal_Int32 i = 0; i < nCount; i++ )
+		{
+			try
+			{
+				uno::Reference<XAccessible> xObj = mpChildrenManager->GetChild(i);
+				if ( xObj.is() )
+				{
+					uno::Reference<XAccessibleContext> xObjContext( xObj, uno::UNO_QUERY );
+					if ( xObjContext.is() && xObjContext->getAccessibleRole() == AccessibleRole::TABLE )
+					{
+						uno::Reference<XAccessibleSelection> xObjSelection( xObj, uno::UNO_QUERY );
+						if ( xObjSelection.is() && xObjSelection->getSelectedAccessibleChildCount() )
+						{
+							uno::Reference<XAccessible> xCell = xObjSelection->getSelectedAccessibleChild(0);
+							if ( xCell.is() )
+							{
+								uno::Reference<XAccessibleSelection> xCellSel( xCell, uno::UNO_QUERY );
+								if ( xCellSel.is() && xCellSel->getSelectedAccessibleChildCount() )
+								{
+									uno::Reference<XAccessible> xPara = xCellSel->getSelectedAccessibleChild( 0 );
+									if ( xPara.is() )
+									{
+										uno::Reference<XAccessibleContext> xParaContext( xPara, uno::UNO_QUERY );
+										if ( xParaContext.is() &&
+											xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+										{
+											xRet = xPara;
+											return xRet;
+										}
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+			catch ( lang::IndexOutOfBoundsException )
+			{
+				uno::Reference<XAccessible> xEmpty;
+				return xEmpty;
+			}
+			catch ( uno::RuntimeException )
+			{
+				uno::Reference<XAccessible> xEmpty;
+				return xEmpty;
+			}
+		}
+	}
 
-
+	return xRet;
+}
+//-----IAccessibility2 Implementation 2009
 
 void AccessibleDrawDocumentView::UpdateAccessibleName (void)
 {
diff --git a/main/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx b/main/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
index 5a67b76..9f99d11 100644
--- a/main/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleOutlineEditSource.cxx
@@ -48,7 +48,8 @@
           mViewForwarder( rOutlView )
     {       
         // register as listener - need to broadcast state change messages
-        rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) );
+		// Moved to ::GetTextForwarder()
+        //rOutliner.SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) );
         StartListening(rOutliner);
     }
 
@@ -61,14 +62,22 @@
 
     SvxEditSource* AccessibleOutlineEditSource::Clone() const
     {
-        return NULL;
+		//IAccessibility2 Implementation 2009-----
+        /*return NULL;*/
+		return new AccessibleOutlineEditSource(*mpOutliner, mrView, *mpOutlinerView, mrWindow);
+		//-----IAccessibility2 Implementation 2009
     }
 
     SvxTextForwarder* AccessibleOutlineEditSource::GetTextForwarder()
     {
         // TODO: maybe suboptimal
         if( IsValid() )
+		{
+			// Moved here to make sure that 
+			// the NotifyHandler was set on the current object.
+			mpOutliner->SetNotifyHdl( LINK(this, AccessibleOutlineEditSource, NotifyHdl) );
             return &mTextForwarder;
+		}
         else
             return NULL;
     }
diff --git a/main/sd/source/ui/accessibility/AccessibleOutlineView.cxx b/main/sd/source/ui/accessibility/AccessibleOutlineView.cxx
index 7bfc15f..047767e 100644
--- a/main/sd/source/ui/accessibility/AccessibleOutlineView.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleOutlineView.cxx
@@ -150,6 +150,37 @@
     return maTextHelper.GetChild(nIndex);
 }
 
+//IAccessibility2 Implementation 2009-----
+#include <drawdoc.hxx>
+::rtl::OUString SAL_CALL
+	AccessibleOutlineView::getAccessibleName(void)
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	::rtl::OUString sName = String( SdResId(SID_SD_A11Y_D_PRESENTATION) );
+	::sd::View* pSdView = static_cast< ::sd::View* >( maShapeTreeInfo.GetSdrView() );
+	if ( pSdView )
+	{
+		SdDrawDocument* pDoc = pSdView->GetDoc();
+		if ( pDoc )
+		{
+			rtl::OUString sFileName = pDoc->getDocAccTitle();
+			if ( !sFileName.getLength() )
+			{
+				::sd::DrawDocShell* pDocSh = pSdView->GetDocSh();
+				if ( pDocSh )
+				{
+					sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
+				}			
+			}
+			if ( sFileName.getLength() )
+			{
+				sName = sFileName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName;
+			}
+		}
+	}
+	return sName;
+}
+//-----IAccessibility2 Implementation 2009
 //=====  XAccessibleEventBroadcaster  ========================================
 
 void SAL_CALL AccessibleOutlineView::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
@@ -157,6 +188,9 @@
     // delegate listener handling to children manager.
     if ( ! IsDisposed())
         maTextHelper.AddEventListener(xListener);
+//IAccessibility2 Implementation 2009-----
+	AccessibleContextBase::addEventListener(xListener);
+//-----IAccessibility2 Implementation 2009
 }
 
 void SAL_CALL AccessibleOutlineView::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener ) throw (uno::RuntimeException)
@@ -164,6 +198,9 @@
     // forward
     if ( ! IsDisposed())
         maTextHelper.RemoveEventListener(xListener);
+//IAccessibility2 Implementation 2009-----
+	AccessibleContextBase::removeEventListener(xListener);
+//-----IAccessibility2 Implementation 2009
 }
 
 //=====  XServiceInfo  ========================================================
@@ -228,12 +265,17 @@
     AccessibleDocumentViewBase::propertyChange (rEventObject);
 
     OSL_TRACE ("AccessibleOutlineView::propertyChange");
-    if (rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")))
+	//add page switch event for slide show mode
+    if (rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("CurrentPage")) ||
+		rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("PageChange")) )
     {
         OSL_TRACE ("    current page changed");
 
         // The current page changed. Update the children accordingly.
         UpdateChildren();
+//IAccessibility2 Implementation 2009-----
+    	CommitChange(AccessibleEventId::PAGE_CHANGED,rEventObject.NewValue,rEventObject.OldValue);
+//-----IAccessibility2 Implementation 2009
     }
     else if (rEventObject.PropertyName == ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("VisibleArea")))
     {
diff --git a/main/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx b/main/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
index e5f2d90..c1c9d1d 100644
--- a/main/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
+++ b/main/sd/source/ui/accessibility/AccessiblePresentationGraphicShape.cxx
@@ -119,5 +119,12 @@
 
     return aDG();
 }
+//IAccessibility2 Implementation 2009-----
+sal_Int16 SAL_CALL AccessiblePresentationGraphicShape::getAccessibleRole () 
+	throw (::com::sun::star::uno::RuntimeException)
+{
 
+	return  AccessibleRole::GRAPHIC ;
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace accessibility
diff --git a/main/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx b/main/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
index 6e59fd9..039ce04 100644
--- a/main/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
+++ b/main/sd/source/ui/accessibility/AccessiblePresentationOLEShape.cxx
@@ -140,5 +140,13 @@
 
     return aDG();
 }
+//IAccessibility2 Implementation 2009-----
+//	Return this object's role.
+sal_Int16 SAL_CALL AccessiblePresentationOLEShape::getAccessibleRole () 
+	throw (::com::sun::star::uno::RuntimeException)
+{
 
+	return  AccessibleRole::EMBEDDED_OBJECT ;
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace accessibility
diff --git a/main/sd/source/ui/accessibility/AccessiblePresentationShape.cxx b/main/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
index d6fb9f8..167d266 100644
--- a/main/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
+++ b/main/sd/source/ui/accessibility/AccessiblePresentationShape.cxx
@@ -27,6 +27,11 @@
 
 #include "SdShapeTypes.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include "accessibility.hrc"
+#include "sdresid.hxx"
+#include <tools/string.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <svx/DescriptionGenerator.hxx>
 #include <rtl/ustring.h>
 
@@ -77,38 +82,51 @@
     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
     switch (nShapeType)
     {
+    //IAccessibility2 Implementation 2009-----
         case PRESENTATION_TITLE:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressTitle"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N)));
             break;
         case PRESENTATION_OUTLINER:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressOutliner"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N)));
             break;
         case PRESENTATION_SUBTITLE:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressSubtitle"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N)));
             break;
         case PRESENTATION_PAGE:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPage"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N)));
             break;
         case PRESENTATION_NOTES:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressNotes"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N)));
             break;
         case PRESENTATION_HANDOUT:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHandout"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N)));
             break;
 		case PRESENTATION_HEADER:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressHeader"));
+	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N)) );
             break;
 		case PRESENTATION_FOOTER:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressFooter"));
+	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N)) );
             break;
 		case PRESENTATION_DATETIME:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressDateAndTime"));
+	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N)) );
             break;
 		case PRESENTATION_PAGENUMBER:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("ImpressPageNumber"));
+	    sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N)) );
             break;
         default:
-            sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
+            //sName = ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM("UnknownAccessibleImpressShape"));
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N)));
+	//-----IAccessibility2 Implementation 2009
             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
             if (xDescriptor.is())
                 sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
@@ -126,42 +144,67 @@
     throw (::com::sun::star::uno::RuntimeException)
 {
     //    return createAccessibleName ();
+    ::rtl::OUString sDescription;
     DescriptionGenerator aDG (mxShape);
     ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
     switch (nShapeType)
     {
+    //IAccessibility2 Implementation 2009-----
         case PRESENTATION_TITLE:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationTitleShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_TITLE_D)) );
+	    aDG.Initialize (sDescription);		
             break;
         case PRESENTATION_OUTLINER:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationOutlinerShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_OUTLINER_D)) );
+	    aDG.Initialize (sDescription);				//PresentationOutlinerShape
             break;
         case PRESENTATION_SUBTITLE:
             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationSubtitleShape"));
+ 	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_SUBTITLE_D)) );
+	    aDG.Initialize (sDescription);				//PresentationSubtitleShape
             break;
         case PRESENTATION_PAGE:
             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageShape"));
+            sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_PAGE_D)) );
+	    aDG.Initialize (sDescription);				//PresentationPageShape
             break;
         case PRESENTATION_NOTES:
             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationNotesShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NOTES_D)) );
+	    aDG.Initialize (sDescription);				//PresentationNotesShape
             break;
         case PRESENTATION_HANDOUT:
             aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHandoutShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HANDOUT_D)) );
+	    aDG.Initialize (sDescription);				//PresentationHandoutShape
             break;
 		case PRESENTATION_HEADER:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationHeaderShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_D)) );
+	    aDG.Initialize (sDescription);				//PresentationHeaderShape
             break;
 		case PRESENTATION_FOOTER:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationFooterShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_D)) );
+	    aDG.Initialize (sDescription);				//PresentationFooterShape
             break;
 		case PRESENTATION_DATETIME:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationDateAndTimeShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_D)) );
+	    aDG.Initialize (sDescription);				//PresentationDateShape
             break;
 		case PRESENTATION_PAGENUMBER:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("PresentationPageNumberShape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_D)) );
+	    aDG.Initialize (sDescription);				//PresentationNumberShape
             break;
         default:
-            aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape"));
+            //aDG.Initialize (::rtl::OUString::createFromAscii ("Unknown accessible presentation shape"));
+	    sDescription = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_UNKNOWN_D)) );
+	    aDG.Initialize (sDescription);				//Unknown accessible presentation shape
+	    //-----IAccessibility2 Implementation 2009
             uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
             if (xDescriptor.is())
             {
@@ -172,5 +215,54 @@
 
     return aDG();
 }
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString AccessiblePresentationShape::GetStyle()
+{
+    ::rtl::OUString sName;
 
+    ShapeTypeId nShapeType = ShapeTypeHandler::Instance().GetTypeId (mxShape);
+    switch (nShapeType)
+    {
+        case PRESENTATION_TITLE:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_TITLE_N_STYLE)));
+            break;
+        case PRESENTATION_OUTLINER:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_OUTLINER_N_STYLE)));
+            break;
+        case PRESENTATION_SUBTITLE:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_SUBTITLE_N_STYLE)));
+            break;
+        case PRESENTATION_PAGE:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_PAGE_N_STYLE)));
+            break;
+        case PRESENTATION_NOTES:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_NOTES_N_STYLE)));
+            break;
+        case PRESENTATION_HANDOUT:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_HANDOUT_N_STYLE)));
+            break;
+        case PRESENTATION_FOOTER:
+		sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_FOOTER_N_STYLE)) );
+            break;
+	case PRESENTATION_HEADER:
+		sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_HEADER_N_STYLE)) );
+            break;
+        case PRESENTATION_DATETIME:
+			sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_DATE_N_STYLE)) );
+            break;
+        case PRESENTATION_PAGENUMBER:
+			sName = ::rtl::OUString ( String(SdResId(SID_SD_A11Y_P_NUMBER_N_STYLE)) );
+            break;			
+        default:
+            sName = ::rtl::OUString (String(SdResId(SID_SD_A11Y_P_UNKNOWN_N_STYLE)));
+            uno::Reference<drawing::XShapeDescriptor> xDescriptor (mxShape, uno::UNO_QUERY);
+            if (xDescriptor.is())
+                sName += ::rtl::OUString (RTL_CONSTASCII_USTRINGPARAM(": "))
+                    + xDescriptor->getShapeType();
+    }
+
+    return sName;
+
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace accessibility	
diff --git a/main/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx b/main/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
index d1ae515..b0f0439 100644
--- a/main/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleSlideSorterObject.cxx
@@ -199,7 +199,9 @@
     throw (uno::RuntimeException)
 {
     ThrowIfDisposed();
-    static sal_Int16 nRole = AccessibleRole::LIST_ITEM;
+    //set Role = Shape
+    //static sal_Int16 nRole = AccessibleRole::LIST_ITEM;
+    static sal_Int16 nRole = AccessibleRole::SHAPE;
     return nRole;
 }
 
diff --git a/main/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/main/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index 5f7d410..8fa6d9f 100644
--- a/main/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/main/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -91,6 +91,7 @@
     DECL_LINK(FocusChangeListener, void*);
     DECL_LINK(UpdateChildrenCallback, void*);
 
+    void Activated(void);
 private:
     AccessibleSlideSorterView& mrAccessibleSlideSorter;
     ::sd::slidesorter::SlideSorter& mrSlideSorter;
@@ -833,6 +834,11 @@
 
 void AccessibleSlideSorterView::Implementation::UpdateChildren (void)
 {
+  	//By default, all children should be accessable. So here workaround is to make all children visible. 
+  	// MT: THis was in UpdateVisibility, which has some similarity, and hg merge automatically has put it here. Correct?!
+  	// In the IA2 CWS, also setting mnFirst/LastVisibleChild was commented out!
+  	mnLastVisibleChild = maPageObjects.size();
+
     if (mbModelChangeLocked)
     {
         // Do nothing right now.  When the flag is reset, this method is
@@ -1023,6 +1029,22 @@
 }
 
 
+void AccessibleSlideSorterView::SwitchViewActivated (void)
+{
+	// Firstly, set focus to view
+	this->FireAccessibleEvent(AccessibleEventId::STATE_CHANGED,
+                    Any(),
+                    Any(AccessibleStateType::FOCUSED));
+	
+	mpImpl->Activated();
+}
+
+void AccessibleSlideSorterView::Implementation::Activated()
+{
+	mrSlideSorter.GetController().GetFocusManager().ShowFocus();
+
+}
+
 
 
 IMPL_LINK(AccessibleSlideSorterView::Implementation, WindowEventListener, VclWindowEvent*, pEvent)
@@ -1079,27 +1101,40 @@
     sal_Int32 nNewFocusedIndex (
         mrSlideSorter.GetController().GetFocusManager().GetFocusedPageIndex());
 
+    sal_Bool bHasFocus = mrSlideSorter.GetController().GetFocusManager().IsFocusShowing();
+    if (!bHasFocus)
+    	nNewFocusedIndex = -1;
+
+    // add a checker whether the focus event is sent out. Only after sent, the mnFocusedIndex should be updated. 
+    sal_Bool bSentFocus = sal_False;
     if (nNewFocusedIndex != mnFocusedIndex)
     {
         if (mnFocusedIndex >= 0)
         {
             AccessibleSlideSorterObject* pObject = GetAccessibleChild(mnFocusedIndex);
             if (pObject != NULL)
+			{
                 pObject->FireAccessibleEvent(
                     AccessibleEventId::STATE_CHANGED,
                     Any(AccessibleStateType::FOCUSED),
                     Any());
+				bSentFocus = sal_True;
+			}
         }
         if (nNewFocusedIndex >= 0)
         {
             AccessibleSlideSorterObject* pObject = GetAccessibleChild(nNewFocusedIndex);
             if (pObject != NULL)
+			{
                 pObject->FireAccessibleEvent(
                     AccessibleEventId::STATE_CHANGED,
                     Any(),
                     Any(AccessibleStateType::FOCUSED));
+				bSentFocus = sal_True;
+			}
         }
-        mnFocusedIndex = nNewFocusedIndex;
+		if (bSentFocus == sal_True)
+			mnFocusedIndex = nNewFocusedIndex;
     }
     return 1;
 }
diff --git a/main/sd/source/ui/accessibility/accessibility.hrc b/main/sd/source/ui/accessibility/accessibility.hrc
index 71d7cd2..c98c979 100644
--- a/main/sd/source/ui/accessibility/accessibility.hrc
+++ b/main/sd/source/ui/accessibility/accessibility.hrc
@@ -44,6 +44,46 @@
 #define SID_SD_A11Y_I_HANDOUTVIEW_N		(SID_SD_A11Y_START + 10)
 #define SID_SD_A11Y_I_HANDOUTVIEW_D		(SID_SD_A11Y_START + 11)
 
+//IAccessibility2 Implementation 2009-----
+#define SID_SD_A11Y_P_TITLE_N			(SID_SD_A11Y_START + 12)
+#define SID_SD_A11Y_P_TITLE_D			(SID_SD_A11Y_START + 13)
+#define SID_SD_A11Y_P_OUTLINER_N		(SID_SD_A11Y_START + 14)
+#define SID_SD_A11Y_P_OUTLINER_D		(SID_SD_A11Y_START + 15)
+#define SID_SD_A11Y_P_SUBTITLE_N		(SID_SD_A11Y_START + 16)
+#define SID_SD_A11Y_P_SUBTITLE_D		(SID_SD_A11Y_START + 17)
+#define SID_SD_A11Y_P_PAGE_N			(SID_SD_A11Y_START + 18)
+#define SID_SD_A11Y_P_PAGE_D			(SID_SD_A11Y_START + 19)
+#define SID_SD_A11Y_P_NOTES_N			(SID_SD_A11Y_START + 20)
+#define SID_SD_A11Y_P_NOTES_D			(SID_SD_A11Y_START + 21)
+#define SID_SD_A11Y_P_HANDOUT_N			(SID_SD_A11Y_START + 22)
+#define SID_SD_A11Y_P_HANDOUT_D			(SID_SD_A11Y_START + 23)
+#define SID_SD_A11Y_P_UNKNOWN_N			(SID_SD_A11Y_START + 24)
+#define SID_SD_A11Y_P_UNKNOWN_D			(SID_SD_A11Y_START + 25)
+#define SID_SD_A11Y_P_FOOTER_N			(SID_SD_A11Y_START + 26)
+#define SID_SD_A11Y_P_FOOTER_D			(SID_SD_A11Y_START + 27)
+#define SID_SD_A11Y_P_HEADER_N			(SID_SD_A11Y_START + 28)
+#define SID_SD_A11Y_P_HEADER_D			(SID_SD_A11Y_START + 29)
+#define SID_SD_A11Y_P_DATE_N			(SID_SD_A11Y_START + 30)
+#define SID_SD_A11Y_P_DATE_D			(SID_SD_A11Y_START + 31)
+#define SID_SD_A11Y_P_NUMBER_N			(SID_SD_A11Y_START + 32)
+#define SID_SD_A11Y_P_NUMBER_D			(SID_SD_A11Y_START + 33)
+#define SID_SD_A11Y_D_PRESENTATION		(SID_SD_A11Y_START + 34)
+#define   SID_SD_A11Y_P_TITLE_N_STYLE		(SID_SD_A11Y_START + 35)
+#define   SID_SD_A11Y_P_OUTLINER_N_STYLE	(SID_SD_A11Y_START + 36)
+#define   SID_SD_A11Y_P_SUBTITLE_N_STYLE	(SID_SD_A11Y_START + 37)
+#define   SID_SD_A11Y_P_PAGE_N_STYLE		(SID_SD_A11Y_START + 38)
+#define   SID_SD_A11Y_P_NOTES_N_STYLE 		(SID_SD_A11Y_START + 39)
+#define   SID_SD_A11Y_P_HANDOUT_N_STYLE		(SID_SD_A11Y_START + 40)
+#define   SID_SD_A11Y_P_UNKNOWN_N_STYLE		(SID_SD_A11Y_START + 41)
+#define   SID_SD_A11Y_P_FOOTER_N_STYLE		(SID_SD_A11Y_START + 42)
+#define   SID_SD_A11Y_P_HEADER_N_STYLE		(SID_SD_A11Y_START + 43)
+#define   SID_SD_A11Y_P_DATE_N_STYLE		(SID_SD_A11Y_START + 44)
+#define   SID_SD_A11Y_P_NUMBER_N_STYLE		(SID_SD_A11Y_START + 45)
 
+#define   SID_SD_A11Y_I_PREVIEW_N (SID_SD_A11Y_START + 46)
+#define   SID_SD_A11Y_I_PREVIEW_D (SID_SD_A11Y_START + 47)
+#define   SID_SD_A11Y_I_PREVIEW_SUFFIX (SID_SD_A11Y_START + 48)
+#define   SID_SD_A11Y_D_PRESENTATION_READONLY (SID_SD_A11Y_START + 49)
+//-----IAccessibility2 Implementation 2009
 #endif /* _SD_ACCESSIBILITY_HRC */
 
diff --git a/main/sd/source/ui/accessibility/accessibility.src b/main/sd/source/ui/accessibility/accessibility.src
index ad8e7cb..a165c40 100644
--- a/main/sd/source/ui/accessibility/accessibility.src
+++ b/main/sd/source/ui/accessibility/accessibility.src
@@ -87,25 +87,174 @@
 	Text [ en-US ] = "This is where you decide on the layout for handouts.";
 };
 
+//IAccessibility2 Implementation 2009-----
+String SID_SD_A11Y_P_TITLE_N
+{
+	Text [ en-US ] = "PresentationTitle";
+};
 
+String SID_SD_A11Y_P_OUTLINER_N
+{
+	Text [ en-US ] = "PresentationOutliner";
+};
 
+String SID_SD_A11Y_P_SUBTITLE_N
+{
+	Text [ en-US ] = "PresentationSubtitle";
+};
 
+String SID_SD_A11Y_P_PAGE_N
+{
+	Text [ en-US ] = "PresentationPage";
+};
 
+String SID_SD_A11Y_P_NOTES_N
+{
+	Text [ en-US ] = "PresentationNotes";
+};
 
+String SID_SD_A11Y_P_HANDOUT_N
+{
+	Text [ en-US ] = "Handout";
+};
 
+String SID_SD_A11Y_P_UNKNOWN_N
+{
+	Text [ en-US ] = "UnknownAccessiblePresentationShape";
+};
 
+String SID_SD_A11Y_P_TITLE_D
+{
+	Text [ en-US ] = "PresentationTitleShape";
+};
 
+String SID_SD_A11Y_P_OUTLINER_D
+{
+	Text [ en-US ] = "PresentationOutlinerShape";
+};
 
+String SID_SD_A11Y_P_SUBTITLE_D
+{
+	Text [ en-US ] = "PresentationSubtitleShape";
+};
 
+String SID_SD_A11Y_P_PAGE_D
+{
+	Text [ en-US ] = "PresentationPageShape";
+};
 
+String SID_SD_A11Y_P_NOTES_D
+{
+	Text [ en-US ] = "PresentationNotesShape";
+};
 
+String SID_SD_A11Y_P_HANDOUT_D
+{
+	Text [ en-US ] = "PresentationHandoutShape";
+};
 
+String SID_SD_A11Y_P_UNKNOWN_D
+{
+	Text [ en-US ] = "Unknown accessible presentation shape";
+};
 
+String SID_SD_A11Y_P_FOOTER_N
+{
+	Text [ en-US ] = "PresentationFooter";
+};
+String SID_SD_A11Y_P_FOOTER_D
+{
+	Text [ en-US ] = "PresentationFooterShape";
+};
+String SID_SD_A11Y_P_HEADER_N
+{
+	Text [ en-US ] = "PresentationHeader";
+};
+String SID_SD_A11Y_P_HEADER_D
+{
+	Text [ en-US ] = "PresentationHeaderShape";
+};
+String SID_SD_A11Y_P_DATE_N
+{
+	Text [ en-US ] = "PresentationDateAndTime";
+};
+String SID_SD_A11Y_P_DATE_D
+{
+	Text [ en-US ] = "PresentationDateAndTimeShape";
+};
+String SID_SD_A11Y_P_NUMBER_N
+{
+	Text [ en-US ] = "PresentationPageNumber";
+};
+String SID_SD_A11Y_P_NUMBER_D
+{
+	Text [ en-US ] = "PresentationPageNumberShape";
+};
 
+String SID_SD_A11Y_D_PRESENTATION
+{
+	Text [ en-US ] = "%PRODUCTNAME Presentation";
+};
+String SID_SD_A11Y_P_TITLE_N_STYLE
+{
+	Text [ en-US ] = "Title";
+};
+String  SID_SD_A11Y_P_OUTLINER_N_STYLE
+{
+	Text [ en-US ] = "Outliner";
+};
+String  SID_SD_A11Y_P_SUBTITLE_N_STYLE
+{
+	Text [ en-US ] = "Sub Title";
+};
+String  SID_SD_A11Y_P_PAGE_N_STYLE
+{
+	Text [ en-US ] = "Page";
+};
+String  SID_SD_A11Y_P_NOTES_N_STYLE
+{
+	Text [ en-US ] = "Notes";
+};
+String  SID_SD_A11Y_P_HANDOUT_N_STYLE
+{
+	Text [ en-US ] = "Handout";
+};
+String  SID_SD_A11Y_P_UNKNOWN_N_STYLE
+{
+	Text [ en-US ] = "Unknown Accessible Presentation Shape";
+};
+String  SID_SD_A11Y_P_FOOTER_N_STYLE
+{
+	Text [ en-US ] = "Footer";
+};
+String  SID_SD_A11Y_P_HEADER_N_STYLE
+{
+	Text [ en-US ] = "Header";
+};
+String  SID_SD_A11Y_P_DATE_N_STYLE
+{
+	Text [ en-US ] = "Date";
+};
+String  SID_SD_A11Y_P_NUMBER_N_STYLE
+{
+	Text [ en-US ] = "Number";
+};
 
+String  SID_SD_A11Y_I_PREVIEW_N
+{
+	Text [ en-US ] = "Preview View";
+};
+String  SID_SD_A11Y_I_PREVIEW_D
+{
+	Text [ en-US ] = "This is where you print preview pages.";
+};
+String  SID_SD_A11Y_I_PREVIEW_SUFFIX
+{
+	Text [ en-US ] = "(Preview mode)";
+};
 
-
-
-
-
-
+String SID_SD_A11Y_D_PRESENTATION_READONLY
+{
+	Text [ en-US ] = "(read-only)";
+};
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sd/source/ui/dlg/navigatr.cxx b/main/sd/source/ui/dlg/navigatr.cxx
index 69934ac..2105cb6 100644
--- a/main/sd/source/ui/dlg/navigatr.cxx
+++ b/main/sd/source/ui/dlg/navigatr.cxx
@@ -119,6 +119,9 @@
     // set focus to listbox, otherwise it is in the toolbox which is only useful
     // for keyboard navigation
     maTlbObjects.GrabFocus();
+//IAccessibility2 Implementation 2009-----
+       maTlbObjects.SetSdNavigatorWinFlag(sal_True);
+//-----IAccessibility2 Implementation 2009
 
     // DragTypeListBox
     maLbDocs.SetSelectHdl( LINK( this, SdNavigatorWin, SelectDocumentHdl ) );
@@ -175,6 +178,28 @@
 
 // -----------------------------------------------------------------------
 
+//IAccessibility2 Implementation 2009-----
+//Solution: when object is marked , fresh the corresponding entry tree .
+//==================================================
+void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc )
+{
+	SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
+	sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh();
+	String aDocShName( pDocShell->GetName() );
+	String aDocName = pDocShell->GetMedium()->GetName();
+	maTlbObjects.SetSaveTreeItemStateFlag(sal_True); //Added by yanjun for sym2_6385
+	maTlbObjects.Clear();
+	maTlbObjects.Fill( pDoc, sal_False, aDocName ); // Nur normale Seiten
+	maTlbObjects.SetSaveTreeItemStateFlag(sal_False); //Added by yanjun for sym2_6385
+	RefreshDocumentLB();
+	maLbDocs.SelectEntry( aDocShName );
+}
+void SdNavigatorWin::FreshEntry( )
+{
+	maTlbObjects.FreshCurEntry();
+}
+//==================================================
+//-----IAccessibility2 Implementation 2009
 void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc )
 {
 	SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can...
@@ -245,7 +270,16 @@
 }
 
 // -----------------------------------------------------------------------
-
+//IAccessibility2 Implementation 2009-----
+//Solution: Get  SdDrawDocShell 
+sd::DrawDocShell* SdNavigatorWin::GetDrawDocShell( const SdDrawDocument* pDoc )
+{
+	if( !pDoc )
+		return NULL; // const as const can...
+	sd::DrawDocShell* pDocShell = pDoc->GetDocSh();
+	return pDocShell;
+}
+//-----IAccessibility2 Implementation 2009
 
 IMPL_LINK( SdNavigatorWin, SelectToolboxHdl, void *, EMPTYARG )
 {
@@ -403,6 +437,10 @@
 				SfxStringItem aItem( SID_NAVIGATOR_OBJECT, aStr );
 				mpBindings->GetDispatcher()->Execute(
 					SID_NAVIGATOR_OBJECT, SFX_CALLMODE_SLOT | SFX_CALLMODE_RECORD, &aItem, 0L );
+//IAccessibility2 Implementation 2009-----
+				//Solution: set sign variable
+				maTlbObjects.MarkCurEntry(aStr);
+//-----IAccessibility2 Implementation 2009
 
                 // #98821# moved here from SetGetFocusHdl. Reset the
                 // focus only if something has been selected in the
diff --git a/main/sd/source/ui/dlg/sdtreelb.cxx b/main/sd/source/ui/dlg/sdtreelb.cxx
index 0fb8805..273a86b 100644
--- a/main/sd/source/ui/dlg/sdtreelb.cxx
+++ b/main/sd/source/ui/dlg/sdtreelb.cxx
@@ -247,6 +247,7 @@
 
 SdPageObjsTLB::SdPageObjsTLB( Window* pParentWin, const SdResId& rSdResId ) 
 :	SvTreeListBox       ( pParentWin, rSdResId )
+,   bisInSdNavigatorWin  ( sal_False )
 ,	mpParent 		    ( pParentWin )
 ,	mpDoc			    ( NULL )
 ,	mpBookmarkDoc	    ( NULL )
@@ -260,7 +261,6 @@
 ,	mpDropNavWin		( NULL )
 ,   mbShowAllShapes     ( false )
 ,   mbShowAllPages      ( false )
-
 {
 	// Tree-ListBox mit Linien versehen
 	SetStyle( GetStyle() | WB_TABSTOP | WB_BORDER | WB_HASLINES |
@@ -295,6 +295,184 @@
         delete mpMedium;
 }
 
+//IAccessibility2 Implementation 2009-----
+// helper function for 	GetEntryAltText and GetEntryLongDescription
+String SdPageObjsTLB::getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const
+{
+	sal_uInt16 maxPages = mpDoc->GetPageCount();
+	sal_uInt16 pageNo;
+	SdrObject*	 pObj = NULL;
+	SdPage* pPage = NULL;
+
+
+	String ParentName = GetEntryText( GetRootLevelParent( pEntry ) );
+	
+	for( pageNo = 0;  pageNo < maxPages; pageNo++ )
+	{		
+		pPage = (SdPage*) mpDoc->GetPage( pageNo );
+		if( pPage->GetPageKind() != PK_STANDARD ) continue;
+		if( pPage->GetName() !=  ParentName ) continue;
+		SdrObjListIter aIter( *pPage, IM_FLAT );
+		while( aIter.IsMore() )
+		{
+			pObj = aIter.Next();
+			if( GetEntryText(pEntry) ==  GetObjectName( pObj )  )
+			{
+				if( isAltText )
+					return pObj->GetTitle();
+				else
+					return pObj->GetDescription();
+			}
+		}
+	}	
+	return String();
+
+}
+
+String SdPageObjsTLB::GetEntryAltText( SvLBoxEntry* pEntry ) const
+{
+	return getAltLongDescText( pEntry, sal_True );
+}
+
+String SdPageObjsTLB::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
+{
+	return getAltLongDescText( pEntry, sal_False);
+}
+
+void  SdPageObjsTLB::MarkCurEntry( const String& rName )
+{
+	
+	if( rName.Len() )
+	{
+		SvLBoxEntry* pCurEntry =GetCurEntry();
+		SvLBoxEntry* pEntry =NULL;
+		String aTmp1;
+		String aTmp2;
+
+	       if( GetParent(pCurEntry)==NULL )
+	       {
+	              aTmp1 = GetEntryText( pCurEntry );
+		       for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
+			{
+			       if(GetParent( pEntry )==NULL)
+				   	     continue;
+				aTmp2 = GetEntryText( GetParent( pEntry ));
+				if( aTmp1 != aTmp2)
+				{
+					// IA2 CWS. MT: Removed in SvLBoxEntry for now - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+					pEntry->SetMarked(sal_False);
+				}
+			}
+	           
+	       }
+              else
+              {
+	              for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
+			{
+				aTmp2 = GetEntryText( pEntry );
+				if( aTmp2 == rName)
+				{
+					pEntry->SetMarked(sal_True);
+				}
+				else
+				{
+				        pEntry->SetMarked(sal_False);
+				}
+			}
+              }
+	}
+	Invalidate();
+}
+
+void  SdPageObjsTLB:: FreshCurEntry()
+{
+       SvLBoxEntry* pEntry =NULL;
+       for( pEntry = First(); pEntry ; pEntry = Next( pEntry ) )
+	{
+		        pEntry->SetMarked(sal_False);
+	}
+	Invalidate();
+}
+
+class SdContentLBoxString : public SvLBoxString
+{
+public:
+	SdContentLBoxString( SvLBoxEntry* pEntry, sal_uInt16 nFlags,
+		const String& rStr ) : SvLBoxString(pEntry,nFlags,rStr)	{}
+
+	virtual void Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+		SvLBoxEntry* pEntry);
+};
+
+void SdPageObjsTLB::InitEntry(SvLBoxEntry* pEntry,
+		const XubString& rStr ,const Image& rImg1,const Image& rImg2,SvLBoxButtonKind eButtonKind)
+{
+	sal_uInt16 nColToHilite = 1; //0==Bitmap;1=="Spalte1";2=="Spalte2"
+	SvTreeListBox::InitEntry( pEntry, rStr, rImg1, rImg2, eButtonKind );
+	SvLBoxString* pCol = (SvLBoxString*)pEntry->GetItem( nColToHilite );
+	SdContentLBoxString* pStr = new SdContentLBoxString( pEntry, 0, pCol->GetText() );
+	pEntry->ReplaceItem( pStr, nColToHilite );
+}
+
+void SdContentLBoxString::Paint( const Point& rPos, SvLBox& rDev, sal_uInt16 nFlags,
+	SvLBoxEntry* pEntry )
+{
+	// IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+	/*
+	if (pEntry->IsMarked())
+	{
+			rDev.DrawText( rPos, GetText() );
+			XubString str;
+			str = XubString::CreateFromAscii("*");
+			Point rPosStar(rPos.X()-6,rPos.Y());
+			Font aOldFont( rDev.GetFont());
+			Font aFont(aOldFont);
+			Color aCol( aOldFont.GetColor() );
+			aCol.DecreaseLuminance( 200 );
+			aFont.SetColor( aCol );
+			rDev.SetFont( aFont );
+			rDev.DrawText( rPosStar, str);
+			rDev.SetFont( aOldFont );
+	}
+	else 
+	*/
+		SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
+
+}
+
+void SdPageObjsTLB::SaveExpandedTreeItemState(SvLBoxEntry* pEntry, vector<String>& vectTreeItem)
+{
+	if (pEntry)
+	{
+		SvLBoxEntry* pListEntry = pEntry;
+		while (pListEntry)
+		{
+			if (pListEntry->HasChilds())
+			{
+				if (IsExpanded(pListEntry))
+					vectTreeItem.push_back(GetEntryText(pListEntry));
+				SvLBoxEntry* pChildEntry = FirstChild(pListEntry);
+				SaveExpandedTreeItemState(pChildEntry, vectTreeItem);
+			}
+			pListEntry = NextSibling(pListEntry);
+		}
+	}
+}
+void SdPageObjsTLB::Clear()
+{
+	//Save the expanded tree item
+	if (mbSaveTreeItemState)
+	{
+		maSelectionEntryText = String();
+		maTreeItem.clear();
+		if (GetCurEntry())
+			maSelectionEntryText = GetSelectEntry();
+		SvLBoxEntry* pEntry = FirstChild(NULL);
+		SaveExpandedTreeItemState(pEntry, maTreeItem);
+	}
+	return SvTreeListBox::Clear();
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |* return name of object
@@ -448,6 +626,10 @@
 	}
 	if( aSelection.Len() )
 		SelectEntry( aSelection );
+	else if (mbSaveTreeItemState && maSelectionEntryText.Len())
+	{
+		SelectEntry(maSelectionEntryText);
+	}
 }
 
 /*************************************************************************
@@ -528,6 +710,30 @@
         IM_FLAT,
         sal_False /*not reverse*/);
 
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool  bMarked=sal_False;
+	if(bisInSdNavigatorWin)
+	{
+		Window* pWindow=NULL;
+		SdNavigatorWin* pSdNavigatorWin=NULL;
+		sd::DrawDocShell* pSdDrawDocShell = NULL;
+		if(pEntry)
+			pWindow=(Window*)GetParent(pEntry);
+		if(pWindow)
+			pSdNavigatorWin = (SdNavigatorWin*)pWindow;
+		if( pSdNavigatorWin )
+			pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);	
+		if(pSdDrawDocShell)
+			bMarked=pSdDrawDocShell->IsMarked(pShape);
+		if(pEntry)
+		{
+			if(bMarked)
+				pEntry->SetMarked(sal_True);
+			else
+				pEntry->SetMarked( sal_False );
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
     while( aIter.IsMore() )
     {
         SdrObject* pObj = aIter.Next();
@@ -542,7 +748,29 @@
             {
                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgOle, maImgOle, pEntry,
                     sal_False, LIST_APPEND, pObj);
-
+				//IAccessibility2 Implementation 2009-----
+				if(bisInSdNavigatorWin)
+				{
+					Window* pWindow=NULL;
+					SdNavigatorWin* pSdNavigatorWin=NULL;
+					sd::DrawDocShell* pSdDrawDocShell = NULL;
+					if(pNewEntry)
+						pWindow=(Window*)GetParent(pNewEntry);
+					if(pWindow)
+						pSdNavigatorWin = (SdNavigatorWin*)pWindow;
+					if( pSdNavigatorWin )
+						pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);	
+					if(pSdDrawDocShell)
+						bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
+					if(pNewEntry)
+					{
+						if(bMarked)
+							pNewEntry->SetMarked(sal_True);
+						else
+							pNewEntry->SetMarked( sal_False );
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
                 SetExpandedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
                 SetCollapsedEntryBmp( pNewEntry, maImgOleH, BMP_COLOR_HIGHCONTRAST );
             }
@@ -550,7 +778,33 @@
             {
                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, maImgGraphic, maImgGraphic, pEntry,
                     sal_False, LIST_APPEND, pObj );
-
+				//IAccessibility2 Implementation 2009-----
+				if(bisInSdNavigatorWin)
+				{
+					Window* pWindow=NULL;
+					SdNavigatorWin* pSdNavigatorWin=NULL;
+					sd::DrawDocShell* pSdDrawDocShell = NULL;
+					if(pNewEntry)
+						pWindow=(Window*)GetParent(pNewEntry);
+					if(pWindow)
+						pSdNavigatorWin = (SdNavigatorWin*)pWindow;
+					if( pSdNavigatorWin )
+						pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);	
+					if(pSdDrawDocShell)
+						bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
+					if(pNewEntry)
+					{
+						if(bMarked)  
+						{
+							pNewEntry->SetMarked(sal_True);				         	     	
+						}
+						else
+						{
+							pNewEntry->SetMarked( sal_False );
+						}
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
                 SetExpandedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
                 SetCollapsedEntryBmp( pNewEntry, maImgGraphicH, BMP_COLOR_HIGHCONTRAST );
             }
@@ -568,7 +822,33 @@
             {
                 SvLBoxEntry* pNewEntry = InsertEntry( aStr, rIconProvider.maImgObjects, rIconProvider.maImgObjects, pEntry,
                     sal_False, LIST_APPEND, pObj );
-
+				//IAccessibility2 Implementation 2009-----
+				if(bisInSdNavigatorWin)
+				{
+					Window* pWindow=NULL;
+					SdNavigatorWin* pSdNavigatorWin=NULL;
+					sd::DrawDocShell* pSdDrawDocShell = NULL;
+					if(pNewEntry)
+						pWindow=(Window*)GetParent(pNewEntry);
+					if(pWindow)
+						pSdNavigatorWin = (SdNavigatorWin*)pWindow;
+					if( pSdNavigatorWin )
+						pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);	
+					if(pSdDrawDocShell)
+						bMarked=pSdDrawDocShell->IsMarked((SdrObject*)pObj);
+					if(pNewEntry)
+					{
+						if(bMarked)  
+						{
+							pNewEntry->SetMarked(sal_True);				         	     	
+						}
+						else
+						{
+							pNewEntry->SetMarked( sal_False );
+						}
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
                 SetExpandedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
                 SetCollapsedEntryBmp( pNewEntry, rIconProvider.maImgObjectsH, BMP_COLOR_HIGHCONTRAST );
             }
@@ -591,6 +871,24 @@
             pEntry,
             bIsExcluded ? rIconProvider.maImgPageObjsExclH : rIconProvider.maImgPageObjsH,
             BMP_COLOR_HIGHCONTRAST);
+		//IAccessibility2 Implementation 2009-----
+		if (mbSaveTreeItemState)
+		{
+			vector<String>:: iterator iteStart = maTreeItem.begin();
+			while (iteStart != maTreeItem.end())
+			{
+				String strEntry = GetEntryText(pEntry);
+				if (*iteStart == strEntry)
+				{
+					Expand( pEntry );
+					break;
+				}
+				++iteStart;
+			}
+		}
+		else
+			Expand( pEntry );
+		//-----IAccessibility2 Implementation 2009
     }
 }
 
@@ -968,6 +1266,62 @@
 
 		DoubleClickHdl();
 	}
+//IAccessibility2 Implementation 2009-----
+	else if (rKEvt.GetKeyCode().GetCode() == KEY_SPACE)
+	{
+	   if(bisInSdNavigatorWin)
+	   {
+		   sal_Bool bMarked=sal_False;
+		   SvLBoxEntry* pNewEntry = GetCurEntry();
+		   if( GetParent(pNewEntry) == NULL )
+			   return;
+		   String  aStr=GetSelectEntry();
+		   Window* pWindow=NULL;
+		   SdNavigatorWin* pSdNavigatorWin=NULL;
+		   sd::DrawDocShell* pSdDrawDocShell = NULL;
+		   if(pNewEntry)
+			   pWindow=(Window*)GetParent(pNewEntry);
+		   if(pWindow)
+			   pSdNavigatorWin = (SdNavigatorWin*)pWindow;
+		   if( pSdNavigatorWin )
+			   pSdDrawDocShell = pSdNavigatorWin->GetDrawDocShell(mpDoc);	
+		   if(pSdDrawDocShell)
+		   {
+			   pSdDrawDocShell->GotoTreeBookmark(aStr);
+			   bMarked=pSdDrawDocShell->GetObjectIsmarked(aStr);
+		   }
+		   //Removed by yanjun for sym2_6385
+		   //The symphony2.0 can support morn than one level tree list, also support to select tow or more items in different level.
+		   /*
+		   SvLBoxEntry* pBeginEntry = First();
+		   if( pBeginEntry )
+		   {
+			   if( GetParent(pBeginEntry) !=  GetParent(pNewEntry) )
+				   pBeginEntry->SetMarked( sal_False );
+			   SvLBoxEntry* pNextEntry = Next( pBeginEntry );
+			   while( pNextEntry )
+			   {
+				   if( GetParent(pNextEntry) !=  GetParent(pNewEntry) )
+					   pNextEntry->SetMarked( sal_False );
+				   pNextEntry =  Next( pNextEntry );
+			   }
+		   }
+		   End*/
+		   if(pNewEntry)
+		   {
+			   if(bMarked)  
+			   {
+				   pNewEntry->SetMarked(sal_True);				         	     	
+			   }
+			   else
+			   {
+				   pNewEntry->SetMarked( sal_False );
+			   }
+		   }
+		   Invalidate();
+	   }
+	}
+//-----IAccessibility2 Implementation 2009
 	else
 		SvTreeListBox::KeyInput( rKEvt );
 }
diff --git a/main/sd/source/ui/docshell/docshel4.cxx b/main/sd/source/ui/docshell/docshel4.cxx
index 30ec29a..1216209 100644
--- a/main/sd/source/ui/docshell/docshel4.cxx
+++ b/main/sd/source/ui/docshell/docshel4.cxx
@@ -93,6 +93,10 @@
 #include "sdhtmlfilter.hxx"
 #include "framework/FrameworkHelper.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include <sfx2/viewfrm.hxx>
+#include "SdUnoDrawView.hxx"
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using ::sd::framework::FrameworkHelper;
@@ -574,6 +578,22 @@
 
 sal_Bool DrawDocShell::SaveAs( SfxMedium& rMedium )
 {
+//IAccessibility2 Implementation 2009-----
+	mpDoc->setDocAccTitle(String());
+	SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
+	if (pFrame1)
+	{
+		::Window* pWindow = &pFrame1->GetWindow();
+		if ( pWindow )
+		{
+			::Window* pSysWin = pWindow->GetSystemWindow();
+			if ( pSysWin )
+			{
+				pSysWin->SetAccessibleName(String());
+			}
+		}
+	}
+//-----IAccessibility2 Implementation 2009
 	mpDoc->StopWorkStartupDelay();
 
     //TODO/LATER: why this?!
@@ -908,6 +928,241 @@
 	return (bFound);
 }
 
+//IAccessibility2 Implementation 2009-----
+//Solution: If  object  is marked , return true , else return false . 
+sal_Bool DrawDocShell::IsMarked(  SdrObject* pObject  )
+{
+       sal_Bool bisMarked =sal_False;
+
+	 if (mpViewShell && mpViewShell->ISA(DrawViewShell))
+	{
+		DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell;
+		if (pObject )
+		{
+		      bisMarked = pDrViewSh->GetView()->IsObjMarked(pObject);
+		}
+	 }
+	return  bisMarked;
+}
+//Solution: If  object  is marked , return true , else return false . 
+sal_Bool DrawDocShell::GetObjectIsmarked(const String& rBookmark)
+{
+    OSL_TRACE("GotoBookmark %s",
+        ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
+     sal_Bool bUnMark = sal_False;
+
+	if (mpViewShell && mpViewShell->ISA(DrawViewShell))
+	{
+		DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell;
+
+		String aBookmark( rBookmark );
+
+		if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
+			aBookmark = rBookmark.Copy( 1 );
+
+		// Ist das Bookmark eine Seite?
+		sal_Bool        bIsMasterPage;
+        sal_uInt16      nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
+		SdrObject*  pObj = NULL;
+
+		if (nPgNum == SDRPAGE_NOTFOUND)
+		{
+			// Ist das Bookmark ein Objekt?
+			pObj = mpDoc->GetObj(aBookmark);
+
+			if (pObj)
+			{
+				nPgNum = pObj->GetPage()->GetPageNum();
+			}
+		}
+
+		if (nPgNum != SDRPAGE_NOTFOUND)
+		{
+			/**********************************************************
+			* Zur Seite springen
+			**********************************************************/
+		
+			SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum);
+
+			PageKind eNewPageKind = pPage->GetPageKind();
+
+			if (eNewPageKind != pDrViewSh->GetPageKind())
+			{
+				// Arbeitsbereich wechseln
+				GetFrameView()->SetPageKind(eNewPageKind);
+				( ( mpViewShell && mpViewShell->GetViewFrame() ) ?
+				  mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->
+				  GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+
+				// Die aktuelle ViewShell hat sich geaendert!
+				pDrViewSh = (DrawViewShell*) mpViewShell;
+			}
+
+			EditMode eNewEditMode = EM_PAGE;
+
+			if( bIsMasterPage )
+			{
+				eNewEditMode = EM_MASTERPAGE;
+			}
+
+			if (eNewEditMode != pDrViewSh->GetEditMode())
+			{
+				// EditMode setzen
+				pDrViewSh->ChangeEditMode(eNewEditMode, sal_False);
+			}
+
+			// Jump to the page.  This is done by using the API because this
+			// takes care of all the little things to be done.  Especially
+			// writing the view data to the frame view (see bug #107803#).
+			sal_uInt16 nSdPgNum = (nPgNum - 1) / 2;
+            SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
+                pDrViewSh->GetViewShellBase().GetDrawController(),
+                *pDrViewSh,
+                *pDrViewSh->GetView());
+            if (pUnoDrawView != NULL)
+            {
+                ::com::sun::star::uno::Reference<
+                      ::com::sun::star::drawing::XDrawPage> xDrawPage (
+                          pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
+                pUnoDrawView->setCurrentPage (xDrawPage);
+            }
+            else
+            {
+                // As a fall back switch to the page via the core.
+                DBG_ASSERT (pUnoDrawView!=NULL,
+                    "SdDrawDocShell::GotoBookmark: can't switch page via API");
+                pDrViewSh->SwitchPage(nSdPgNum);
+            }
+			delete pUnoDrawView;
+
+
+			if (pObj)
+			{
+				// Objekt einblenden und selektieren
+				pDrViewSh->MakeVisible(pObj->GetLogicRect(),
+									   *pDrViewSh->GetActiveWindow());
+				
+		         bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj);
+				
+		            
+			}
+		}
+	}
+
+	return ( bUnMark);
+}
+//Solution: realize multi-selection of objects
+sal_Bool DrawDocShell::GotoTreeBookmark(const String& rBookmark)
+{
+    OSL_TRACE("GotoBookmark %s",
+        ::rtl::OUStringToOString(rBookmark, RTL_TEXTENCODING_UTF8).getStr());
+	sal_Bool bFound = sal_False;
+
+	if (mpViewShell && mpViewShell->ISA(DrawViewShell))
+	{
+		DrawViewShell* pDrViewSh = (DrawViewShell*) mpViewShell;
+
+		String aBookmark( rBookmark );
+
+		if( rBookmark.Len() && rBookmark.GetChar( 0 ) == sal_Unicode('#') )
+			aBookmark = rBookmark.Copy( 1 );
+
+		// Ist das Bookmark eine Seite?
+		sal_Bool        bIsMasterPage;
+        sal_uInt16      nPgNum = mpDoc->GetPageByName( aBookmark, bIsMasterPage );
+		SdrObject*  pObj = NULL;
+
+		if (nPgNum == SDRPAGE_NOTFOUND)
+		{
+			// Ist das Bookmark ein Objekt?
+			pObj = mpDoc->GetObj(aBookmark);
+
+			if (pObj)
+			{
+				nPgNum = pObj->GetPage()->GetPageNum();
+			}
+		}
+
+		if (nPgNum != SDRPAGE_NOTFOUND)
+		{
+			/**********************************************************
+			* Zur Seite springen
+			**********************************************************/
+			bFound = sal_True;
+			SdPage* pPage = (SdPage*) mpDoc->GetPage(nPgNum);
+
+			PageKind eNewPageKind = pPage->GetPageKind();
+
+			if (eNewPageKind != pDrViewSh->GetPageKind())
+			{
+				// Arbeitsbereich wechseln
+				GetFrameView()->SetPageKind(eNewPageKind);
+				( ( mpViewShell && mpViewShell->GetViewFrame() ) ?
+				  mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->
+				  GetDispatcher()->Execute( SID_VIEWSHELL0, SFX_CALLMODE_SYNCHRON | SFX_CALLMODE_RECORD );
+
+				// Die aktuelle ViewShell hat sich geaendert!
+				pDrViewSh = (DrawViewShell*) mpViewShell;
+			}
+
+			EditMode eNewEditMode = EM_PAGE;
+
+			if( bIsMasterPage )
+			{
+				eNewEditMode = EM_MASTERPAGE;
+			}
+
+			if (eNewEditMode != pDrViewSh->GetEditMode())
+			{
+				// EditMode setzen
+				pDrViewSh->ChangeEditMode(eNewEditMode, sal_False);
+			}
+
+			// Jump to the page.  This is done by using the API because this
+			// takes care of all the little things to be done.  Especially
+			// writing the view data to the frame view (see bug #107803#).
+			sal_uInt16 nSdPgNum = (nPgNum - 1) / 2;
+            SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
+                pDrViewSh->GetViewShellBase().GetDrawController(),
+                *pDrViewSh,
+                *pDrViewSh->GetView());
+            if (pUnoDrawView != NULL)
+            {
+                ::com::sun::star::uno::Reference<
+                      ::com::sun::star::drawing::XDrawPage> xDrawPage (
+                          pPage->getUnoPage(), ::com::sun::star::uno::UNO_QUERY);
+                pUnoDrawView->setCurrentPage (xDrawPage);
+            }
+            else
+            {
+                // As a fall back switch to the page via the core.
+                DBG_ASSERT (pUnoDrawView!=NULL,
+                    "SdDrawDocShell::GotoBookmark: can't switch page via API");
+                pDrViewSh->SwitchPage(nSdPgNum);
+            }
+			delete pUnoDrawView;
+
+
+			if (pObj)
+			{
+				// Objekt einblenden und selektieren
+				pDrViewSh->MakeVisible(pObj->GetLogicRect(),
+									   *pDrViewSh->GetActiveWindow());
+		              sal_Bool bUnMark = pDrViewSh->GetView()->IsObjMarked(pObj);
+				pDrViewSh->GetView()->MarkObj(pObj, pDrViewSh->GetView()->GetSdrPageView(), bUnMark);
+			}
+		}
+
+		SfxBindings& rBindings = ( ( mpViewShell && mpViewShell->GetViewFrame() ) ?
+								 mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings();
+
+		rBindings.Invalidate(SID_NAVIGATOR_STATE, sal_True, sal_False);
+		rBindings.Invalidate(SID_NAVIGATOR_PAGENAME);
+	}
+
+	return (bFound);
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |* SaveAsOwnFormat: wenn es eine Dokumentvorlage werden soll,
@@ -1031,4 +1286,39 @@
 	( mpViewShell ? mpViewShell->GetViewFrame() : SfxViewFrame::Current() )->GetBindings().Execute( SID_OPENHYPERLINK, ppArgs );
 }
 
+//IAccessibility2 Implementation 2009-----
+void DrawDocShell::setDocAccTitle( const String& rTitle )
+{ 
+	if (mpDoc ) 
+	{
+		mpDoc->setDocAccTitle( rTitle );
+	}
+}
+const String DrawDocShell::getDocAccTitle() const
+{
+	String sRet;
+	if  (mpDoc)
+	{
+		sRet =  mpDoc->getDocAccTitle(); 
+	}
+
+	return sRet;
+}
+void DrawDocShell::setDocReadOnly( sal_Bool bReadOnly)
+{ 
+	if (mpDoc ) 
+	{
+		mpDoc->setDocReadOnly( bReadOnly );
+	}
+}
+sal_Bool DrawDocShell::getDocReadOnly() const
+{
+	if  (mpDoc)
+	{
+		return mpDoc->getDocReadOnly(); 
+	}
+
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace sd
diff --git a/main/sd/source/ui/func/fudraw.cxx b/main/sd/source/ui/func/fudraw.cxx
index dea1d0c..a816c33 100644
--- a/main/sd/source/ui/func/fudraw.cxx
+++ b/main/sd/source/ui/func/fudraw.cxx
@@ -470,10 +470,16 @@
 				// changeover to the next object
 				if(!mpView->MarkNextObj( !aCode.IsShift() ))
 				{
-					// #97016# No next object: go over open end and
-					// get first from the other side
-					mpView->UnmarkAllObj();
-					mpView->MarkNextObj(!aCode.IsShift());
+					//IAccessibility2 Implementation 2009-----
+					//If there is only one object, don't do the UnmarkAlllObj() & MarkNextObj(). 
+					if ( mpView->GetMarkableObjCount() > 1 && mpView->AreObjectsMarked() )
+					{
+						// #97016# No next object: go over open end and
+						// get first from the other side
+						mpView->UnmarkAllObj();
+						mpView->MarkNextObj(!aCode.IsShift());
+					}
+					//-----IAccessibility2 Implementation 2009
 				}
 
 				// #97016# II
diff --git a/main/sd/source/ui/func/fuediglu.cxx b/main/sd/source/ui/func/fuediglu.cxx
index a35e70f..bcafec4 100644
--- a/main/sd/source/ui/func/fuediglu.cxx
+++ b/main/sd/source/ui/func/fuediglu.cxx
@@ -63,6 +63,12 @@
     SdDrawDocument*	pDoc,
     SfxRequest& rReq) 
     : FuDraw(pViewSh, pWin, pView, pDoc, rReq)
+//IAccessibility2 Implementation 2009-----
+	 //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+	 //and SHIFT+ENTER key to decide the postion and draw the new insert point
+	 ,bBeginInsertPoint(sal_False),
+	oldPoint(0,0)
+//-----IAccessibility2 Implementation 2009
 {
 }
 
@@ -321,11 +327,108 @@
 {
 	mpView->SetActualWin( mpWindow );
 
-	sal_Bool bReturn = FuDraw::KeyInput(rKEvt);
+//IAccessibility2 Implementation 2009-----
+	//Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+	//and SHIFT+ENTER key to decide the postion and draw the new insert point
+	//sal_Bool bReturn = FuDraw::KeyInput(rKEvt);
 
+	sal_Bool bReturn = sal_False;
+	
+	switch (rKEvt.GetKeyCode().GetCode())
+	{
+		case KEY_UP:
+		case KEY_DOWN:
+		case KEY_LEFT:
+		case KEY_RIGHT:
+		{
+			if(rKEvt.GetKeyCode().IsShift()&& mpView->IsInsGluePointMode() ){
+				long nX = 0;
+				long nY = 0;
+				sal_uInt16  nCode = rKEvt.GetKeyCode().GetCode();
+				if (nCode == KEY_UP)
+				{
+					// Scroll nach oben
+					nX = 0;
+					nY =-1;
+				}
+				else if (nCode == KEY_DOWN)
+				{
+					// Scroll nach unten
+					nX = 0;
+					nY = 1;
+				}
+				else if (nCode == KEY_LEFT)
+				{
+					// Scroll nach links
+					nX =-1;
+					nY = 0;
+				}
+				else if (nCode == KEY_RIGHT)
+				{
+					// Scroll nach rechts
+					nX = 1;
+					nY = 0;
+				}
+				Point centerPoint;
+				Rectangle rect = mpView->GetMarkedObjRect();
+				centerPoint = mpWindow->LogicToPixel(rect.Center());
+				Point aPoint = bBeginInsertPoint? oldPoint:centerPoint;
+				Point ePoint = aPoint + Point(nX,nY);
+				mpWindow->SetPointerPosPixel(ePoint);
+				//simulate mouse move action
+				MouseEvent eMevt(ePoint,1,2,MOUSE_LEFT, 0);
+				MouseMove(eMevt);
+	                     Point aPix(eMevt.GetPosPixel());
+				oldPoint = ePoint;
+				bBeginInsertPoint = sal_True;
+				bReturn = sal_True;
+			}
+		}
+		break;
+		case KEY_RETURN:
+			if(rKEvt.GetKeyCode().IsShift() && mpView->IsInsGluePointMode() )
+			{
+				if(bBeginInsertPoint)
+				{
+					mpWindow->SetPointerPosPixel(oldPoint);
+					//simulate mouse button down action
+					MouseEvent aMevt(oldPoint,1,3,MOUSE_LEFT,KEY_SHIFT);
+					// MT IA2: Not used?
+					// sal_uInt16 ubuttons = aMevt.GetButtons();
+					// sal_uInt16 uMod		= aMevt.GetModifier();
+					MouseButtonDown(aMevt);
+					mpWindow->CaptureMouse();
+					//simulate mouse button up action
+					MouseEvent rMEvt(oldPoint+Point(0,0),1,17, MOUSE_LEFT, KEY_SHIFT);
+					MouseButtonUp(rMEvt);
+					bReturn= sal_True;
+				}
+			}
+			break;
+	}
+	if(!bReturn)
+		bReturn = FuDraw::KeyInput(rKEvt);
+//-----IAccessibility2 Implementation 2009
 	return bReturn;
 }
 
+//IAccessibility2 Implementation 2009-----
+ //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+ //and SHIFT+ENTER key to decide the postion and draw the new insert point
+void FuEditGluePoints::ForcePointer(const MouseEvent* pMEvt)
+{
+	if(bBeginInsertPoint && pMEvt)
+	{
+		MouseEvent aMEvt(pMEvt->GetPosPixel(), pMEvt->GetClicks(), 
+			pMEvt->GetMode(), pMEvt->GetButtons(), pMEvt->GetModifier() & ~KEY_SHIFT);  
+		FuDraw::ForcePointer(&aMEvt);
+	}
+	else
+	{
+		FuDraw::ForcePointer(pMEvt);
+	}
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |* Command-event
diff --git a/main/sd/source/ui/func/fusel.cxx b/main/sd/source/ui/func/fusel.cxx
index 6e3cd47..9ccf41a 100644
--- a/main/sd/source/ui/func/fusel.cxx
+++ b/main/sd/source/ui/func/fusel.cxx
@@ -113,6 +113,13 @@
       bMirrorSide0(sal_False),
       nEditMode(SID_BEZIER_MOVE),
       pWaterCanCandidate(NULL)
+//IAccessibility2 Implementation 2009-----
+  //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+  //and SHIFT+ENTER key to decide the postion and draw the new insert point
+    ,bBeginInsertPoint(sal_False),
+  	oldPoint(0,0)
+  ,bMovedToCenterPoint(sal_False)
+//-----IAccessibility2 Implementation 2009
 {
 }
 
@@ -948,8 +955,80 @@
 			bReturn = FuSelection::cancel();
         }
         break;
+//IAccessibility2 Implementation 2009-----
+  //Solution: add keyboard operation for insert points in drawing curve
+		case KEY_UP:
+		case KEY_DOWN:
+		case KEY_LEFT:
+		case KEY_RIGHT:
+		{
+			if(rKEvt.GetKeyCode().IsShift()&&(nEditMode == SID_BEZIER_INSERT)){
+				long nX = 0;
+				long nY = 0;
+				sal_uInt16  nCode = rKEvt.GetKeyCode().GetCode();
+				if (nCode == KEY_UP)
+				{
+					// Scroll nach oben
+					nX = 0;
+					nY =-1;
     }
+				else if (nCode == KEY_DOWN)
+				{
+					// Scroll nach unten
+					nX = 0;
+					nY = 1;
+				}
+				else if (nCode == KEY_LEFT)
+				{
+					// Scroll nach links
+					nX =-1;
+					nY = 0;
+				}
+				else if (nCode == KEY_RIGHT)
+				{
+					// Scroll nach rechts
+					nX = 1;
+					nY = 0;
+				}
 
+				Point centerPoint;
+				Rectangle rect = mpView->GetMarkedObjRect();
+				centerPoint = mpWindow->LogicToPixel(rect.Center());
+				Point aPoint = bMovedToCenterPoint? oldPoint:centerPoint;
+				Point ePoint = aPoint + Point(nX,nY);
+				mpWindow->SetPointerPosPixel(ePoint);
+				//simulate mouse move action
+				MouseEvent eMevt(ePoint,1,2, MOUSE_LEFT, 0);
+				MouseMove(eMevt);
+				oldPoint = ePoint;
+				bMovedToCenterPoint = sal_True;
+				bReturn = sal_True;
+			}
+		}
+		break;
+		case KEY_RETURN:
+			if(rKEvt.GetKeyCode().IsShift()&&(nEditMode == SID_BEZIER_INSERT))
+			{
+				if(!bBeginInsertPoint)
+				{
+					//simulate mouse button down action
+					MouseEvent aMevt(oldPoint,1,3, MOUSE_LEFT, KEY_SHIFT);
+					MouseButtonDown(aMevt);
+					mpWindow->CaptureMouse();
+					bBeginInsertPoint = sal_True;
+				}
+				else
+				{
+					//simulate mouse button up action
+					MouseEvent rMEvt(oldPoint,1,17, MOUSE_LEFT, KEY_SHIFT);
+					MouseButtonUp(rMEvt);
+					bBeginInsertPoint = sal_False;
+				}
+				bReturn= sal_True;
+			}
+			break;
+    }
+//-----IAccessibility2 Implementation 2009
 	if (!bReturn)
 	{
 		bReturn = FuDraw::KeyInput(rKEvt);
@@ -967,6 +1046,21 @@
 }
 
 
+//IAccessibility2 Implementation 2009-----
+void FuSelection::ForcePointer(const MouseEvent* pMEvt)
+{
+	if(bMovedToCenterPoint && !bBeginInsertPoint && pMEvt)
+	{
+		MouseEvent aMEvt(pMEvt->GetPosPixel(), pMEvt->GetClicks(), 
+			pMEvt->GetMode(), pMEvt->GetButtons(), pMEvt->GetModifier() & ~KEY_SHIFT);  
+		FuDraw::ForcePointer(&aMEvt);
+	}
+	else
+	{
+		FuDraw::ForcePointer(pMEvt);
+	}
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |* Function aktivieren
diff --git a/main/sd/source/ui/inc/AccessibleDocumentViewBase.hxx b/main/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
index 22b9aed..f0f2ea8 100644
--- a/main/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
+++ b/main/sd/source/ui/inc/AccessibleDocumentViewBase.hxx
@@ -38,6 +38,17 @@
 #include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
 #include <tools/link.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include "DrawViewShell.hxx"
+#include "sdpage.hxx"
+#include "drawdoc.hxx"
+#include "FrameView.hxx"
+#include "PresentationViewShell.hxx"
+#include <editeng/outlobj.hxx>
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
+class SdViewShell;
+//-----IAccessibility2 Implementation 2009
 namespace sd {
 class ViewShell;
 class Window;
@@ -86,6 +97,10 @@
         public ::com::sun::star::beans::XPropertyChangeListener,
         public ::com::sun::star::awt::XWindowListener,
         public ::com::sun::star::awt::XFocusListener
+//IAccessibility2 Implementation 2009-----
+		,public ::com::sun::star::accessibility::XAccessibleExtendedAttributes
+	       ,public com::sun::star::accessibility::XAccessibleGetAccFlowTo
+//-----IAccessibility2 Implementation 2009
 {
 public:
     //=====  internal  ========================================================
@@ -250,7 +265,12 @@
         throw (::com::sun::star::uno::RuntimeException); 
 	virtual void SAL_CALL focusLost (const ::com::sun::star::awt::FocusEvent& e)
         throw (::com::sun::star::uno::RuntimeException); 
-
+//IAccessibility2 Implementation 2009-----
+	//----------------------------xAttribute----------------------------
+	virtual com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	 ::sd::ViewShell* mpViewShell;
+//-----IAccessibility2 Implementation 2009
 private:
 
     // return the member maMutex;
@@ -359,7 +379,20 @@
     virtual void SetAccessibleOLEObject (
         const ::com::sun::star::uno::Reference <
         ::com::sun::star::accessibility::XAccessible>& xOLEObject);
+//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleGetAccFromXShape  ============================================
+	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException );
 
+public:
+	virtual void SwitchViewActivated (void) { Activated(); }
+	 virtual sal_Int32 SAL_CALL getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
     virtual void impl_dispose (void);
 };
 
diff --git a/main/sd/source/ui/inc/AccessibleDrawDocumentView.hxx b/main/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
index 19d7b82..c9bb9de 100644
--- a/main/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
+++ b/main/sd/source/ui/inc/AccessibleDrawDocumentView.hxx
@@ -26,6 +26,10 @@
 
 #include "AccessibleDocumentViewBase.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
+//-----IAccessibility2 Implementation 2009
+
 namespace accessibility {
 
 
@@ -39,6 +43,9 @@
 */
 class AccessibleDrawDocumentView : 
     public AccessibleDocumentViewBase
+//IAccessibility2 Implementation 2009-----
+    ,public ::com::sun::star::accessibility::XAccessibleGroupPosition
+//-----IAccessibility2 Implementation 2009
 {
 public:
     //=====  internal  ========================================================
@@ -73,6 +80,11 @@
         throw (::com::sun::star::uno::RuntimeException,
             ::com::sun::star::lang::IndexOutOfBoundsException);
 
+//IAccessibility2 Implementation 2009-----
+	virtual ::rtl::OUString SAL_CALL
+		getAccessibleName(void)
+		throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 
     //=====  lang::XEventListener  ============================================
 
@@ -86,6 +98,28 @@
 	virtual void SAL_CALL
 		propertyChange (const ::com::sun::star::beans::PropertyChangeEvent& rEventObject)
         throw (::com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+    //=====  XInterface  ======================================================
+    
+    virtual com::sun::star::uno::Any SAL_CALL
+		queryInterface (const com::sun::star::uno::Type & rType)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual void SAL_CALL
+        acquire (void) 
+        throw ();
+        
+    virtual void SAL_CALL
+        release (void)
+        throw ();
+	
+    //=====  XAccessibleGroupPosition  =========================================
+	virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+		getGroupPosition( const ::com::sun::star::uno::Any& rAny )
+        throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject )
+        throw (::com::sun::star::uno::RuntimeException);	
+//-----IAccessibility2 Implementation 2009
 
 protected:
 
@@ -120,6 +154,10 @@
     virtual void
         implSelect( sal_Int32 nAccessibleChildIndex, sal_Bool bSelect ) 
         throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+private:
+	::sd::ViewShell* mpSdViewSh;
+//-----IAccessibility2 Implementation 2009
 
 protected:
     /** This object manages the shapes of the represented draw page.  It is
@@ -159,6 +197,15 @@
     virtual void Deactivated (void);
 
     virtual void impl_dispose (void);
+
+//IAccessibility2 Implementation 2009-----
+    //=====  XAccessibleGetAccFromXShape  ============================================
+	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException );
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+		GetSelAccContextInTable();
+//-----IAccessibility2 Implementation 2009
     
 private:
     void UpdateAccessibleName (void);
diff --git a/main/sd/source/ui/inc/AccessibleOutlineView.hxx b/main/sd/source/ui/inc/AccessibleOutlineView.hxx
index 203bf82..e568d5a 100644
--- a/main/sd/source/ui/inc/AccessibleOutlineView.hxx
+++ b/main/sd/source/ui/inc/AccessibleOutlineView.hxx
@@ -75,7 +75,11 @@
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
         getAccessibleChild (sal_Int32 nIndex)
         throw (::com::sun::star::uno::RuntimeException);
-
+//IAccessibility2 Implementation 2009-----
+    virtual ::rtl::OUString SAL_CALL
+        getAccessibleName(void)
+        throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
     //=====  XAccessibleEventBroadcaster  ========================================
 
     virtual void SAL_CALL 
diff --git a/main/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx b/main/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx
index 4fb18c7..58c9718 100644
--- a/main/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx
+++ b/main/sd/source/ui/inc/AccessiblePresentationGraphicShape.hxx
@@ -27,6 +27,9 @@
 
 #include <svx/AccessibleGraphicShape.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+//-----IAccessibility2 Implementation 2009
 namespace accessibility {
 
 /**	This class makes Impress shapes accessible.
@@ -60,6 +63,10 @@
 	virtual ::rtl::OUString
     	CreateAccessibleDescription ()
         throw (::com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+	///	Return this object's role.
+	virtual sal_Int16 SAL_CALL getAccessibleRole () throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 };
 
 } // end of namespace accessibility
diff --git a/main/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx b/main/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx
index 4291abf..b47b201 100644
--- a/main/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx
+++ b/main/sd/source/ui/inc/AccessiblePresentationOLEShape.hxx
@@ -27,6 +27,9 @@
 
 #include <svx/AccessibleOLEShape.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+//-----IAccessibility2 Implementation 2009
 namespace accessibility {
 
 /**	This class makes Impress shapes accessible.
@@ -60,6 +63,10 @@
 	virtual ::rtl::OUString
     	CreateAccessibleDescription ()
         throw (::com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+	///	Return this object's role.
+	virtual sal_Int16 SAL_CALL getAccessibleRole () throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 };
 
 } // end of namespace accessibility
diff --git a/main/sd/source/ui/inc/AccessiblePresentationShape.hxx b/main/sd/source/ui/inc/AccessiblePresentationShape.hxx
index 29dda19..3dd780e 100644
--- a/main/sd/source/ui/inc/AccessiblePresentationShape.hxx
+++ b/main/sd/source/ui/inc/AccessiblePresentationShape.hxx
@@ -59,6 +59,9 @@
 	virtual ::rtl::OUString
     	CreateAccessibleDescription ()
         throw (::com::sun::star::uno::RuntimeException);
+//IAccessibility2 Implementation 2009-----
+	::rtl::OUString GetStyle();
+//-----IAccessibility2 Implementation 2009
 
 private:
     /** Don't use the default constructor.  Use the public constructor that 
diff --git a/main/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/main/sd/source/ui/inc/AccessibleSlideSorterView.hxx
index a602de9..332d4bb 100644
--- a/main/sd/source/ui/inc/AccessibleSlideSorterView.hxx
+++ b/main/sd/source/ui/inc/AccessibleSlideSorterView.hxx
@@ -286,7 +286,8 @@
     	getSupportedServiceNames (void)
         throw (::com::sun::star::uno::RuntimeException);
 
-    
+	// IAccessibility2 Implementation 2009
+	virtual void SwitchViewActivated (void);
 private:
     class Implementation;
     ::std::auto_ptr<Implementation> mpImpl;
diff --git a/main/sd/source/ui/inc/AccessibleSlideView.hxx b/main/sd/source/ui/inc/AccessibleSlideView.hxx
index 8d6b94e..249b5c7 100644
--- a/main/sd/source/ui/inc/AccessibleSlideView.hxx
+++ b/main/sd/source/ui/inc/AccessibleSlideView.hxx
@@ -25,7 +25,10 @@
 #define SD_ACCESSIBILITY_ACCESSIBLE_SLIDE_VIEW_HXX
 
 #include <cppuhelper/implbase6.hxx>
-#include <cppuhelper/implbase7.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <cppuhelper/implbase9.hxx>
+//#include <cppuhelper/implbase7.hxx>
+//-----IAccessibility2 Implementation 2009
 #include "SlideView.hxx"
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <com/sun/star/accessibility/XAccessible.hpp>
@@ -35,6 +38,9 @@
 #include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
 #include <com/sun/star/lang/XServiceInfo.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+//-----IAccessibility2 Implementation 2009
 #include <vector>
 
 class SdDrawDocument;
@@ -156,14 +162,18 @@
 // - AccessibleSlideView -
 // -----------------------
 
-class AccessibleSlideView : public ::cppu::WeakImplHelper7< 
+class AccessibleSlideView : public ::cppu::WeakImplHelper9< 
     ::com::sun::star::lang::XUnoTunnel,
     ::com::sun::star::accessibility::XAccessible,
     ::com::sun::star::accessibility::XAccessibleEventBroadcaster,
     ::com::sun::star::accessibility::XAccessibleContext,
     ::com::sun::star::accessibility::XAccessibleComponent,
     ::com::sun::star::accessibility::XAccessibleSelection,
-    ::com::sun::star::lang::XServiceInfo >
+    ::com::sun::star::lang::XServiceInfo
+//IAccessibility2 Implementation 2009-----
+	,::com::sun::star::accessibility::XAccessibleExtendedAttributes
+	,::com::sun::star::awt::XFocusListener >
+//-----IAccessibility2 Implementation 2009
 {
 public:
 
@@ -189,8 +199,18 @@
 	void			            SetPageVisible( sal_uInt16 nPage, sal_Bool bVisible );
 	void			            Reset();
     void                        FocusHasChanged( sal_uInt16 nOldFocusPage, sal_uInt16 nNewFocusPage );
-
-
+//IAccessibility2 Implementation 2009-----
+	void 			SelectionHasChanged (sal_uInt16 nPage, sal_Bool bSelect );
+	//=====  XFocusListener  =================================================
+	virtual void SAL_CALL focusGained (const ::com::sun::star::awt::FocusEvent& e)
+		throw (::com::sun::star::uno::RuntimeException); 
+	virtual void SAL_CALL focusLost (const ::com::sun::star::awt::FocusEvent& e)
+		throw (::com::sun::star::uno::RuntimeException); 
+	//=====  lang::XEventListener  ============================================
+	virtual void SAL_CALL disposing (const struct com::sun::star::lang::EventObject &) throw (::com::sun::star::uno::RuntimeException);
+	// This method is called from the component helper base class while disposing.
+	virtual void SAL_CALL disposing (void);
+//-----IAccessibility2 Implementation 2009
 private:
     ::osl::Mutex maMutex;
 	::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > >               maSlidePageObjects;
@@ -199,6 +219,10 @@
     ::sd::Window* mpParentWindow;
      /// client id in the AccessibleEventNotifier queue
     sal_uInt32 mnClientId;
+//IAccessibility2 Implementation 2009-----
+	sal_uInt32	nFocusPageIndex;
+	::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow>			mxWindow;
+//-----IAccessibility2 Implementation 2009
 
     // internal
 	static const ::com::sun::star::uno::Sequence< sal_Int8 >&                                   getUnoTunnelId();
@@ -253,6 +277,11 @@
 
 	//=====  XServiceInfo  ====================================================
 
+//IAccessibility2 Implementation 2009-----
+	//----------------------------xAttribute----------------------------
+	virtual com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+//-----IAccessibility2 Implementation 2009
     /**	Returns an identifier for the implementation of this object.
     */
 	virtual ::rtl::OUString SAL_CALL
diff --git a/main/sd/source/ui/inc/DrawController.hxx b/main/sd/source/ui/inc/DrawController.hxx
index 082a0bb..2099642 100644
--- a/main/sd/source/ui/inc/DrawController.hxx
+++ b/main/sd/source/ui/inc/DrawController.hxx
@@ -44,6 +44,9 @@
 #include <memory>
 #include <vector>
 #include <boost/scoped_ptr.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/drawing/XLayer.hpp>
+//-----IAccessibility2 Implementation 2009
 
 class SfxViewShell;
 class SdXImpressDocument;
@@ -102,6 +105,10 @@
         PROPERTY_ZOOMVALUE = 7,
         PROPERTY_VIEWOFFSET = 8,
 		PROPERTY_DRAWVIEWMODE = 9
+		//IAccessibility2 Implementation 2009-----
+		,PROPERTY_UPDATEACC = 10
+		,PROPERTY_PAGE_CHANGE = 11
+		//-----IAccessibility2 Implementation 2009
     };
 
     /** Create a new DrawController object for the given ViewShellBase.
@@ -147,7 +154,15 @@
         switch.
     */
     void BroadcastContextChange (void) const;
-    
+//IAccessibility2 Implementation 2009-----
+	void NotifyAccUpdate();
+	void fireChangeLayer( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* pCurrentLayer ) throw();
+	// change the parameter to int
+	//void fireSwitchCurrentPage( String pageName) throw();
+	void fireSwitchCurrentPage( sal_Int32 pageIndex) throw();
+	::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* mpCurrentLayer;
+//-----IAccessibility2 Implementation 2009
+
     /** Return a pointer to the ViewShellBase object that the DrawController
         is connected to.
         @return
diff --git a/main/sd/source/ui/inc/DrawDocShell.hxx b/main/sd/source/ui/inc/DrawDocShell.hxx
index dc35627..08e2c43 100644
--- a/main/sd/source/ui/inc/DrawDocShell.hxx
+++ b/main/sd/source/ui/inc/DrawDocShell.hxx
@@ -136,6 +136,12 @@
 
 	sal_Bool			        GotoBookmark(const String& rBookmark);
 
+//IAccessibility2 Implementation 2009-----
+	//Solution: realize multi-selection of objects
+	sal_Bool					GotoTreeBookmark(const String& rBookmark);
+	sal_Bool					IsMarked(  SdrObject* pObject  ); 
+	sal_Bool					GetObjectIsmarked(const String& rBookmark);
+//-----IAccessibility2 Implementation 2009
 	Bitmap                  GetPagePreviewBitmap(SdPage* pPage, sal_uInt16 nMaxEdgePixel);
 
     /** checks, if the given name is a valid new name for a slide
@@ -225,6 +231,13 @@
 	bool					mbOwnDocument;			// if true, we own mpDoc and will delete it in our d'tor
     void					Construct(bool bClipboard);
     virtual void            InPlaceActivate( sal_Bool bActive );
+//IAccessibility2 Implementation 2009-----
+public:
+	virtual void setDocAccTitle( const String& rTitle );
+	virtual const String getDocAccTitle() const;
+	virtual void setDocReadOnly( sal_Bool bReadOnly);
+	virtual sal_Bool getDocReadOnly() const;
+//-----IAccessibility2 Implementation 2009
 };
 
 #ifndef SV_DECL_DRAW_DOC_SHELL_DEFINED
diff --git a/main/sd/source/ui/inc/DrawViewShell.hxx b/main/sd/source/ui/inc/DrawViewShell.hxx
index c188a16..157f796 100644
--- a/main/sd/source/ui/inc/DrawViewShell.hxx
+++ b/main/sd/source/ui/inc/DrawViewShell.hxx
@@ -252,6 +252,12 @@
 	sal_Bool		    IsSwitchPageAllowed() const;
 
 	sal_Bool		    GotoBookmark(const String& rBookmark);
+//IAccessibility2 Implementation 2009-----
+	//Solution: realize multi-selection of objects ,If object is marked , 
+	//the corresponding entry is set true ,else the corresponding entry is set false .
+	void                    FreshNavigatrEntry();
+	void                    FreshNavigatrTree();
+//-----IAccessibility2 Implementation 2009
 	void            MakeVisible(const Rectangle& rRect, ::Window& rWin);
 
 	virtual void    ReadFrameViewData(FrameView* pView);
@@ -372,6 +378,10 @@
 
     ::rtl::OUString GetSidebarContextName (void) const;
 
+//IAccessibility2 Implementation 2009-----
+	//move this method to ViewShell. 
+	//void	NotifyAccUpdate();
+//-----IAccessibility2 Implementation 2009
 protected:
 	DrawView*		mpDrawView;
 	SdPage* 		mpActualPage;
@@ -497,6 +507,10 @@
         const Point& rMouseLocation);
 
 	using ViewShell::Notify;
+
+//IAccessibility2 Implementation 2009-----
+	//const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & GetForms() const;
+//-----IAccessibility2 Implementation 2009
 	
 	::std::auto_ptr< AnnotationManager > mpAnnotationManager;
 	::std::auto_ptr< ViewOverlayManager > mpViewOverlayManager;
diff --git a/main/sd/source/ui/inc/OutlineViewShell.hxx b/main/sd/source/ui/inc/OutlineViewShell.hxx
index cd3f913..df41912 100644
--- a/main/sd/source/ui/inc/OutlineViewShell.hxx
+++ b/main/sd/source/ui/inc/OutlineViewShell.hxx
@@ -139,6 +139,9 @@
         ::com::sun::star::accessibility::XAccessible>
         CreateAccessibleDocumentView (::sd::Window* pWindow);
 
+//IAccessibility2 Implementation 2009-----
+	String m_StrOldPageName;
+//-----IAccessibility2 Implementation 2009
     /** Update the preview to show the specified page.
     */
 	virtual void UpdatePreview (SdPage* pPage, sal_Bool bInit = sal_False);
diff --git a/main/sd/source/ui/inc/SdUnoDrawView.hxx b/main/sd/source/ui/inc/SdUnoDrawView.hxx
index 133bc3e..e66aeef 100644
--- a/main/sd/source/ui/inc/SdUnoDrawView.hxx
+++ b/main/sd/source/ui/inc/SdUnoDrawView.hxx
@@ -112,14 +112,14 @@
 	void setMasterPageMode(sal_Bool MasterPageMode_) throw();
 	sal_Bool getLayerMode(void) const throw();
 	void setLayerMode(sal_Bool LayerMode_) throw();
-
+public:
     /** Return a reference to the active layer object.
         @return
             The returned value may be empty when the internal state of this
             view is not valid (like during destruction.)
     */
     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> getActiveLayer (void) throw ();
-
+protected:
     /** Make the specified object the active layer.
         @param rxLayer
             The new layer object.
diff --git a/main/sd/source/ui/inc/SlideSorterViewShell.hxx b/main/sd/source/ui/inc/SlideSorterViewShell.hxx
index 3d60b92..7de3810 100644
--- a/main/sd/source/ui/inc/SlideSorterViewShell.hxx
+++ b/main/sd/source/ui/inc/SlideSorterViewShell.hxx
@@ -174,6 +174,10 @@
     virtual ::com::sun::star::uno::Reference<
         ::com::sun::star::accessibility::XAccessible>
         CreateAccessibleDocumentView (::sd::Window* pWindow);
+	//IAccessibility2 Implementation 2009-----
+	// handle SlideSorterView specially because AccessibleSlideSorterView doesn't inherit from AccessibleDocumentViewBase
+	virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc );
+	//-----IAccessibility2 Implementation 2009
 
     SlideSorter& GetSlideSorter (void) const;
 
diff --git a/main/sd/source/ui/inc/SlideViewShell.hxx b/main/sd/source/ui/inc/SlideViewShell.hxx
index dfe3be8..f233a18 100644
--- a/main/sd/source/ui/inc/SlideViewShell.hxx
+++ b/main/sd/source/ui/inc/SlideViewShell.hxx
@@ -140,6 +140,10 @@
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> CreateAccessibleDocumentView( ::sd::Window* pWindow );
 
     void            SelectionHasChanged();
+//IAccessibility2 Implementation 2009-----
+    //Notify the SELECTION_CHANGE, SELECTION_ADD, SELECTION_REMOVE events
+    void            SelectionHasChanged(sal_uInt16 nPage, sal_Bool bSelect);
+//-----IAccessibility2 Implementation 2009
     void            PageLayoutHasChanged();
     void            FocusHasChanged( sal_uInt16 nOldFocusPage, sal_uInt16 nNewFocusPage );
     void            PageVisibilityHasChanged( sal_uInt16 nPage, sal_Bool bVisible );
@@ -148,6 +152,9 @@
     */
     virtual void Activate (sal_Bool IsMDIActivate);
 
+//IAccessibility2 Implementation 2009-----
+	void SwitchViewFireFocus(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc );
+//-----IAccessibility2 Implementation 2009
 protected:
 	virtual Size    GetOptimalSizePixel() const;
 	virtual long    VirtHScrollHdl(ScrollBar* pHScroll);
diff --git a/main/sd/source/ui/inc/TabControl.hxx b/main/sd/source/ui/inc/TabControl.hxx
index 45af80c..cdc34b5 100644
--- a/main/sd/source/ui/inc/TabControl.hxx
+++ b/main/sd/source/ui/inc/TabControl.hxx
@@ -42,6 +42,10 @@
       public DragSourceHelper, 
       public DropTargetHelper 
 {
+//IAccessibility2 Implementation 2009-----
+	//Solution: declare bIsMarked variable 
+	sal_uInt16    RrePageID;
+//-----IAccessibility2 Implementation 2009
 public:
     TabControl (DrawViewShell* pDrViewSh, ::Window* pParent);
     virtual ~TabControl (void);
diff --git a/main/sd/source/ui/inc/ViewShell.hxx b/main/sd/source/ui/inc/ViewShell.hxx
index 1573b46..2b7b86e 100644
--- a/main/sd/source/ui/inc/ViewShell.hxx
+++ b/main/sd/source/ui/inc/ViewShell.hxx
@@ -317,6 +317,13 @@
         ::com::sun::star::accessibility::XAccessible>
         CreateAccessibleDocumentView (::sd::Window* pWindow);
 
+//IAccessibility2 Implementation 2009-----
+	virtual void SwitchViewFireFocus( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc );
+	virtual void SwitchActiveViewFireFocus( );
+	// Move these two methods from DrawViewShell to enable slide show view
+	void	NotifyAccUpdate();
+	void	fireSwitchCurrentPage(sal_Int32 pageIndex);
+//-----IAccessibility2 Implementation 2009
 	void SetWinViewPos(const Point& rWinPos, bool bUpdate);
 	Point GetWinViewPos() const;
 	Point GetViewOrigin() const;
diff --git a/main/sd/source/ui/inc/Window.hxx b/main/sd/source/ui/inc/Window.hxx
index 143fca5..db8ccf4 100644
--- a/main/sd/source/ui/inc/Window.hxx
+++ b/main/sd/source/ui/inc/Window.hxx
@@ -202,6 +202,9 @@
     virtual ::com::sun::star::uno::Reference<
         ::com::sun::star::accessibility::XAccessible> 
         CreateAccessible (void);
+//IAccessibility2 Implementation 2009-----
+	virtual void SwitchView();
+//-----IAccessibility2 Implementation 2009
 
     XubString GetSurroundingText() const;
     Selection GetSurroundingTextSelection() const;
diff --git a/main/sd/source/ui/inc/fuediglu.hxx b/main/sd/source/ui/inc/fuediglu.hxx
index 765a6c1..d22e6f5 100644
--- a/main/sd/source/ui/inc/fuediglu.hxx
+++ b/main/sd/source/ui/inc/fuediglu.hxx
@@ -54,6 +54,14 @@
 	virtual void Activate();		   // Function aktivieren
 	virtual void Deactivate();		   // Function deaktivieren
 
+//IAccessibility2 Implementation 2009-----
+  //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+  //and SHIFT+ENTER key to decide the postion and draw the new insert point
+    virtual void ForcePointer(const MouseEvent* pMEvt = NULL);
+private:
+    sal_Bool   bBeginInsertPoint;
+    Point    oldPoint;
+//-----IAccessibility2 Implementation 2009
 protected:
 	FuEditGluePoints (
         ViewShell* pViewSh, 
diff --git a/main/sd/source/ui/inc/fusel.hxx b/main/sd/source/ui/inc/fusel.hxx
index f7e896d..8610ed0 100644
--- a/main/sd/source/ui/inc/fusel.hxx
+++ b/main/sd/source/ui/inc/fusel.hxx
@@ -68,6 +68,10 @@
 	*/
 	virtual bool cancel();
 
+//IAccessibility2 Implementation 2009-----
+	//Solution: let mouse cursor move
+	virtual void ForcePointer(const MouseEvent* pMEvt = NULL);
+//-----IAccessibility2 Implementation 2009
 protected:
 	FuSelection (ViewShell* pViewSh, 
         ::sd::Window* pWin, 
@@ -100,6 +104,14 @@
             position then NULL is returned.
     */
     SdrObject* pickObject (const Point& rTestPoint);
+//IAccessibility2 Implementation 2009-----
+  //Solution: Add Shift+UP/DOWN/LEFT/RIGHT key to move the position of insert point, 
+  //and SHIFT+ENTER key to decide the postion and draw the new insert point
+    sal_Bool   bBeginInsertPoint;
+    Point    oldPoint;
+  //Solution: let mouse cursor move
+  sal_Bool   bMovedToCenterPoint;
+//-----IAccessibility2 Implementation 2009
 };
 
 } // end of namespace sd
diff --git a/main/sd/source/ui/inc/navigatr.hxx b/main/sd/source/ui/inc/navigatr.hxx
index db232a1..338bc76 100644
--- a/main/sd/source/ui/inc/navigatr.hxx
+++ b/main/sd/source/ui/inc/navigatr.hxx
@@ -165,6 +165,13 @@
 	virtual void				DataChanged( const DataChangedEvent& rDCEvt );
 	void						SetDragImage();
 	void						ApplyImageList();
+//IAccessibility2 Implementation 2009-----
+public:	
+	//Solution: when object is marked , fresh the corresponding entry tree .
+	sd::DrawDocShell*             GetDrawDocShell(const SdDrawDocument*);
+    void                        FreshTree ( const  SdDrawDocument* pDoc );
+	void                        FreshEntry( );
+//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sd/source/ui/inc/sdtreelb.hxx b/main/sd/source/ui/inc/sdtreelb.hxx
index 2a22a0b..cd85ec4 100644
--- a/main/sd/source/ui/inc/sdtreelb.hxx
+++ b/main/sd/source/ui/inc/sdtreelb.hxx
@@ -36,6 +36,10 @@
 #include <svl/urlbmk.hxx>
 #include <tools/ref.hxx>
 #include "sdxfer.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <vector>
+using namespace std;
+//-----IAccessibility2 Implementation 2009
 #include <boost/scoped_ptr.hpp>
 #include <boost/function.hpp>
 
@@ -70,6 +74,10 @@
 	
 	static sal_Bool  SD_DLLPRIVATE bIsInDrag;      // static, falls der Navigator im ExecuteDrag geloescht wird
 
+//IAccessibility2 Implementation 2009-----
+	//Solution: set contenttree in SdNavigatorWin
+    sal_Bool                           bisInSdNavigatorWin;
+//-----IAccessibility2 Implementation 2009
 public:
 
 	// nested class to implement the TransferableHelper
@@ -144,6 +152,11 @@
 	::sd::DrawDocShell* 		mpDropDocSh;
 	SdNavigatorWin*			mpDropNavWin;
 	SfxViewFrame*           mpFrame;
+	//IAccessibility2 Implementation 2009-----
+	vector<String>			maTreeItem;
+	sal_Bool					mbSaveTreeItemState;
+	String					maSelectionEntryText;
+	//-----IAccessibility2 Implementation 2009
 
 	// DragSourceHelper		
 	virtual void			StartDrag( sal_Int8 nAction, const Point& rPosPixel );
@@ -188,12 +201,20 @@
     
     using Window::GetDropTarget;
     virtual SvLBoxEntry* GetDropTarget (const Point& rLocation);
+//IAccessibility2 Implementation 2009-----
+	virtual void 	InitEntry(SvLBoxEntry*,const XubString&,const Image&,const Image&,SvLBoxButtonKind );
+//-----IAccessibility2 Implementation 2009
 
 public:
 							
 							SdPageObjsTLB( Window* pParent, const SdResId& rSdResId );
 							~SdPageObjsTLB();
-
+//IAccessibility2 Implementation 2009-----
+   // helper function for 	GetEntryAltText and GetEntryLongDescription
+    String			getAltLongDescText( SvLBoxEntry* pEntry , sal_Bool isAltText) const;
+    String  		GetEntryAltText( SvLBoxEntry* pEntry ) const;
+    String  		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;
+//-----IAccessibility2 Implementation 2009
 	virtual void			SelectHdl();
 	virtual void			KeyInput( const KeyEvent& rKEvt );
 							
@@ -208,6 +229,16 @@
 	sal_Bool					HasSelectedChilds( const String& rName );
 	sal_Bool					SelectEntry( const String& rName );
 	String					GetSelectEntry();
+//IAccessibility2 Implementation 2009-----
+	//Solution: Mark Current Entry
+	void                    MarkCurEntry( const String& rName );
+	void                    SetSdNavigatorWinFlag(sal_Bool isInSdNavigatorWin){bisInSdNavigatorWin =isInSdNavigatorWin;};
+	void                    FreshCurEntry();
+
+	void					Clear();
+	void					SetSaveTreeItemStateFlag(sal_Bool bState){mbSaveTreeItemState = bState;}
+	void					SaveExpandedTreeItemState(SvLBoxEntry* pEntry, vector<String>& vectTreeItem);
+//-----IAccessibility2 Implementation 2009
 	List*					GetSelectEntryList( sal_uInt16 nDepth );
 	SdDrawDocument*			GetBookmarkDoc(SfxMedium* pMedium = NULL);
 	::sd::DrawDocShell*			GetDropDocSh() { return(mpDropDocSh); }
diff --git a/main/sd/source/ui/slideshow/showwin.cxx b/main/sd/source/ui/slideshow/showwin.cxx
index 38721dd..fb0c339 100644
--- a/main/sd/source/ui/slideshow/showwin.cxx
+++ b/main/sd/source/ui/slideshow/showwin.cxx
@@ -738,4 +738,28 @@
 		GetChild( nChild )->Show( sal_True );
 }
 
+//IAccessibility2 Implementation 2009-----
+// Overload the sd::Window's CreateAccessible to create a different accessible object
+::com::sun::star::uno::Reference<
+    ::com::sun::star::accessibility::XAccessible>
+    ShowWindow::CreateAccessible (void)
+{
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible(sal_False);
+	if (xAcc.get())
+	{
+		return xAcc;
+	}
+    if (mpViewShell != NULL)
+	{
+		xAcc = mpViewShell->CreateAccessibleDocumentView (this);
+		SetAccessible(xAcc);
+		return xAcc;
+	}
+    else
+    {
+        OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
+	return ::Window::CreateAccessible ();
+    }
+}
+//-----IAccessibility2 Implementation 2009
 } // end of namespace sd
diff --git a/main/sd/source/ui/slideshow/showwindow.hxx b/main/sd/source/ui/slideshow/showwindow.hxx
index be5f41d..53f3947 100644
--- a/main/sd/source/ui/slideshow/showwindow.hxx
+++ b/main/sd/source/ui/slideshow/showwindow.hxx
@@ -102,6 +102,11 @@
 	virtual void	MouseButtonDown(const MouseEvent& rMEvt);
 	virtual void	Paint(const Rectangle& rRect);
 	virtual long	Notify(NotifyEvent& rNEvt);
+	//IAccessibility2 Implementation 2009-----
+	//Overload the sd::Window's CreateAccessible to create a different accessible object
+    virtual ::com::sun::star::uno::Reference<
+        ::com::sun::star::accessibility::XAccessible> 
+        CreateAccessible (void);
 
 	void			TerminateShow();
 	void			RestartShow();
diff --git a/main/sd/source/ui/slideshow/slideshow.cxx b/main/sd/source/ui/slideshow/slideshow.cxx
index f96fa00..07b1f77 100644
--- a/main/sd/source/ui/slideshow/slideshow.cxx
+++ b/main/sd/source/ui/slideshow/slideshow.cxx
@@ -818,6 +818,12 @@
                     }
 				}
 			}
+			//IAccessibility2 Implementation 2009-----
+			//Fire the acc focus event when focus is switched back. The above method mpCurrentViewShellBase->GetWindow()->GrabFocus() will
+			//set focus to WorkWindow instead of the sd::window, so here call Shell's method to fire the focus event
+			if (pViewShell)
+				pViewShell->SwitchActiveViewFireFocus();
+			//-----IAccessibility2 Implementation 2009
 		}
 		mpCurrentViewShellBase = 0;
 	}
@@ -1044,6 +1050,10 @@
 			if( mxController->startShow(mxCurrentSettings.get()) )
 			{
 				pShell->Resize();
+				//IAccessibility2 Implementation 2009-----
+				// Defer the sd::ShowWindow's GrabFocus to here. so that the accessible event can be fired correctly. 
+				pShell->GetActiveWindow()->GrabFocus();
+				//-----IAccessibility2 Implementation 2009
 			}
 			else
 			{
@@ -1218,6 +1228,13 @@
 			
 		if( !bSuccess )	
 			end();
+		//IAccessibility2 Implementation 2009-----
+		else
+		{
+			if(mpCurrentViewShellBase)
+				mpCurrentViewShellBase->GetWindow()->GrabFocus();
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 }
 
diff --git a/main/sd/source/ui/slideshow/slideshowimpl.cxx b/main/sd/source/ui/slideshow/slideshowimpl.cxx
index bdcd463..30c75ab 100644
--- a/main/sd/source/ui/slideshow/slideshowimpl.cxx
+++ b/main/sd/source/ui/slideshow/slideshowimpl.cxx
@@ -1096,7 +1096,10 @@
 				pBindings->Invalidate( SID_REHEARSE_TIMINGS );
 			}
 
-			mpShowWindow->GrabFocus();
+			//IAccessibility2 Implementation 2009-----
+			// Defer the sd::ShowWindow's GrabFocus to SlideShow::activate. so that the accessible event can be fired correctly. 
+			//mpShowWindow->GrabFocus();
+			//-----IAccessibility2 Implementation 2009
 
 			std::vector<beans::PropertyValue> aProperties;
 			aProperties.reserve( 4 );
@@ -1472,6 +1475,15 @@
 			pBindings->Invalidate( SID_NAVIGATOR_PAGENAME );
 		}
 	}
+	//IAccessibility2 Implementation 2009-----
+	// send out page change event and notity to update all acc info for current page
+	if (mpViewShell)
+	{
+		sal_Int32 currentPageIndex = getCurrentSlideIndex();
+		mpViewShell->fireSwitchCurrentPage(currentPageIndex);
+		mpViewShell->NotifyAccUpdate();
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 // ---------------------------------------------------------
diff --git a/main/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx b/main/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
index cddb72f..3dedafc 100644
--- a/main/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
+++ b/main/sd/source/ui/slidesorter/controller/SlsFocusManager.cxx
@@ -284,6 +284,11 @@
 	if (rpDescriptor.get() != NULL)
 	{
         mrSlideSorter.GetView().SetState(rpDescriptor, model::PageDescriptor::ST_Focused, false);
+
+		//IAccessibility2 Implementation 2009-----
+		// Hide focus should also fire the focus event, Currently, only accessibility add the focus listener
+		NotifyFocusChangeListeners();
+		//-----IAccessibility2 Implementation 2009
 	}
 }
 
diff --git a/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx b/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
index 2d646bf..430db3c 100644
--- a/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
+++ b/main/sd/source/ui/slidesorter/shell/SlideSorterViewShell.cxx
@@ -215,6 +215,12 @@
 {
     ViewShell::Init(bIsMainViewShell);
 
+//IAccessibility2 Implementation 2009-----
+	// since the updatePageList will show focus, the window.show() must be called ahead. This show is deferred from Init()
+	::sd::Window* pActiveWindow = GetActiveWindow();
+	if (pActiveWindow)
+		pActiveWindow->Show();
+//-----IAccessibility2 Implementation 2009
     mpSlideSorter->GetModel().UpdatePageList();
 
     if (mpContentWindow.get() != NULL)
@@ -296,7 +302,19 @@
         pWindow);
 }
 
-
+//IAccessibility2 Implementation 2009-----
+void SlideSorterViewShell::SwitchViewFireFocus(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc )
+{
+	if (xAcc.get())
+	{
+		::accessibility::AccessibleSlideSorterView* pBase = static_cast< ::accessibility::AccessibleSlideSorterView* >(xAcc.get());	
+		if (pBase)
+		{
+			pBase->SwitchViewActivated();
+		}
+	}
+}
+//-----IAccessibility2 Implementation 2009
 
 
 SlideSorter& SlideSorterViewShell::GetSlideSorter (void) const
diff --git a/main/sd/source/ui/unoidl/DrawController.cxx b/main/sd/source/ui/unoidl/DrawController.cxx
index 63f3174..2df3908 100644
--- a/main/sd/source/ui/unoidl/DrawController.cxx
+++ b/main/sd/source/ui/unoidl/DrawController.cxx
@@ -539,9 +539,45 @@
         }
     }
 }
+//IAccessibility2 Implementation 2009-----
+void DrawController::NotifyAccUpdate()
+{
+	sal_Int32 nHandle = PROPERTY_UPDATEACC;
+	Any aNewValue, aOldValue;
+	fire (&nHandle, &aNewValue, &aOldValue, 1, sal_False);
+}
 
+void DrawController::fireChangeLayer( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer>* pCurrentLayer ) throw()
+{
+	if( pCurrentLayer != mpCurrentLayer )
+	{
+		sal_Int32 nHandle = PROPERTY_ACTIVE_LAYER;
+		
+		Any aNewValue (makeAny( *pCurrentLayer) );
 
+		Any aOldValue ;
 
+		fire (&nHandle, &aNewValue, &aOldValue, 1, sal_False);
+
+		mpCurrentLayer = pCurrentLayer;
+	}
+}
+
+// This method is only called in slide show and outline view
+//void DrawController::fireSwitchCurrentPage(String pageName ) throw()
+void DrawController::fireSwitchCurrentPage(sal_Int32 pageIndex ) throw()
+{
+		Any aNewValue;
+		Any aOldValue;
+		//OUString aPageName(  pageName );
+		//aNewValue <<= aPageName ;
+		aNewValue <<= pageIndex;
+
+		// Use new property to handle page change event
+		sal_Int32 nHandles = PROPERTY_PAGE_CHANGE;
+		fire( &nHandles, &aNewValue, &aOldValue, 1, sal_False );
+}
+//-----IAccessibility2 Implementation 2009
 
 void DrawController::FirePropertyChange (
     sal_Int32 nHandle,
@@ -750,6 +786,19 @@
 			PROPERTY_DRAWVIEWMODE,
             ::getCppuType((const ::com::sun::star::awt::Point*)0),
             beans::PropertyAttribute::BOUND|beans::PropertyAttribute::READONLY|beans::PropertyAttribute::MAYBEVOID ));
+	    //IAccessibility2 Implementation 2009-----
+	// add new property to update current page's acc information
+    rProperties.push_back(
+        beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("UpdateAcc") ),
+			PROPERTY_UPDATEACC,
+            ::getCppuType((const sal_Int16*)0),
+            beans::PropertyAttribute::BOUND ));	
+	rProperties.push_back(
+        beans::Property( OUString( RTL_CONSTASCII_USTRINGPARAM("PageChange") ),
+			PROPERTY_PAGE_CHANGE,
+            ::getCppuType((const sal_Int16*)0),
+            beans::PropertyAttribute::BOUND ));	
+	    //-----IAccessibility2 Implementation 2009
 }
 
 
diff --git a/main/sd/source/ui/unoidl/SdUnoDrawView.cxx b/main/sd/source/ui/unoidl/SdUnoDrawView.cxx
index d477210..98f6733 100644
--- a/main/sd/source/ui/unoidl/SdUnoDrawView.cxx
+++ b/main/sd/source/ui/unoidl/SdUnoDrawView.cxx
@@ -151,6 +151,9 @@
             xCurrentLayer = pManager->GetLayer (pLayer);
     }
     while (false);
+//IAccessibility2 Implementation 2009-----
+	mrController.mpCurrentLayer = &(xCurrentLayer) ;
+//-----IAccessibility2 Implementation 2009
 
     return xCurrentLayer;
 }
diff --git a/main/sd/source/ui/view/Outliner.cxx b/main/sd/source/ui/view/Outliner.cxx
index 2660c24..fb63e7f 100644
--- a/main/sd/source/ui/view/Outliner.cxx
+++ b/main/sd/source/ui/view/Outliner.cxx
@@ -535,7 +535,17 @@
             else
                 mnStartPageIndex = (sal_uInt16)-1;
         }
-    }
+//IAccessibility2 Implementation 2009-----
+	if ( Application::IsAccessibilityEnabled() )
+	{
+		SvxSearchDialog* pSearchDlg = 
+			((SvxSearchDialog*)(SfxViewFrame::Current()->GetChildWindow(
+			SvxSearchDialogWrapper::GetChildWindowId())->GetWindow()));
+		pSearchDlg->SetDocWin( pViewShell->GetActiveWindow() );
+		pSearchDlg->SetSrchFlag();
+	}
+//-----IAccessibility2 Implementation 2009
+        }
     else
         mpDrawDocument->GetDocSh()->SetWaitCursor( sal_False );
 
diff --git a/main/sd/source/ui/view/drviews4.cxx b/main/sd/source/ui/view/drviews4.cxx
index ef5bee1..39641cc 100644
--- a/main/sd/source/ui/view/drviews4.cxx
+++ b/main/sd/source/ui/view/drviews4.cxx
@@ -79,6 +79,9 @@
 // #97016# IV
 #include <svx/svditer.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <navigatr.hxx>
+//-----IAccessibility2 Implementation 2009
 namespace sd {
 
 #define PIPETTE_RANGE 0
@@ -227,6 +230,14 @@
 		else
 		{
 			bRet = ViewShell::KeyInput(rKEvt, pWin);
+//IAccessibility2 Implementation 2009-----
+    		//Solution: If object is marked , the corresponding entry is set true ,
+    		//else the corresponding entry is set false .
+       	    if(KEY_TAB == rKEvt.GetKeyCode().GetCode())
+       	    {
+   			   FreshNavigatrTree();
+       	    }
+//-----IAccessibility2 Implementation 2009
 		}
 	}
 
@@ -271,7 +282,33 @@
         mbIsRulerDrag = sal_True;
 	}
 }
+//IAccessibility2 Implementation 2009-----
+//Solution: If object is marked , the corresponding entry is set true ,
+//else the corresponding entry is set false .
+void DrawViewShell::FreshNavigatrEntry()
+{
+		sal_uInt16 nId = SID_NAVIGATOR;
+		SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
+		if( pWindow )
+		{
+			SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) );
+			if( pNavWin )
+				pNavWin->FreshEntry();
+		}
+}
 
+void DrawViewShell::FreshNavigatrTree()
+{
+		sal_uInt16 nId = SID_NAVIGATOR;
+		SfxChildWindow* pWindow = GetViewFrame()->GetChildWindow( nId );
+		if( pWindow )
+		{
+			SdNavigatorWin* pNavWin = (SdNavigatorWin*)( pWindow->GetContextWindow( SD_MOD() ) );
+			if( pNavWin )
+				pNavWin->FreshTree( GetDoc() );
+		}
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |* MouseButtonDown event
@@ -298,6 +335,11 @@
 	{
 		ViewShell::MouseButtonDown(rMEvt, pWin);
 
+//IAccessibility2 Implementation 2009-----
+		//Solution: If object is marked , the corresponding entry is set true ,
+		//else the corresponding entry is set false .
+              FreshNavigatrTree();
+//-----IAccessibility2 Implementation 2009
 		if ( mbPipette )
 			( (SvxBmpMask*) GetViewFrame()->GetChildWindow( SvxBmpMaskChildWindow::GetChildWindowId() )->GetWindow() )->PipetteClicked();
 	}
@@ -467,6 +509,11 @@
 		}
 		else
     		ViewShell::MouseButtonUp(rMEvt, pWin);
+//IAccessibility2 Implementation 2009-----
+		//Solution: If object is marked , the corresponding entry is set true ,
+		//else the corresponding entry is set false .
+		FreshNavigatrTree();
+//-----IAccessibility2 Implementation 2009
 	}
 }
 
diff --git a/main/sd/source/ui/view/drviews5.cxx b/main/sd/source/ui/view/drviews5.cxx
index 18aa677..72039d6 100644
--- a/main/sd/source/ui/view/drviews5.cxx
+++ b/main/sd/source/ui/view/drviews5.cxx
@@ -705,6 +705,15 @@
             // Tell the draw view and the tab control of the new active layer.
             mpDrawView->SetActiveLayer (pBar->GetPageText (pBar->GetPageId ((sal_uInt16)nIndex)));
             pBar->SetCurPageId (pBar->GetPageId ((sal_uInt16)nIndex));
+		//IAccessibility2 Implementation 2009-----
+		SdUnoDrawView* pUnoDrawView = new SdUnoDrawView (
+            GetViewShellBase().GetDrawController(),
+            *this,
+            *GetView());
+		::com::sun::star::uno::Reference< ::com::sun::star::drawing::XLayer> rLayer = pUnoDrawView->getActiveLayer();
+		GetViewShellBase().GetDrawController().fireChangeLayer( &rLayer );
+		delete pUnoDrawView;
+		//-----IAccessibility2 Implementation 2009
         }
     }
 }
diff --git a/main/sd/source/ui/view/outlnvsh.cxx b/main/sd/source/ui/view/outlnvsh.cxx
index 25179a6..ebdc8d2 100644
--- a/main/sd/source/ui/view/outlnvsh.cxx
+++ b/main/sd/source/ui/view/outlnvsh.cxx
@@ -235,6 +235,9 @@
 	Construct(GetDocSh());
 
     SetContextName(sfx2::sidebar::EnumContext::GetContextName(sfx2::sidebar::EnumContext::Context_OutlineText));
+//IAccessibility2 Implementation 2009-----
+	m_StrOldPageName.EmptyString();
+//-----IAccessibility2 Implementation 2009
 }
 
 /*************************************************************************
@@ -1472,6 +1475,14 @@
 
 		aLayoutStr = pPage->GetLayoutName();
 		aLayoutStr.Erase( aLayoutStr.SearchAscii( SD_LT_SEPARATOR ) );
+		//IAccessibility2 Implementation 2009-----
+			//Now, CurrentPage property change is already sent for DrawView and OutlineView, so it is not necessary to send again here
+			if(m_StrOldPageName!=aPageStr)
+			{
+				GetViewShellBase().GetDrawController().fireSwitchCurrentPage(nPos);
+				m_StrOldPageName = aPageStr;
+			}	
+		//-----IAccessibility2 Implementation 2009
 	}
 	rSet.Put( SfxStringItem( SID_STATUS_PAGE, aPageStr ) );
 	rSet.Put( SfxStringItem( SID_STATUS_LAYOUT, aLayoutStr ) );
diff --git a/main/sd/source/ui/view/sdwindow.cxx b/main/sd/source/ui/view/sdwindow.cxx
index fbfb6e7..14dd5b2 100644
--- a/main/sd/source/ui/view/sdwindow.cxx
+++ b/main/sd/source/ui/view/sdwindow.cxx
@@ -45,6 +45,10 @@
 #include "AccessibleDrawDocumentView.hxx"
 #include "WindowUpdater.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include <vcl/svapp.hxx>
+//-----IAccessibility2 Implementation 2009
+
 namespace sd {
 
 #define SCROLL_LINE_FACT   0.05     // Faktor fuer Zeilenscrolling
@@ -1160,8 +1164,25 @@
     ::com::sun::star::accessibility::XAccessible>
     Window::CreateAccessible (void)
 {
+//IAccessibility2 Implementation 2009-----
+	// If current viewshell is PresentationViewShell, just return empty because the correct ShowWin will be created later. 
+	if (mpViewShell && mpViewShell->ISA(PresentationViewShell))
+	{
+		return ::Window::CreateAccessible ();
+	}
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible(sal_False);
+	if (xAcc.get())
+	{
+		return xAcc;
+	}
     if (mpViewShell != NULL)
-        return mpViewShell->CreateAccessibleDocumentView (this);
+	//return mpViewShell->CreateAccessibleDocumentView (this);
+	{
+		xAcc = mpViewShell->CreateAccessibleDocumentView (this);
+		SetAccessible(xAcc);
+		return xAcc;
+	}
+//-----IAccessibility2 Implementation 2009
     else
     {
         OSL_TRACE ("::sd::Window::CreateAccessible: no view shell");
@@ -1169,6 +1190,22 @@
     }
 }
 
+//IAccessibility2 Implementation 2009-----
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void Window::SwitchView()
+{
+	if (!Application::IsAccessibilityEnabled())
+	{
+		return ;
+	}
+	if (mpViewShell)
+	{
+		mpViewShell->SwitchViewFireFocus(GetAccessible(sal_False));
+	}
+}
+//-----IAccessibility2 Implementation 2009
+
 XubString Window::GetSurroundingText() const
 {
     if ( mpViewShell->GetShellType() == ViewShell::ST_OUTLINE )
diff --git a/main/sd/source/ui/view/tabcontr.cxx b/main/sd/source/ui/view/tabcontr.cxx
index 186d004..275e48f 100644
--- a/main/sd/source/ui/view/tabcontr.cxx
+++ b/main/sd/source/ui/view/tabcontr.cxx
@@ -92,6 +92,7 @@
 	TabBar( pParent, WinBits( WB_BORDER | WB_3DLOOK | WB_SCROLL | WB_SIZEABLE | WB_DRAG) ),
 	DragSourceHelper( this ),
 	DropTargetHelper( this ),
+    RrePageID(1),
 	pDrViewSh(pViewSh),
 	bInternalMove(sal_False)
 {
@@ -136,6 +137,12 @@
 		Point aPos = PixelToLogic( rMEvt.GetPosPixel() );
 		sal_uInt16 aPageId = GetPageId(aPos);
 
+//IAccessibility2 Implementation 2009-----
+		//Solution: initialize
+        if(RrePageID!=aPageId)
+			pDrViewSh->FreshNavigatrEntry(); 
+		RrePageID=aPageId;
+//-----IAccessibility2 Implementation 2009
 		if (aPageId == 0)
 		{
 			SfxDispatcher* pDispatcher = pDrViewSh->GetViewFrame()->GetDispatcher();
diff --git a/main/sd/source/ui/view/viewshel.cxx b/main/sd/source/ui/view/viewshel.cxx
index 0d41da7..6f91a1f 100644
--- a/main/sd/source/ui/view/viewshel.cxx
+++ b/main/sd/source/ui/view/viewshel.cxx
@@ -95,7 +95,9 @@
 #include <editeng/eeitem.hxx>
 #include <svl/poolitem.hxx>
 #include <glob.hrc>
-
+//IAccessibility2 Implementation 2009-----
+#include "AccessibleDocumentViewBase.hxx"
+//-----IAccessibility2 Implementation 2009
 #ifndef SO2_DECL_SVINPLACEOBJECT_DEFINED
 #define SO2_DECL_SVINPLACEOBJECT_DEFINED
 SO2_DECL_REF(SvInPlaceObject)
@@ -479,6 +481,9 @@
 		bReturn = (sal_Bool)GetViewShell()->KeyInput(rKEvt);
 	}
 
+//IAccessibility2 Implementation 2009-----
+	sal_Int32 OriCount = GetView()->GetMarkedObjectList().GetMarkCount();
+//-----IAccessibility2 Implementation 2009
 	if(!bReturn)
 	{
 		rtl::Reference< SlideShow > xSlideShow( SlideShow::GetSlideShow( GetViewShellBase() ) );
@@ -508,6 +513,14 @@
 			}
 		}
 	}
+//IAccessibility2 Implementation 2009-----
+	sal_Int32 EndCount = GetView()->GetMarkedObjectList().GetMarkCount();
+	// Here, oriCount or endCount must have one value=0, another value > 0, then to switch focus between Document and shape objects
+	if(bReturn &&  (OriCount + EndCount > 0) && (OriCount * EndCount == 0))
+	{
+		SwitchActiveViewFireFocus();
+	}
+//-----IAccessibility2 Implementation 2009
 
 	if(!bReturn && GetActiveWindow())
 	{
@@ -1624,7 +1637,36 @@
     return true;
 }
 
+//IAccessibility2 Implementation 2009-----
+void ViewShell::SwitchViewFireFocus(::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc )
+{
+	if (xAcc.get())
+	{
+		::accessibility::AccessibleDocumentViewBase* pBase = static_cast< ::accessibility::AccessibleDocumentViewBase* >(xAcc.get());	
+		if (pBase)
+		{
+			pBase->SwitchViewActivated();
+		}
+	}
+}
+void ViewShell::SwitchActiveViewFireFocus()
+{
+	if (mpContentWindow)
+	{
+		SwitchViewFireFocus(mpContentWindow->GetAccessible(sal_False));
+	}
+}
+// move these two methods from DrawViewShell. 
+void ViewShell::fireSwitchCurrentPage(sal_Int32 pageIndex)
+{
+	GetViewShellBase().GetDrawController().fireSwitchCurrentPage(pageIndex);
+}
+void ViewShell::NotifyAccUpdate( )
+{
+	GetViewShellBase().GetDrawController().NotifyAccUpdate();
+}
 
+//-----IAccessibility2 Implementation 2009
 
 } // end of namespace sd
 
diff --git a/main/sfx2/inc/sfx2/dinfdlg.hxx b/main/sfx2/inc/sfx2/dinfdlg.hxx
index 99cd97e..11b9e47 100644
--- a/main/sfx2/inc/sfx2/dinfdlg.hxx
+++ b/main/sfx2/inc/sfx2/dinfdlg.hxx
@@ -549,7 +549,7 @@
 private:
     CustomPropertiesControl m_aPropertiesCtrl;
     PushButton              m_aAddBtn;
-	FixedText               m_aPropertiesFT; // Sym2_5121----, Moved by Steve Yin
+	FixedText               m_aPropertiesFT;
 
     DECL_LINK(  AddHdl, PushButton* );
 
diff --git a/main/sfx2/source/dialog/newstyle.cxx b/main/sfx2/source/dialog/newstyle.cxx
index fe4beeb..d55bf4d 100644
--- a/main/sfx2/source/dialog/newstyle.cxx
+++ b/main/sfx2/source/dialog/newstyle.cxx
@@ -87,7 +87,7 @@
 	aOKBtn.SetClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
 	aColBox.SetModifyHdl(LINK(this, SfxNewStyleDlg, ModifyHdl));
 	aColBox.SetDoubleClickHdl(LINK(this, SfxNewStyleDlg, OKHdl));
-	// aColBox.SetAccessibleName(SfxResId(FL_COL));
+	aColBox.SetAccessibleName(SfxResId(FL_COL));
 
 	SfxStyleSheetBase *pStyle = rPool.First();
 	while ( pStyle )
diff --git a/main/sfx2/source/dialog/tabdlg.cxx b/main/sfx2/source/dialog/tabdlg.cxx
index 55e6e5e..e841e15 100644
--- a/main/sfx2/source/dialog/tabdlg.cxx
+++ b/main/sfx2/source/dialog/tabdlg.cxx
@@ -747,6 +747,10 @@
 
 	if ( bShow )
 		Show();
+
+// IAccessibility2 implementation 2009
+	if ( IsVisible() && ( !HasChildPathFocus() || HasFocus() ) )
+		GrabFocusToFirstControl();
 }
 
 // -----------------------------------------------------------------------
diff --git a/main/sfx2/source/dialog/templdlg.hrc b/main/sfx2/source/dialog/templdlg.hrc
index 1797c70..a0fc753 100644
--- a/main/sfx2/source/dialog/templdlg.hrc
+++ b/main/sfx2/source/dialog/templdlg.hrc
@@ -44,3 +44,8 @@
 #define BT_FLIST 8
 #define BT_VLIST 9
 #define BT_TOOL 10
+
+//IAccessibility2 Implementation 2009-----
+#define STR_STYLE_ELEMTLIST	18
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sfx2/source/menu/mnuitem.cxx b/main/sfx2/source/menu/mnuitem.cxx
index 2560630..e31c319 100644
--- a/main/sfx2/source/menu/mnuitem.cxx
+++ b/main/sfx2/source/menu/mnuitem.cxx
@@ -291,6 +291,10 @@
 		DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST,
 					"SfxBoolItem not allowed for SID_OBJECTMENUx" );
 		bCheck = ((const SfxBoolItem*)pState)->GetValue();
+		// IAccessibility2 implementation 2009. ------
+		Menu* pMenu = pOwnMenu->GetSVMenu();
+		pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MIB_CHECKABLE);
+		// ------ IAccessibility2 implementation 2009.
 	}
 	else if ( pState->ISA(SfxEnumItemInterface) &&
 			  ((SfxEnumItemInterface *)pState)->HasBoolValue() )
@@ -299,6 +303,10 @@
 		DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST,
 					"SfxEnumItem not allowed for SID_OBJECTMENUx" );
 		bCheck = ((SfxEnumItemInterface *)pState)->GetBoolValue();
+		// IAccessibility2 implementation 2009. ------
+		Menu* pMenu = pOwnMenu->GetSVMenu();
+		pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MIB_CHECKABLE);
+		// ------ IAccessibility2 implementation 2009.
 	}
 	else if ( ( b_ShowStrings || bIsObjMenu ) && pState->ISA(SfxStringItem) )
 	{
diff --git a/main/sfx2/source/view/viewfrm.cxx b/main/sfx2/source/view/viewfrm.cxx
index 5998da5..da579e6 100644
--- a/main/sfx2/source/view/viewfrm.cxx
+++ b/main/sfx2/source/view/viewfrm.cxx
@@ -683,7 +683,13 @@
 				if( pSalvageItem )
 				{
 					aURL = pSalvageItem->GetValue();
-					pNewSet->ClearItem( SID_DOC_SALVAGE );
+					// IAccessibility2 implementation 2009. ------
+                    if (pNewSet)
+                    {
+                        pNewSet->ClearItem( SID_ORIGURL );
+					    pNewSet->ClearItem( SID_DOC_SALVAGE );
+                    }
+					// ------ IAccessibility2 implementation 2009.
 				}
 
                 // TODO/LATER: Temporary solution, the SfxMedium must know the original URL as aLogicName
@@ -3379,13 +3385,17 @@
 	sal_Bool bShow = sal_False;
 	sal_Bool bHasChild = HasChildWindow(nSID);
 	bShow = pShowItem ? pShowItem->GetValue() : !bHasChild;
+	// IAccessibility2 implementation 2009. ------
+    GetDispatcher()->Update_Impl( sal_True );
 
 	// ausf"uhren
 	if ( !pShowItem || bShow != bHasChild )
 		ToggleChildWindow( nSID );
 
 	GetBindings().Invalidate( nSID );
-    GetDispatcher()->Update_Impl( sal_True );
+	// Move to the before show()
+    //GetDispatcher()->Update_Impl( sal_True );
+	// ------ IAccessibility2 implementation 2009.
 
 	// ggf. recorden
     if ( nSID == SID_HYPERLINK_DIALOG || nSID == SID_SEARCH_DLG )
diff --git a/main/soldep/source/soldep.cxx b/main/soldep/source/soldep.cxx
index 37d57cb..8db6b2e 100644
--- a/main/soldep/source/soldep.cxx
+++ b/main/soldep/source/soldep.cxx
@@ -979,7 +979,7 @@
 
 void SolDep::Resize()
 {
-//funzt! muß aber von der applikation aufgerufen werden.
+//funzt! mu?aber von der applikation aufgerufen werden.
     Point aOutPos = Point( 0, 0 );
 	Size aOutSize = mpProcessWin->GetOutputSizePixel();
 		// calculate output size
@@ -991,7 +991,7 @@
     Point aGraphWinPos = Point(0,0);
     Size  aGraphWinSize = Size(0,0);
 
-//weiß nicht wie:    nMenuHeight = aMenuBar.GetWindow()->GetSizePixel().Height(); //Höhe des Menues
+//wei?nicht wie:    nMenuHeight = aMenuBar.GetWindow()->GetSizePixel().Height(); //Höhe des Menues
 
     //aInRect = pTBManager->Resize( Rectangle( aOutPos, aOutSize );
     // Set Docking-Rectangle for ToolBar
@@ -1714,7 +1714,7 @@
 
 	sal_uIntPtr nNewXSize = ( DEPPER_MAX_WIDTH + 1 )  * ( OBJWIN_X_SPACING + GetDefSize().Width() );
 
-    //    sal_uIntPtr aObjID = GetStart(pIdMapper, pObjLst) //hier muß man switchen GetStart/GetPrjStart oder so
+    //    sal_uIntPtr aObjID = GetStart(pIdMapper, pObjLst) //hier mu?man switchen GetStart/GetPrjStart oder so
 
     ObjectWin* pObjWin = ObjIdToPtr( pObjLst, aObjID);
 
@@ -1763,7 +1763,7 @@
 	aWorkList.Clear();
 	GetDepWin()->EnablePaint( sal_True );
 	GetDepWin()->Invalidate();
-//LevelListen loeschen	                Hä? Welche Levellisten?
+//LevelListen loeschen	                H? Welche Levellisten?
 
 //Update all Connectors
 // --> To be done: Don't call twice Object1-Connector-Object2
diff --git a/main/solenv/inc/lldb4aoo.py b/main/solenv/inc/lldb4aoo.py
index e380e61..3f64058 100644
--- a/main/solenv/inc/lldb4aoo.py
+++ b/main/solenv/inc/lldb4aoo.py
@@ -1,20 +1,3 @@
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements.  See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership.  The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License.  You may obtain a copy of the License at
-# 
-#   http://www.apache.org/licenses/LICENSE-2.0
-# 
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied.  See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
 # to activate the AOO-LLDB helper script type the line below into LLDB
 #	command script import path-to-script/lldb4aoo.py
 # or activate it automatically by adding the line to ~/.lldbinit
diff --git a/main/starmath/source/accessibility.cxx b/main/starmath/source/accessibility.cxx
index 7dab2db..b972294 100644
--- a/main/starmath/source/accessibility.cxx
+++ b/main/starmath/source/accessibility.cxx
@@ -1421,12 +1421,12 @@
     return bRes;
 }
 
-sal_Bool SmTextForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const
+sal_Bool SmTextForwarder::GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell ) const
 {
 	EditEngine *pEditEngine = rEditAcc.GetEditEngine();
     return pEditEngine ? 
-				SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, *pEditEngine, nPara, nIndex )
-				: sal_False;
+		SvxEditSourceHelper::GetAttributeRun( nStartIndex, nEndIndex, *pEditEngine, nPara, nIndex, bInCell )
+		: sal_False;
 }
 
 sal_uInt16 SmTextForwarder::GetLineCount( sal_uInt16 nPara ) const
diff --git a/main/starmath/source/accessibility.hxx b/main/starmath/source/accessibility.hxx
index 112869f..eed34e8 100644
--- a/main/starmath/source/accessibility.hxx
+++ b/main/starmath/source/accessibility.hxx
@@ -245,9 +245,9 @@
 	virtual OutputDevice*	GetRefDevice() const;
     virtual sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16& nPara, sal_uInt16& nIndex ) const;
     virtual sal_Bool		GetWordIndices( sal_uInt16 nPara, sal_uInt16 nIndex, sal_uInt16& nStart, sal_uInt16& nEnd ) const;
-    virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex ) const;
-    virtual sal_uInt16			GetLineCount( sal_uInt16 nPara ) const;
-    virtual sal_uInt16			GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
+	virtual sal_Bool 		GetAttributeRun( sal_uInt16& nStartIndex, sal_uInt16& nEndIndex, sal_uInt16 nPara, sal_uInt16 nIndex, sal_Bool bInCell = sal_False ) const;
+    virtual sal_uInt16		GetLineCount( sal_uInt16 nPara ) const;
+    virtual sal_uInt16		GetLineLen( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual void            GetLineBoundaries( /*out*/sal_uInt16 &rStart, /*out*/sal_uInt16 &rEnd, sal_uInt16 nParagraph, sal_uInt16 nLine ) const;
     virtual sal_uInt16          GetLineNumberAtIndex( sal_uInt16 nPara, sal_uInt16 nLine ) const;
     virtual sal_Bool		Delete( const ESelection& );
diff --git a/main/svtools/AllLangResTarget_svt.mk b/main/svtools/AllLangResTarget_svt.mk
index ae53a9c..980c2d1 100644
--- a/main/svtools/AllLangResTarget_svt.mk
+++ b/main/svtools/AllLangResTarget_svt.mk
@@ -49,6 +49,7 @@
 	svtools/source/control/ctrlbox.src \
 	svtools/source/control/ctrltool.src \
 	svtools/source/control/filectrl.src \
+	svtools/source/control/ruler.src \
 	svtools/source/dialogs/addresstemplate.src \
 	svtools/source/dialogs/filedlg2.src \
 	svtools/source/dialogs/formats.src \
diff --git a/main/svtools/Library_svt.mk b/main/svtools/Library_svt.mk
index b59b605..e2633b4 100644
--- a/main/svtools/Library_svt.mk
+++ b/main/svtools/Library_svt.mk
@@ -126,6 +126,7 @@
 	svtools/source/contnr/templwin \
 	svtools/source/contnr/tooltiplbox \
 	svtools/source/contnr/treelist \
+	svtools/source/control/accessibleruler \
 	svtools/source/control/asynclink \
 	svtools/source/control/calendar \
 	svtools/source/control/collatorres \
@@ -157,6 +158,8 @@
 	svtools/source/control/urlcontrol \
 	svtools/source/control/valueacc \
 	svtools/source/control/valueset \
+	svtools/source/control/vclxaccessibleheaderbar \
+	svtools/source/control/vclxaccessibleheaderbaritem \
 	svtools/source/dialogs/addresstemplate \
 	svtools/source/dialogs/colrdlg \
 	svtools/source/dialogs/filedlg \
diff --git a/main/svtools/Package_inc.mk b/main/svtools/Package_inc.mk
index f52ef38..3a42713 100644
--- a/main/svtools/Package_inc.mk
+++ b/main/svtools/Package_inc.mk
@@ -29,6 +29,7 @@
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/acceleratorexecute.hxx,svtools/acceleratorexecute.hxx))
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/accessibilityoptions.hxx,svtools/accessibilityoptions.hxx))
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/accessiblefactory.hxx,svtools/accessiblefactory.hxx))
+$(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/accessibleruler.hxx,svtools/accessibleruler.hxx))
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/accessibletable.hxx,svtools/accessibletable.hxx))
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/accessibletableprovider.hxx,svtools/accessibletableprovider.hxx))
 $(eval $(call gb_Package_add_file,svtools_inc,inc/svtools/addresstemplate.hxx,svtools/addresstemplate.hxx))
diff --git a/main/svtools/inc/svtools/accessibleruler.hxx b/main/svtools/inc/svtools/accessibleruler.hxx
new file mode 100644
index 0000000..40457da
--- /dev/null
+++ b/main/svtools/inc/svtools/accessibleruler.hxx
@@ -0,0 +1,310 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//IAccessibility2 Implementation 2009-----
+#ifndef _SVTRULERACCESSIBLE_HXX
+#define _SVTRULERACCESSIBLE_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HPP_
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef	_COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef	_CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#include <cppuhelper/interfacecontainer.h>
+#endif
+#ifndef _CPPUHELPER_COMPBASE5_HXX_
+#include <cppuhelper/compbase5.hxx>
+#endif
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#include <comphelper/broadcasthelper.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/implbase5.hxx>
+#endif
+#ifndef _UTL_SERVICEHELPER_HXX_
+#include <comphelper/servicehelper.hxx>
+#endif
+
+namespace com { namespace sun { namespace star { namespace awt {
+	struct Point;
+	struct Rectangle;
+	struct Size;
+	class XFocusListener;
+} } } }
+
+class Rectangle;
+class Ruler;
+class Window;
+
+
+typedef ::cppu::WeakAggComponentImplHelper5<
+			::com::sun::star::accessibility::XAccessible,
+			::com::sun::star::accessibility::XAccessibleComponent,
+			::com::sun::star::accessibility::XAccessibleContext,
+			::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+			::com::sun::star::lang::XServiceInfo >
+			SvtRulerAccessible_Base;
+
+class SvtRulerAccessible : public ::comphelper::OBaseMutex, public SvtRulerAccessible_Base
+{
+public:
+	//=====  internal  ========================================================
+	SvtRulerAccessible(
+        const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, Ruler&	rRepresentation, const ::rtl::OUString& rName );
+protected:
+	virtual ~SvtRulerAccessible();
+public:
+	//=====  XAccessible  =====================================================
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+		getAccessibleContext( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	//=====  XAccessibleComponent  ============================================
+
+	virtual sal_Bool SAL_CALL
+		containsPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+		getAccessibleAtPoint( const ::com::sun::star::awt::Point& rPoint ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::awt::Rectangle SAL_CALL
+		getBounds() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::awt::Point SAL_CALL
+		getLocation() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::awt::Point SAL_CALL
+		getLocationOnScreen() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::awt::Size SAL_CALL
+		getSize() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Bool SAL_CALL
+		isShowing() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Bool SAL_CALL
+		isVisible() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Bool SAL_CALL
+		isFocusTraversable() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL
+		addFocusListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+			throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL
+		removeFocusListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFocusListener >& xListener )
+			throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL
+		grabFocus() throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::uno::Any SAL_CALL
+		getAccessibleKeyBinding() throw( ::com::sun::star::uno::RuntimeException );
+    virtual sal_Int32 SAL_CALL 
+        getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL 
+        getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleContext  ==============================================
+
+	virtual sal_Int32 SAL_CALL
+		getAccessibleChildCount( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+		getAccessibleChild( sal_Int32 nIndex )
+			throw( ::com::sun::star::uno::RuntimeException, ::com::sun::star::lang::IndexOutOfBoundsException );
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+		getAccessibleParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual	sal_Int32 SAL_CALL
+		getAccessibleIndexInParent( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Int16 SAL_CALL
+		getAccessibleRole( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::rtl::OUString SAL_CALL
+		getAccessibleDescription( void ) throw (::com::sun::star::uno::RuntimeException);
+
+	virtual ::rtl::OUString SAL_CALL
+		getAccessibleName( void ) throw (::com::sun::star::uno::RuntimeException);
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL
+		getAccessibleRelationSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL
+		getAccessibleStateSet( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::lang::Locale SAL_CALL
+		getLocale( void )
+			throw(	::com::sun::star::uno::RuntimeException,
+					::com::sun::star::accessibility::IllegalAccessibleComponentStateException );
+	//=====  XAccessibleEventBroadcaster  =====================================
+
+	virtual void SAL_CALL
+		addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )throw( com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL 
+		removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
+
+	// Needed, because some compilers would complain about virtual functions above would hide cppu::WeakAggComponentImplHelperBase::add/removeEventListener(const Reference<lang::XEventListener>&)...
+	virtual void SAL_CALL
+		addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )throw( com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL 
+		removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException );
+
+
+	//=====  XServiceInfo  ====================================================
+
+	virtual ::rtl::OUString SAL_CALL
+		getImplementationName( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual sal_Bool SAL_CALL
+		supportsService( const ::rtl::OUString& sServiceName ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString> SAL_CALL
+		getSupportedServiceNames( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	//=====  XTypeProvider  ===================================================
+
+	virtual ::com::sun::star::uno::Sequence<sal_Int8> SAL_CALL
+		getImplementationId( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+
+
+
+public:
+
+	/// Sets the name
+	void setName( const ::rtl::OUString& rName );
+
+	/// Sets the description
+	void setDescription( const ::rtl::OUString& rDescr );
+private:
+	static ::com::sun::star::uno::Sequence< sal_Int8 > getUniqueId( void );
+protected:
+
+    ///	@Return the object's current bounding box relative to the desktop.
+	virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	///	@Return the object's current bounding box relative to the parent object.
+	virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+
+	virtual void SAL_CALL disposing();
+
+	/// @returns true if it's disposed or in disposing
+	inline sal_Bool IsAlive( void ) const;
+
+	/// @returns true if it's not disposed and no in disposing
+	inline sal_Bool IsNotAlive( void ) const;
+
+	/// throws the exception DisposedException if it's not alive
+	void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
+
+private:
+    /**	Description of this object.  This is not a constant because it can
+    	be set from the outside.
+    */
+    ::rtl::OUString						msDescription;
+
+    /**	Name of this object.
+    */
+    ::rtl::OUString						msName;
+
+    ///	Reference to the parent object.
+    ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+										mxParent;
+
+	/// pointer to internal representation
+	Ruler*							mpRepr;
+
+	    /// client id in the AccessibleEventNotifier queue
+    sal_uInt32 mnClientId;
+
+
+};
+
+inline sal_Bool SvtRulerAccessible::IsAlive( void ) const
+{
+	return !rBHelper.bDisposed && !rBHelper.bInDispose;
+}
+
+inline sal_Bool SvtRulerAccessible::IsNotAlive( void ) const
+{
+	return rBHelper.bDisposed || rBHelper.bInDispose;
+}
+
+
+
+#endif
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/svtools/inc/svtools/embedhlp.hxx b/main/svtools/inc/svtools/embedhlp.hxx
index a519dad..a889287 100644
--- a/main/svtools/inc/svtools/embedhlp.hxx
+++ b/main/svtools/inc/svtools/embedhlp.hxx
@@ -117,11 +117,12 @@
         void            UpdateReplacementOnDemand();
         MapUnit         GetMapUnit() const;
         void            Lock( sal_Bool bLock = sal_True );
-        sal_Bool            IsLocked() const;
+        sal_Bool        IsLocked() const;
         void            Clear();
-        sal_Bool            is() const { return mxObj.is(); }
+        sal_Bool        is() const { return mxObj.is(); }
 
-        sal_Bool            IsChart() const;
+        sal_Bool        IsChart() const;
+		rtl::OUString	GetChartType();
 
         // #i104867#
         // Provides a graphic version number for the fetchable Graphic during this object's lifetime. Internally,
diff --git a/main/svtools/inc/svtools/headbar.hxx b/main/svtools/inc/svtools/headbar.hxx
index 144cd34..13f5952 100644
--- a/main/svtools/inc/svtools/headbar.hxx
+++ b/main/svtools/inc/svtools/headbar.hxx
@@ -233,6 +233,8 @@
 // - HeaderBar -
 // -------------
 
+class VCLXHeaderBar; // IAccessibility2 Implementation 2009
+
 class SVT_DLLPUBLIC HeaderBar : public Window
 {
 private:
@@ -260,6 +262,9 @@
 	Link				maSelectHdl;
 	Link				maDoubleClickHdl;
 	Link				maCreateAccessibleHdl;
+	
+	VCLXHeaderBar*		m_pVCLXHeaderBar; // IAccessibility2 Implementation 2009
+	
 
 	::com::sun::star::uno::Reference<
 		::com::sun::star::accessibility::XAccessible >
@@ -385,6 +390,9 @@
     virtual ::com::sun::star::uno::Reference<
 		::com::sun::star::accessibility::XAccessible >	CreateAccessible();
 	void SetAccessible( ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > );
+	// IAccessibility2 Implementation 2009
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > GetComponentInterface( sal_Bool bCreate );
+	
 };
 
 #endif	// _HEADBAR_HXX
diff --git a/main/svtools/inc/svtools/ruler.hxx b/main/svtools/inc/svtools/ruler.hxx
index 7f68c94..6befa2f 100644
--- a/main/svtools/inc/svtools/ruler.hxx
+++ b/main/svtools/inc/svtools/ruler.hxx
@@ -32,6 +32,10 @@
 #endif
 #include <vcl/field.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <svtools/accessibleruler.hxx>
+//-----IAccessibility2 Implementation 2009
+
 class MouseEvent;
 class TrackingEvent;
 class DataChangedEvent;
@@ -706,6 +710,10 @@
     Link                maDoubleClickHdl;
     Link                maExtraDownHdl;
 
+//IAccessibility2 Implementation 2009-----
+	SvtRulerAccessible* pAccContext;
+//-----IAccessibility2 Implementation 2009
+
 #ifdef _SV_RULER_CXX
     SVT_DLLPRIVATE void                ImplVDrawLine( long nX1, long nY1, long nX2, long nY2 );
     SVT_DLLPRIVATE void                ImplVDrawRect( long nX1, long nY1, long nX2, long nY2 );
@@ -865,6 +873,10 @@
 
     //set text direction right-to-left
     void                SetTextRTL(sal_Bool bRTL);
+
+//IAccessibility2 Implementation 2009-----
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+//-----IAccessibility2 Implementation 2009
 };
 
 #endif  // _RULER_HXX
diff --git a/main/svtools/inc/svtools/svlbitm.hxx b/main/svtools/inc/svtools/svlbitm.hxx
index 2c2ac77..62af086 100644
--- a/main/svtools/inc/svtools/svlbitm.hxx
+++ b/main/svtools/inc/svtools/svlbitm.hxx
@@ -42,6 +42,9 @@
 #define SV_ITEM_ID_LBOXBMP			2
 #define SV_ITEM_ID_LBOXBUTTON		3
 #define SV_ITEM_ID_LBOXCONTEXTBMP	4
+//IAccessibility2 Implementation 2009-----
+#define SV_ITEM_ID_EXTENDRLBOXSTRING	5
+//-----IAccessibility2 Implementation 2009
 
 enum SvButtonState { SV_BUTTON_UNCHECKED, SV_BUTTON_CHECKED, SV_BUTTON_TRISTATE };
 
@@ -130,6 +133,9 @@
 	virtual sal_uInt16	IsA();
 	void			InitViewData( SvLBox*,SvLBoxEntry*,SvViewDataItem* );
 	XubString		GetText() const { return aStr; }
+	//IAccessibility2 Implementation 2009-----
+	virtual XubString		GetExtendText() const {return XubString();}
+	//-----IAccessibility2 Implementation 2009
 	void 			SetText( SvLBoxEntry*, const XubString& rStr );
 	void			Paint( const Point&, SvLBox& rDev, sal_uInt16 nFlags,SvLBoxEntry* );
 	SvLBoxItem* 	Create() const;
@@ -210,6 +216,8 @@
     // Check whether this button can be modified via UI, sounding a beep if it
     // cannot be modified:
     bool            CheckModification() const;
+	//IAccessible2 implementation 2009
+	SvLBoxButtonData* GetButtonData() const{ return pData;}
 };
 
 inline void	SvLBoxButton::SetStateChecked()
diff --git a/main/svtools/inc/svtools/svlbox.hxx b/main/svtools/inc/svtools/svlbox.hxx
index ea75c88..a0f989c 100644
--- a/main/svtools/inc/svtools/svlbox.hxx
+++ b/main/svtools/inc/svtools/svlbox.hxx
@@ -189,6 +189,8 @@
 	friend class SvLBox;
 
 	SvPtrarr 	aItems;
+    // IAccessible2 implementation in 2009
+    sal_Bool      bIsMarked;
 	void*	 	pUserData;
 	sal_uInt16	 	nEntryFlags;
 //#if 0 // _SOLAR__PRIVATE
@@ -217,6 +219,9 @@
 
 	sal_uInt16		GetFlags() const { return nEntryFlags; }
 	void		SetFlags( sal_uInt16 nFlags ) { nEntryFlags = nFlags; }
+    // IAccessible2 implementation in 2009
+    sal_Bool		GetIsMarked() const { return bIsMarked ; }
+	void		       SetMarked( sal_Bool IsMarked ) { bIsMarked =IsMarked ; }
 };
 
 // *********************************************************************
diff --git a/main/svtools/inc/svtools/svtools.hrc b/main/svtools/inc/svtools/svtools.hrc
index 8f21e55..d27452a 100644
--- a/main/svtools/inc/svtools/svtools.hrc
+++ b/main/svtools/inc/svtools/svtools.hrc
@@ -247,7 +247,7 @@
 #define STR_SVT_ACC_LISTENTRY_SELCTED_STATE		(STR_SVT_ACC_BEGIN+7)
 #define STR_SVT_ACC_RULER_VERT_NAME	(STR_SVT_ACC_BEGIN+8)
 #define STR_SVT_ACC_RULER_HORZ_NAME	(STR_SVT_ACC_BEGIN+9)
-#define STR_SVT_ACC_END						(STR_SVT_ACC_EMPTY_FIELD)
+#define STR_SVT_ACC_END					(STR_SVT_ACC_RULER_HORZ_NAME)
 
 #define STR_SVT_INDEXENTRY_START			(STR_SVT_ACC_END + 1)
 #define STR_SVT_INDEXENTRY_ALPHANUMERIC		(STR_SVT_INDEXENTRY_START+0)
diff --git a/main/svtools/inc/svtools/svtreebx.hxx b/main/svtools/inc/svtools/svtreebx.hxx
index d92a6e0..45beac5 100644
--- a/main/svtools/inc/svtools/svtreebx.hxx
+++ b/main/svtools/inc/svtools/svtreebx.hxx
@@ -43,6 +43,11 @@
 #define TREEFLAG_MANINS			0x0004
 #define TREEFLAG_RECALCTABS		0x0008
 
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_NOTSET	0x00
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_LIST	0x01
+#define TREEBOX_ALLITEM_ACCROLE_TYPE_TREE	0x02
+
+
 typedef sal_Int64   ExtendedWinBits;
 
 // disable the behavior of automatically selecting a "CurEntry" upon painting the control
@@ -71,7 +76,9 @@
 	short			nEntryHeightOffs;
 	short  			nIndent;
 	short			nFocusWidth;
-	sal_uInt16			aContextBmpMode;
+	sal_uInt16		aContextBmpMode;
+	
+	short			nAllItemAccRoleType;
 
 #ifdef _SVTREEBX_CXX
 	DECL_DLLPRIVATE_LINK( CheckButtonClick, SvLBoxButtonData * );
@@ -400,6 +407,19 @@
 	/** Enables, that one cell of a tablistbox entry can be focused */
 	void				EnableCellFocus();
 
+// IAccessible2 implementation in 2009-----------
+						// For overwriting accessible role for all entries - normally 0, so each entry can be different
+	void				SetAllEntriesAccessibleRoleType( short n ) { nAllItemAccRoleType = n; }
+	short				GetAllEntriesAccessibleRoleType() const { return nAllItemAccRoleType; }
+	
+	sal_uInt16 			GetTreeFlags() const {return nTreeFlags;}
+	
+	XubString			headString ;
+	String				SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) ;
+	virtual	String		GetEntryAltText( SvLBoxEntry* pEntry) const;
+	virtual	String		GetEntryLongDescription( SvLBoxEntry* pEntry) const;	
+// -----------IAccessible2 implementation in 2009
+
 protected:
     using SvListView::Expand;
     using SvListView::Collapse;
diff --git a/main/svtools/inc/svtools/texteng.hxx b/main/svtools/inc/svtools/texteng.hxx
index 81c9217..989e081 100644
--- a/main/svtools/inc/svtools/texteng.hxx
+++ b/main/svtools/inc/svtools/texteng.hxx
@@ -324,6 +324,8 @@
 	static sal_Bool			DoesKeyChangeText( const KeyEvent& rKeyEvent );
 	static sal_Bool			DoesKeyMoveCursor( const KeyEvent& rKeyEvent );
 	static sal_Bool			IsSimpleCharInput( const KeyEvent& rKeyEvent );
+// IAccessible2 implementation in 2009
+	Color 				GetTextColor() {return maTextColor; };
 };
 
 #endif // _TEXTENG_HXX
diff --git a/main/svtools/inc/svtools/treelist.hxx b/main/svtools/inc/svtools/treelist.hxx
index b881a81..8032c96 100644
--- a/main/svtools/inc/svtools/treelist.hxx
+++ b/main/svtools/inc/svtools/treelist.hxx
@@ -56,6 +56,8 @@
 #define SVLISTENTRYFLAG_FOCUSED			0x0004
 #define SVLISTENTRYFLAG_CURSORED		0x0008
 #define SVLISTENTRYFLAG_NOT_SELECTABLE	0x0010
+// IAccessible2 implementation
+#define SVLISTENTRYFLAG_OBJSELECTED	0x0040
 
 class SvListEntry;
 
@@ -152,6 +154,14 @@
 			nFlags |= SVLISTENTRYFLAG_NOT_SELECTABLE;
 	}
 	bool IsSelectable() const { return (bool)(nFlags&SVLISTENTRYFLAG_NOT_SELECTABLE)==0; }
+	// IAccessible2 implementation
+	void SetObjectSelected(sal_Bool bSelected)
+	{
+	if ( !bSelected )
+		nFlags &= (~SVLISTENTRYFLAG_OBJSELECTED);
+	else
+		nFlags |= SVLISTENTRYFLAG_OBJSELECTED;
+	}
 };
 
 enum SvSortMode { SortAscending, SortDescending, SortNone };
diff --git a/main/svtools/inc/svtools/valueset.hxx b/main/svtools/inc/svtools/valueset.hxx
index 82c3b24..f9cb9a2 100644
--- a/main/svtools/inc/svtools/valueset.hxx
+++ b/main/svtools/inc/svtools/valueset.hxx
@@ -317,7 +317,7 @@
 
 	sal_Bool			StartDrag( const CommandEvent& rCEvt, Region& rRegion );
 	sal_uInt16			ShowDropPos( const Point& rPos );
-	void			HideDropPos();
+	void				HideDropPos();
 
 protected:
 
@@ -358,6 +358,9 @@
 								sal_uInt16 nPos = VALUESET_APPEND );
 	void			InsertItem( sal_uInt16 nItemId,
 								sal_uInt16 nPos = VALUESET_APPEND );
+					// IA2 implementation in 2009 - method to set accessible when the style is user draw.
+	void			InsertItem( sal_uInt16 nItemId, const XubString& rStr, sal_uInt16 nPos = VALUESET_APPEND );
+
 	void			InsertSpace( sal_uInt16 nItemId,
 								 sal_uInt16 nPos = VALUESET_APPEND );
 	void			RemoveItem( sal_uInt16 nItemId );
@@ -365,24 +368,24 @@
 	void			CopyItems( const ValueSet& rValueSet );
 	void			Clear();
 
-	sal_uInt16			GetItemCount() const;
-	sal_uInt16			GetItemPos( sal_uInt16 nItemId ) const;
-	sal_uInt16			GetItemId( sal_uInt16 nPos ) const;
-	sal_uInt16			GetItemId( const Point& rPos ) const;
+	sal_uInt16		GetItemCount() const;
+	sal_uInt16		GetItemPos( sal_uInt16 nItemId ) const;
+	sal_uInt16		GetItemId( sal_uInt16 nPos ) const;
+	sal_uInt16		GetItemId( const Point& rPos ) const;
 	Rectangle		GetItemRect( sal_uInt16 nItemId ) const;
 
 	void			EnableFullItemMode( bool bFullMode = true );
 	bool            IsFullItemModeEnabled() const { return mbFullMode; }
 	void			SetColCount( sal_uInt16 nNewCols = 1 );
-	sal_uInt16			GetColCount() const { return mnUserCols; }
+	sal_uInt16		GetColCount() const { return mnUserCols; }
 	void			SetLineCount( sal_uInt16 nNewLines = 0 );
-	sal_uInt16			GetLineCount() const { return mnUserVisLines; }
+	sal_uInt16		GetLineCount() const { return mnUserVisLines; }
 	void			SetItemWidth( long nItemWidth = 0 );
 	long			GetItemWidth() const { return mnUserItemWidth; }
 	void			SetItemHeight( long nLineHeight = 0 );
 	long			GetItemHeight() const { return mnUserItemHeight; }
 	void			SetFirstLine( sal_uInt16 nNewLine = 0 );
-	sal_uInt16			GetFirstLine() const { return mnFirstLine; }
+	sal_uInt16		GetFirstLine() const { return mnFirstLine; }
 
 	void			SelectItem( sal_uInt16 nItemId );
 	sal_uInt16			GetSelectItemId() const { return mnSelItemId; }
@@ -392,7 +395,7 @@
 	bool            IsNoSelection() const { return mbNoSelection; }
 
 	void			SetItemBits( sal_uInt16 nItemId, sal_uInt16 nBits );
-	sal_uInt16			GetItemBits( sal_uInt16 nItemId ) const;
+	sal_uInt16		GetItemBits( sal_uInt16 nItemId ) const;
 	void			SetItemImage( sal_uInt16 nItemId, const Image& rImage );
 	Image			GetItemImage( sal_uInt16 nItemId ) const;
 	void			SetItemColor( sal_uInt16 nItemId, const Color& rColor );
@@ -407,7 +410,7 @@
 	bool            IsColor() const { return maColor.GetTransparency() == 0; }
 
 	void			SetExtraSpacing( sal_uInt16 nNewSpacing );
-	sal_uInt16			GetExtraSpacing() { return mnSpacing; }
+	sal_uInt16		GetExtraSpacing() { return mnSpacing; }
 
 	void			Format();
 
diff --git a/main/svtools/inc/svtools/vclxaccessibleheaderbar.hxx b/main/svtools/inc/svtools/vclxaccessibleheaderbar.hxx
new file mode 100644
index 0000000..060adcb
--- /dev/null
+++ b/main/svtools/inc/svtools/vclxaccessibleheaderbar.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_
+#define _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_
+
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#endif
+#ifndef _HEADBAR_HXX
+#include <svtools/headbar.hxx>
+#endif
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#include "toolkit/awt/vclxwindow.hxx"
+#endif
+class HeaderBar;
+
+//	----------------------------------------------------
+//	class VCLXAccessibleHeaderBar
+//	----------------------------------------------------
+
+typedef std::vector< ::com::sun::star::uno::WeakReference< ::com::sun::star::accessibility::XAccessible > >
+    ListItems;
+
+class VCLXAccessibleHeaderBar : public VCLXAccessibleComponent								
+{
+
+public:
+	HeaderBar*	m_pHeadBar;
+	virtual ~VCLXAccessibleHeaderBar();
+
+    virtual void ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+    virtual void FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+	VCLXAccessibleHeaderBar( VCLXWindow* pVCLXindow );
+
+	// XAccessibleContext
+	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
+
+
+	// XServiceInfo
+	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+public:
+	virtual void SAL_CALL disposing (void);
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateChild(sal_Int32 i);
+
+private:
+	ListItems m_aAccessibleChildren;
+
+
+};
+
+class VCLXHeaderBar :  public VCLXWindow
+{
+public:
+    VCLXHeaderBar(Window* pHeaderBar);
+    virtual ~VCLXHeaderBar();
+	
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+	
+};
+
+#endif // _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_
+
diff --git a/main/svtools/inc/svtools/vclxaccessibleheaderbaritem.hxx b/main/svtools/inc/svtools/vclxaccessibleheaderbaritem.hxx
new file mode 100644
index 0000000..a918be3
--- /dev/null
+++ b/main/svtools/inc/svtools/vclxaccessibleheaderbaritem.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_
+#define _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef COMPHELPER_ACCESSIBLE_COMPONENT_HELPER_HXX
+#include <comphelper/accessiblecomponenthelper.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE2_HXX_
+#include <cppuhelper/implbase2.hxx>
+#endif
+
+#ifndef _LINK_HXX
+#include <tools/link.hxx>
+#endif
+
+#include <vector>
+
+class HeaderBar;
+class VCLExternalSolarLock;
+class VclSimpleEvent;
+class VclWindowEvent;
+
+namespace utl {
+class AccessibleStateSetHelper;
+}
+
+
+//	----------------------------------------------------
+//	class VCLXAccessibleHeaderBarItem
+//	----------------------------------------------------
+
+typedef ::comphelper::OAccessibleExtendedComponentHelper	AccessibleExtendedComponentHelper_BASE;
+
+typedef ::cppu::ImplHelper2<
+::com::sun::star::accessibility::XAccessible,
+::com::sun::star::lang::XServiceInfo > VCLXAccessibleHeaderBarItem_BASE;
+
+class VCLXAccessibleHeaderBarItem :	public AccessibleExtendedComponentHelper_BASE,
+						public VCLXAccessibleHeaderBarItem_BASE		
+{
+private:		
+	VCLExternalSolarLock*	m_pExternalLock;
+	HeaderBar*				m_pHeadBar;
+	sal_Int32				m_nIndexInParent;
+
+protected:
+	DECL_LINK( WindowEventListener, VclSimpleEvent* );
+
+	virtual void			ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
+	virtual void			FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet );
+
+	// OCommonAccessibleComponent 
+	virtual ::com::sun::star::awt::Rectangle SAL_CALL	implGetBounds(  ) throw (::com::sun::star::uno::RuntimeException);
+
+	// XComponent
+	virtual void SAL_CALL	disposing();
+
+public:
+	VCLXAccessibleHeaderBarItem( HeaderBar*	pHeadBar, sal_Int32 _nIndexInParent );
+	~VCLXAccessibleHeaderBarItem();
+
+	// XInterface
+	DECLARE_XINTERFACE()
+
+	// XTypeProvider
+	DECLARE_XTYPEPROVIDER()
+
+	// XServiceInfo
+	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& rServiceName ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+	// XAccessible
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleContext
+	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleComponent
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException){};
+	virtual sal_Int32 SAL_CALL getForeground() throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getBackground() throw (::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleExtendedComponent
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XFont > SAL_CALL getFont(	) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getTitledBorderText(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getToolTipText(  ) throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif // _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_
+
diff --git a/main/svtools/source/brwbox/brwbox3.cxx b/main/svtools/source/brwbox/brwbox3.cxx
index 18e5e2f..4dfa84f 100644
--- a/main/svtools/source/brwbox/brwbox3.cxx
+++ b/main/svtools/source/brwbox/brwbox3.cxx
@@ -215,7 +215,9 @@
 
 // Object data and state ------------------------------------------------------
 
-OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 ) const
+//IAccessibility2 Implementation 2009-----
+OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType eObjType,sal_Int32 _nPosition) const
+//-----IAccessibility2 Implementation 2009
 {
     OUString aRetText;
     switch( eObjType )
@@ -233,7 +235,18 @@
 			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderBar" ) );
 			break;
         case ::svt::BBTYPE_TABLECELL:
-            aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TableCell" ) );
+//IAccessibility2 Implementation 2009-----
+			if( ColCount() !=0 && GetRowCount()!=0)
+			{
+           
+				sal_Int32 columnId = _nPosition % ColCount() +1;
+				aRetText = OUString( GetColumnDescription( sal_Int16( columnId ) ) );
+				sal_Int32 rowId = _nPosition / GetRowCount() + 1;
+				aRetText += OUString::valueOf(rowId); 
+			}
+			else
+//-----IAccessibility2 Implementation 2009
+				aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "TableCell" ) );
 #if OSL_DEBUG_LEVEL > 1
             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
 			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
@@ -243,7 +256,11 @@
 #endif			
 			break;
         case ::svt::BBTYPE_ROWHEADERCELL:
-			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderCell" ) );
+			{
+			sal_Int32 rowId = _nPosition + 1;
+			aRetText = OUString::valueOf( rowId );
+			}
+			//aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "RowHeaderCell" ) );
 #if OSL_DEBUG_LEVEL > 1
             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
 			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
@@ -253,7 +270,8 @@
 #endif
 			break;
         case ::svt::BBTYPE_COLUMNHEADERCELL:
-			aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderCell" ) );
+			//aRetText = OUString( RTL_CONSTASCII_USTRINGPARAM( "ColumnHeaderCell" ) );
+			aRetText = OUString( GetColumnDescription( sal_Int16( _nPosition ) ) );
 #if OSL_DEBUG_LEVEL > 1
             aRetText += OUString( RTL_CONSTASCII_USTRINGPARAM( " [" ) );
 			aRetText += OUString::valueOf(sal_Int32(GetCurRow()));
diff --git a/main/svtools/source/brwbox/editbrowsebox.cxx b/main/svtools/source/brwbox/editbrowsebox.cxx
index a63a456..1fa2382 100644
--- a/main/svtools/source/brwbox/editbrowsebox.cxx
+++ b/main/svtools/source/brwbox/editbrowsebox.cxx
@@ -1072,7 +1072,10 @@
                 {
 					commitTableEvent(
                         ACTIVE_DESCENDANT_CHANGED,
-						makeAny( CreateAccessibleCell( nRow, GetColumnPos( nCol ) ) ),
+//IAccessibility2 Implementation 2009-----
+						//makeAny( CreateAccessibleCell( nRow, GetColumnPos( nCol ) ) ),
+						makeAny( CreateAccessibleCell( nRow, GetColumnPos( nCol -1) ) ),
+//-----IAccessibility2 Implementation 2009
 						Any()
 					);
                 }
diff --git a/main/svtools/source/contnr/imivctl1.cxx b/main/svtools/source/contnr/imivctl1.cxx
index 2ff631e..e08a109 100644
--- a/main/svtools/source/contnr/imivctl1.cxx
+++ b/main/svtools/source/contnr/imivctl1.cxx
@@ -1180,6 +1180,9 @@
 		{
 			SelectEntry( pCursor, sal_True, sal_True,  sal_False, bPaintSync );
 			aCurSelectionRect = GetEntryBoundRect( pCursor );
+			//IAccessibility2 Implementation 2009-----
+			CallEventListeners( VCLEVENT_LISTBOX_SELECT, pCursor );
+			//-----IAccessibility2 Implementation 2009
 		}
 	}
 }
diff --git a/main/svtools/source/contnr/svimpbox.cxx b/main/svtools/source/contnr/svimpbox.cxx
index 3a7aa40..f9277ee 100644
--- a/main/svtools/source/contnr/svimpbox.cxx
+++ b/main/svtools/source/contnr/svimpbox.cxx
@@ -299,6 +299,10 @@
 
 	// #97680# ---------
 	aContextBmpWidthVector.clear();
+
+//IAccessibility2 Implementation 2009-----
+	CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED, NULL );
+//-----IAccessibility2 Implementation 2009
 }
 
 // *********************************************************************
@@ -646,6 +650,9 @@
 		if(!bForceNoSelect && bSimpleTravel && !(nFlags & F_DESEL_ALL) && GetUpdateMode())
 		{
 			pView->Select( pCursor, sal_True );
+			//IAccessibility2 Implementation 2009-----
+			CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor );
+			//-----IAccessibility2 Implementation 2009
 		}
 		// Mehrfachselektion: Im Cursor-Move selektieren, wenn
 		// nicht im Add-Mode (Ctrl-F8)
@@ -655,10 +662,19 @@
 				 !bForceNoSelect )
 		{
 			pView->Select( pCursor, sal_True );
+			//IAccessibility2 Implementation 2009-----
+			CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor );
+			//-----IAccessibility2 Implementation 2009
 		}
 		else
 		{
 			ShowCursor( sal_True );
+			//IAccessibility2 Implementation 2009-----
+			if (bForceNoSelect && GetUpdateMode())
+			{
+				CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pCursor);
+			}
+			//-----IAccessibility2 Implementation 2009
 		}
 
 		if( pAnchor )
@@ -1700,6 +1716,10 @@
 
 void SvImpLBox::RemovingEntry( SvLBoxEntry* pEntry )
 {
+	//IAccessibility2 Implementation 2009-----
+	CallEventListeners( VCLEVENT_LISTBOX_ITEMREMOVED , pEntry );
+	//-----IAccessibility2 Implementation 2009
+
 	DestroyAnchor();
 
 	if( !pView->IsEntryVisible( pEntry ) )
@@ -2359,7 +2379,10 @@
 
 		case KEY_LEFT:
 		{
-            if ( bIsCellFocusEnabled )
+            //IAccessibility2 Implementation 2009-----
+            // if ( bIsCellFocusEnabled )
+            if ( bIsCellFocusEnabled && pCursor )
+			//-----IAccessibility2 Implementation 2009
             {
                 if ( nCurTabPos > FIRST_ENTRY_TAB )
                 {
@@ -2677,7 +2700,7 @@
             // is from SvTreeListBox::KeyInput. If we set bKeyUsed to sal_True here, then the key input
             // is just silenced. However, we want SvLBox::KeyInput to get a chance, to do the QuickSelection
             // handling.
-            // (The old code here which intentionally set bKeyUsed to TRUE said this was because of "quick search"
+            // (The old code here which intentionally set bKeyUsed to sal_True said this was because of "quick search"
             // handling, but actually there was no quick search handling anymore. We just re-implemented it.)
             // #i31275# / 2009-06-16 / frank.schoenheit@sun.com
 			bKeyUsed = sal_False;
diff --git a/main/svtools/source/contnr/svtabbx.cxx b/main/svtools/source/contnr/svtabbx.cxx
index c09e6d3..1ce5380 100644
--- a/main/svtools/source/contnr/svtabbx.cxx
+++ b/main/svtools/source/contnr/svtabbx.cxx
@@ -1182,6 +1182,10 @@
 			sal_uInt16 nCurColumn = GetCurrColumn();
 			if ( IsCellVisible( nCurRow, nCurColumn ) )
 				_rStateSet.AddState( AccessibleStateType::VISIBLE );
+			//IAccessibility2 Implementation 2009-----
+			if ( IsEnabled() )
+				_rStateSet.AddState( AccessibleStateType::ENABLED );
+			//-----IAccessibility2 Implementation 2009
 			_rStateSet.AddState( AccessibleStateType::TRANSIENT );
 			break;
 		}
@@ -1192,6 +1196,10 @@
 			_rStateSet.AddState( AccessibleStateType::VISIBLE );
 			_rStateSet.AddState( AccessibleStateType::FOCUSABLE );
 			_rStateSet.AddState( AccessibleStateType::TRANSIENT );
+			//IAccessibility2 Implementation 2009-----
+			if ( IsEnabled() )
+				_rStateSet.AddState( AccessibleStateType::ENABLED );
+			//-----IAccessibility2 Implementation 2009
 			break;
 		}
         default:
@@ -1216,6 +1224,9 @@
 		_rStateSet.AddState( AccessibleStateType::ACTIVE );
 		_rStateSet.AddState( AccessibleStateType::SELECTED );
 	}
+	//IAccessibility2 Implementation 2009-----
+	if ( IsEnabled() )
+		_rStateSet.AddState( AccessibleStateType::ENABLED );
 }
 // -----------------------------------------------------------------------
 void SvHeaderTabListBox::GrabTableFocus()
diff --git a/main/svtools/source/contnr/svtreebx.cxx b/main/svtools/source/contnr/svtreebx.cxx
index 6bc682b..bbad7db 100644
--- a/main/svtools/source/contnr/svtreebx.cxx
+++ b/main/svtools/source/contnr/svtreebx.cxx
@@ -91,6 +91,7 @@
 	nFirstSelTab = 0;
 	nLastSelTab = 0;
 	nFocusWidth = -1;
+	nAllItemAccRoleType = 0;
 
 	Link* pLink = new Link( LINK(this,SvTreeListBox, DefaultCompare) );
     pLBoxImpl->m_pLink = pLink;
@@ -345,6 +346,89 @@
 	return pItem->GetText();
 }
 
+//IAccessibility2 Implementation 2009-----
+String  SvTreeListBox::GetEntryAltText( SvLBoxEntry* ) const
+{
+	String tmp;
+	return tmp;
+}
+String SvTreeListBox::GetEntryLongDescription( SvLBoxEntry* ) const
+{
+	String tmp;
+	return tmp;
+}
+
+String SvTreeListBox::SearchEntryTextWithHeadTitle( SvLBoxEntry* pEntry ) 
+{
+	DBG_CHKTHIS(SvTreeListBox,0);
+	DBG_ASSERT( pEntry, "SvTreeListBox::SearchEntryText(): no entry" );
+	String sRet;
+
+	sal_uInt16 nCount = pEntry->ItemCount();
+	sal_uInt16 nCur = 0;
+	sal_uInt16 nHeaderCur = 0;
+	SvLBoxItem* pItem;
+	while( nCur < nCount )
+	{
+		// MT: SV_ITEM_ID_EXTENDRLBOXSTRING / GetExtendText() was in use in IA2 cws, but only used in sc: ScSolverOptionsString. Needed?
+		pItem = pEntry->GetItem( nCur );
+		if ( (pItem->IsA() == SV_ITEM_ID_LBOXSTRING /* || pItem->IsA() == SV_ITEM_ID_EXTENDRLBOXSTRING */ ) &&
+			 static_cast<SvLBoxString*>( pItem )->GetText().Len() > 0 )
+		{
+
+			//want to the column header
+			if( headString.Len() > 0)
+			{
+				xub_StrLen nEnd = headString.Search( sal_Unicode( '\t' ) );
+				if( nEnd == STRING_NOTFOUND )
+				{
+					if(sRet.Len()>0)
+					{
+						sRet += ',';
+					}
+					if(headString.Len()>0)
+					{
+						sRet += headString ;
+						sRet += ':' ;
+					}
+				}
+				else
+				{
+					String	aString=headString.GetToken(nHeaderCur, sal_Unicode( '\t' ) );
+					if(sRet.Len()>0)
+					{
+						sRet += ',';
+					}
+					if( aString.Len() > 0)
+					{
+						sRet += aString ;
+						sRet += ':' ;
+					}
+					nHeaderCur++;
+				}
+				// if (pItem->IsA() == SV_ITEM_ID_LBOXSTRING)
+					sRet += static_cast<SvLBoxString*>( pItem )->GetText();
+				// else
+				//	sRet += static_cast<SvLBoxString*>( pItem )->GetExtendText();
+			}
+			else
+			{
+				// if (pItem->IsA() == SV_ITEM_ID_LBOXSTRING)
+					sRet += static_cast<SvLBoxString*>( pItem )->GetText();
+				// else
+				// 	sRet += static_cast<SvLBoxString*>( pItem )->GetExtendText();
+				sRet += ',';
+			}
+			//end want to the column header
+		}
+		nCur++;
+	}
+
+	if (sRet.Len() > 0)
+		sRet = sRet.Erase(sRet.Len() - 1);
+	return sRet;
+}
+//-----IAccessibility2 Implementation 2009
 String SvTreeListBox::SearchEntryText( SvLBoxEntry* pEntry ) const
 {
 	DBG_CHKTHIS(SvTreeListBox,0);
@@ -806,18 +890,45 @@
 void SvTreeListBox::GetFocus()
 {
 	DBG_CHKTHIS(SvTreeListBox,0);
+	//IAccessibility2 Implementation 2009-----
+	//Solution:If there is no item in the tree,draw focus.
+	if( !SvLBox::First())
+	{
+		Invalidate();
+	}
+	//-----IAccessibility2 Implementation 2009
 	pImp->GetFocus();
 	SvLBox::GetFocus();
 
 	SvLBoxEntry* pEntry = FirstSelected();
+	//IAccessibility2 Implementation 2009-----
+	if ( !pEntry )
+	{
+		pEntry = pImp->GetCurrentEntry();
+	}
+	if (pImp->pCursor)
+	{
+		if (pEntry != pImp->pCursor)
+			pEntry = pImp->pCursor;
+	}
+	//IAccessibility2 Implementation 2009-----
 	if ( pEntry )
-		pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry );
+		//pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry );
+		pImp->CallEventListeners( VCLEVENT_LISTBOX_TREEFOCUS, pEntry );
+	//-----IAccessibility2 Implementation 2009
 
 }
 
 void SvTreeListBox::LoseFocus()
 {
 	DBG_CHKTHIS(SvTreeListBox,0);
+	//IAccessibility2 Implementation 2009-----
+	//Solution:If there is no item in the tree,delete visual focus.
+	if( !SvLBox::First())
+	{
+		Invalidate();
+	}
+	//-----IAccessibility2 Implementation 2009
 	pImp->LoseFocus();
 	SvLBox::LoseFocus();
 }
@@ -1064,7 +1175,9 @@
 		if( bSelect )
 		{
 			SelectHdl();
-			pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry );
+			// IA2 CWS
+			// pImp->CallEventListeners( VCLEVENT_LISTBOX_SELECT, pEntry );
+			CallEventListeners( VCLEVENT_LISTBOX_TREESELECT, pEntry);			
 		}
 		else
 			DeselectHdl();
@@ -1185,6 +1298,24 @@
 	if( nTreeFlags & TREEFLAG_RECALCTABS )
 		SetTabs();
 	pImp->Paint( rRect );
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add visual focus draw
+	if( !SvLBox::First() )
+	{
+		if( HasFocus() )
+		{
+			long tempHeight = GetTextHeight();
+			Rectangle tempRect(
+								Point(0,0),Size(GetSizePixel().Width(),tempHeight)
+							   );
+			ShowFocus(tempRect);
+		}
+
+		else{
+			HideFocus();
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 void SvTreeListBox::MouseButtonDown( const MouseEvent& rMEvt )
@@ -2644,6 +2775,14 @@
 		rStateSet.AddState( AccessibleStateType::EXPANDABLE );
 		if ( IsExpanded( pEntry ) )
 		    rStateSet.AddState( (sal_Int16)AccessibleStateType::EXPANDED );
+		// IA2 CWS
+		/*
+		else
+		{
+			// MT: COLLAPSE == EXPANDABLE & !EXPANDED
+			rStateSet.AddState( (sal_Int16)AccessibleStateType::COLLAPSE );
+		}
+		*/
 	}
 
 	if ( GetCheckButtonState( pEntry ) == SV_BUTTON_CHECKED )
@@ -2652,6 +2791,21 @@
 		rStateSet.AddState( AccessibleStateType::VISIBLE );
 	if ( IsSelected( pEntry ) )
 		rStateSet.AddState( AccessibleStateType::SELECTED );
+	//IAccessibility2 Implementation 2009-----
+	if ( IsEnabled() )
+	{
+		rStateSet.AddState( AccessibleStateType::ENABLED );
+		rStateSet.AddState( AccessibleStateType::FOCUSABLE );
+		rStateSet.AddState( AccessibleStateType::SELECTABLE );
+		SvViewDataEntry* pViewDataNewCur = 0;
+		if( pEntry )
+		{
+			pViewDataNewCur= GetViewDataEntry(pEntry);
+			if(pViewDataNewCur->HasFocus())
+				rStateSet.AddState( AccessibleStateType::FOCUSED );
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 Rectangle SvTreeListBox::GetBoundingRect( SvLBoxEntry* pEntry )
@@ -2675,3 +2829,4 @@
 {
       SvLBox::FillAccessibleStateSet( rStateSet );
 }
+
diff --git a/main/svtools/source/control/accessibleruler.cxx b/main/svtools/source/control/accessibleruler.cxx
new file mode 100644
index 0000000..7edeefd
--- /dev/null
+++ b/main/svtools/source/control/accessibleruler.cxx
@@ -0,0 +1,554 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef _SVTRULERACCESSIBLE_HXX
+#include <svtools/accessibleruler.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#endif
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
+#include <unotools/accessiblestatesethelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+
+#ifndef	_COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#include <toolkit/helper/convert.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_GEN_HXX
+#include <tools/gen.hxx>
+#endif
+
+#include "ruler.hxx"
+
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#include <comphelper/accessibleeventnotifier.hxx>
+#endif
+
+using namespace ::cppu;
+using namespace ::osl;
+using namespace	::rtl;
+using namespace	::com::sun::star;
+using namespace	::com::sun::star::uno;
+using namespace	::com::sun::star::accessibility;
+
+DBG_NAME( SvtRulerAccessible )
+
+
+//=====  internal  ============================================================
+
+SvtRulerAccessible::SvtRulerAccessible(
+	const uno::Reference< XAccessible >& rxParent, Ruler& rRepr, const OUString& rName ) :
+
+	SvtRulerAccessible_Base( m_aMutex ),
+	msName( rName ),
+	mxParent( rxParent ),
+	mpRepr( &rRepr ),
+    mnClientId( 0 )
+{
+	DBG_CTOR( SvtRulerAccessible, NULL );
+}
+
+SvtRulerAccessible::~SvtRulerAccessible()
+{
+	DBG_DTOR( SvtRulerAccessible, NULL );
+
+	if( IsAlive() )
+	{
+		osl_incrementInterlockedCount( &m_refCount );
+		dispose();		// set mpRepr = NULL & release all childs
+	}
+}
+
+//=====  XAccessible  =========================================================
+
+uno::Reference< XAccessibleContext > SAL_CALL SvtRulerAccessible::getAccessibleContext( void ) throw( RuntimeException )
+{
+	return this;
+}
+
+//=====  XAccessibleComponent  ================================================
+
+sal_Bool SAL_CALL SvtRulerAccessible::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+	// no guard -> done in getBounds()
+//	return GetBoundingBox().IsInside( VCLPoint( rPoint ) );
+	return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException )
+{
+	::osl::MutexGuard			aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+
+	uno::Reference< XAccessible >	xRet;
+
+
+	return xRet;
+}
+
+awt::Rectangle SAL_CALL SvtRulerAccessible::getBounds() throw( RuntimeException )
+{
+	// no guard -> done in GetBoundingBox()
+	return AWTRectangle( GetBoundingBox() );
+}
+
+awt::Point SAL_CALL SvtRulerAccessible::getLocation() throw( RuntimeException )
+{
+	// no guard -> done in GetBoundingBox()
+	return AWTPoint( GetBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL SvtRulerAccessible::getLocationOnScreen() throw( RuntimeException )
+{
+	// no guard -> done in GetBoundingBoxOnScreen()
+	return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL SvtRulerAccessible::getSize() throw( RuntimeException )
+{
+	// no guard -> done in GetBoundingBox()
+	return AWTSize( GetBoundingBox().GetSize() );
+}
+
+sal_Bool SAL_CALL SvtRulerAccessible::isShowing() throw( RuntimeException )
+{
+	return sal_True;
+}
+
+sal_Bool SAL_CALL SvtRulerAccessible::isVisible() throw( RuntimeException )
+{
+	::osl::MutexGuard			aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+
+	return mpRepr->IsVisible();
+}
+
+sal_Bool SAL_CALL SvtRulerAccessible::isFocusTraversable() throw( RuntimeException )
+{
+	return sal_True;
+}
+
+//=====  XAccessibleContext  ==================================================
+
+sal_Int32 SAL_CALL SvtRulerAccessible::getAccessibleChildCount( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+
+	return 0;
+}
+
+uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleChild( sal_Int32 )
+	throw( RuntimeException, lang::IndexOutOfBoundsException )
+{
+	uno::Reference< XAccessible >	xChild ;
+
+	return xChild;
+}
+
+uno::Reference< XAccessible > SAL_CALL SvtRulerAccessible::getAccessibleParent( void ) throw( RuntimeException )
+{
+	return mxParent;
+}
+
+sal_Int32 SAL_CALL SvtRulerAccessible::getAccessibleIndexInParent( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	//	Use a simple but slow solution for now.  Optimize later.
+
+    //	Iterate over all the parent's children and search for this object.
+    if( mxParent.is() )
+    {
+    	uno::Reference< XAccessibleContext >		xParentContext( mxParent->getAccessibleContext() );
+        if( xParentContext.is() )
+        {
+        	sal_Int32						nChildCount = xParentContext->getAccessibleChildCount();
+            for( sal_Int32 i = 0 ; i < nChildCount ; ++i )
+            {
+            	uno::Reference< XAccessible >	xChild( xParentContext->getAccessibleChild( i ) );
+				if( xChild.get() == ( XAccessible* ) this )
+                    return i;
+            }
+        }
+   }
+
+   //	Return -1 to indicate that this object's parent does not know about the
+   //	object.
+   return -1;
+}
+
+sal_Int16 SAL_CALL SvtRulerAccessible::getAccessibleRole( void ) throw( RuntimeException )
+{
+	return AccessibleRole::RULER;
+}
+
+OUString SAL_CALL SvtRulerAccessible::getAccessibleDescription( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	return msDescription;
+}
+
+OUString SAL_CALL SvtRulerAccessible::getAccessibleName( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	return msName;
+}
+
+/**	Return empty uno::Reference to indicate that the relation set is not
+	supported.
+*/
+uno::Reference< XAccessibleRelationSet > SAL_CALL SvtRulerAccessible::getAccessibleRelationSet( void ) throw( RuntimeException )
+{
+	return uno::Reference< XAccessibleRelationSet >();
+}
+
+
+uno::Reference< XAccessibleStateSet > SAL_CALL SvtRulerAccessible::getAccessibleStateSet( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard						aGuard( m_aMutex );
+	utl::AccessibleStateSetHelper*			pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+	if( IsAlive() )
+	{
+		pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+				
+		if( isShowing() )
+			pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+
+		if( isVisible() )
+			pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+
+		
+		if ( mpRepr )
+		{
+			if ( mpRepr->GetStyle() & WB_HORZ )
+				pStateSetHelper->AddState( AccessibleStateType::HORIZONTAL );
+			else 
+				pStateSetHelper->AddState( AccessibleStateType::VERTICAL );
+		}
+		if(pStateSetHelper->contains(AccessibleStateType::FOCUSABLE))
+		{
+			pStateSetHelper->RemoveState( AccessibleStateType::FOCUSABLE );
+		}
+
+	}
+	
+
+	return pStateSetHelper;
+}
+
+lang::Locale SAL_CALL SvtRulerAccessible::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
+{
+	::osl::MutexGuard							aGuard( m_aMutex );
+	if( mxParent.is() )
+    {
+    	uno::Reference< XAccessibleContext >	xParentContext( mxParent->getAccessibleContext() );
+        if( xParentContext.is() )
+	    	return xParentContext->getLocale();
+    }
+
+    //	No parent.  Therefore throw exception to indicate this cluelessness.
+    throw IllegalAccessibleComponentStateException();
+}
+
+void SAL_CALL SvtRulerAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
+    throw( RuntimeException )
+{
+	if (xListener.is())
+    {
+		::osl::MutexGuard	aGuard( m_aMutex );
+		if (!mnClientId)
+            mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+		comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+    }
+}
+
+void SAL_CALL SvtRulerAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
+    throw( RuntimeException )
+{
+	if (xListener.is())
+	{
+    	::osl::MutexGuard	aGuard( m_aMutex );
+
+        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+		if ( !nListenerCount )
+		{
+			// no listeners anymore
+			// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+			// and at least to us not firing any events anymore, in case somebody calls
+			// NotifyAccessibleEvent, again
+			comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+			mnClientId = 0;
+		}
+	}
+}
+
+void SAL_CALL SvtRulerAccessible::addFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+	throw( RuntimeException )
+{
+	if( xListener.is() )
+    {
+		::osl::MutexGuard	aGuard( m_aMutex );
+
+		ThrowExceptionIfNotAlive();
+
+		uno::Reference< awt::XWindow >	xWindow = VCLUnoHelper::GetInterface( mpRepr );
+		if( xWindow.is() )
+			xWindow->addFocusListener( xListener );
+    }
+}
+
+void SAL_CALL SvtRulerAccessible::removeFocusListener( const uno::Reference< awt::XFocusListener >& xListener )
+	throw (RuntimeException)
+{
+	if( xListener.is() )
+    {
+		::osl::MutexGuard	aGuard( m_aMutex );
+
+		ThrowExceptionIfNotAlive();
+
+		uno::Reference< awt::XWindow >	xWindow = VCLUnoHelper::GetInterface( mpRepr );
+		if( xWindow.is() )
+			xWindow->removeFocusListener( xListener );
+    }
+}
+
+void SAL_CALL SvtRulerAccessible::grabFocus() throw( RuntimeException )
+{
+	::vos::OGuard		aSolarGuard( Application::GetSolarMutex() );
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+
+	mpRepr->GrabFocus();
+}
+
+Any SAL_CALL SvtRulerAccessible::getAccessibleKeyBinding() throw( RuntimeException )
+{
+	// here is no implementation, because here are no KeyBindings for every object
+	return Any();
+}
+
+sal_Int32 SvtRulerAccessible::getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    ::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
+    ::osl::MutexGuard   aGuard( m_aMutex );
+    ThrowExceptionIfNotAlive();
+    
+    return mpRepr->GetControlForeground().GetColor();
+}
+sal_Int32 SvtRulerAccessible::getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    ::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
+    ::osl::MutexGuard   aGuard( m_aMutex );
+    ThrowExceptionIfNotAlive();
+
+    return mpRepr->GetControlBackground().GetColor();
+}
+
+//=====  XServiceInfo  ========================================================
+
+OUString SAL_CALL SvtRulerAccessible::getImplementationName( void ) throw( RuntimeException )
+{
+	return OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.ui.SvtRulerAccessible" ) );
+}
+
+sal_Bool SAL_CALL SvtRulerAccessible::supportsService( const OUString& sServiceName ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+    //  Iterate over all supported service names and return true if on of them
+    //  matches the given name.
+    Sequence< OUString >	aSupportedServices( getSupportedServiceNames() );
+	int						nLength = aSupportedServices.getLength();
+	const OUString*			pStr = aSupportedServices.getConstArray();
+
+    for( int i = nLength ; i ; --i, ++pStr )
+	{
+        if( sServiceName == *pStr )
+            return sal_True;
+	}
+
+    return sal_False;
+}
+
+Sequence< OUString > SAL_CALL SvtRulerAccessible::getSupportedServiceNames( void ) throw( RuntimeException )
+{
+	const OUString sServiceName( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.accessibility.AccessibleContext" ) );
+	return Sequence< OUString >( &sServiceName, 1 );
+}
+
+//=====  XTypeProvider  =======================================================
+
+Sequence< sal_Int8 > SAL_CALL SvtRulerAccessible::getImplementationId( void ) throw( RuntimeException )
+{
+	return getUniqueId();
+}
+
+
+//=====  internals ========================================================
+
+void SvtRulerAccessible::setName( const OUString& rName )
+{
+		msName = rName;
+
+}
+
+void SvtRulerAccessible::setDescription( const OUString& rDescr )
+{
+
+		msDescription = rDescr;
+
+}
+
+
+
+void SAL_CALL SvtRulerAccessible::disposing()
+{
+	if( !rBHelper.bDisposed )
+	{
+		{
+			::osl::MutexGuard	aGuard( m_aMutex );
+			mpRepr = NULL;		// object dies with representation
+
+		}
+
+		{
+			::osl::MutexGuard	aGuard( m_aMutex );
+
+            // Send a disposing to all listeners.
+	        if ( mnClientId )
+	        {
+                comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+		        mnClientId =  0;
+	        }
+			mxParent = uno::Reference< XAccessible >();
+		}
+	}
+}
+
+Rectangle SvtRulerAccessible::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
+{
+	::vos::OGuard		aSolarGuard( Application::GetSolarMutex() );
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+//IAccessibility2 Implementation 2009-----
+	//the absolute on screen pixel is wrong
+	//return Rectangle( mpRepr->GetParent()->OutputToScreenPixel( mpRepr->GetPosPixel() ), mpRepr->GetSizePixel() );
+	return Rectangle( mpRepr->GetParent()->OutputToAbsoluteScreenPixel( mpRepr->GetPosPixel() ), mpRepr->GetSizePixel() );
+//-----IAccessibility2 Implementation 2009
+}
+
+Rectangle SvtRulerAccessible::GetBoundingBox( void ) throw( RuntimeException )
+{
+	::vos::OGuard		aSolarGuard( Application::GetSolarMutex() );
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	ThrowExceptionIfNotAlive();
+
+	return Rectangle( mpRepr->GetPosPixel(), mpRepr->GetSizePixel() );
+}
+
+Sequence< sal_Int8 > SvtRulerAccessible::getUniqueId( void )
+{
+	static OImplementationId*	pId = 0;
+	if( !pId )
+	{
+		MutexGuard						aGuard( Mutex::getGlobalMutex() );
+		if( !pId)
+		{
+			static OImplementationId	aId;
+			pId = &aId;
+		}
+	}
+	return pId->getImplementationId();
+}
+
+void SvtRulerAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
+{
+	if( IsNotAlive() )
+		throw lang::DisposedException();
+}
+
+void SvtRulerAccessible::addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener )throw( com::sun::star::uno::RuntimeException )
+{
+	cppu::WeakAggComponentImplHelperBase::addEventListener( xListener );
+}
+
+void SvtRulerAccessible::removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw( com::sun::star::uno::RuntimeException )
+{
+	cppu::WeakAggComponentImplHelperBase::removeEventListener( xListener );
+}
+
+
+// -------------------------------------------------------------------------------------------------
+
diff --git a/main/svtools/source/control/headbar.cxx b/main/svtools/source/control/headbar.cxx
index e75b0a5..e45518b 100644
--- a/main/svtools/source/control/headbar.cxx
+++ b/main/svtools/source/control/headbar.cxx
@@ -42,6 +42,10 @@
 #endif
 #include <com/sun/star/accessibility/XAccessible.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <vclxaccessibleheaderbar.hxx>
+//-----IAccessibility2 Implementation 2009
 // =======================================================================
 
 struct ImplHeadItem
@@ -95,6 +99,9 @@
 	mbOutDrag		= sal_False;
 	mbItemMode		= sal_False;
 
+	//IAccessibility2 Implementation 2009-----
+	m_pVCLXHeaderBar = NULL;
+	//-----IAccessibility2 Implementation 2009
 	// StyleBits auswerten
 	if ( nWinStyle & WB_DRAG )
 		mbDragable = sal_True;
@@ -116,6 +123,9 @@
 	}
 
 	ImplInitSettings( sal_True, sal_True, sal_True );
+	//IAccessibility2 Implementation 2009-----
+	//SetAccessibleRole(com::sun::star::accessibility::AccessibleRole::COLUMN_HEADER);	
+	//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
@@ -1645,3 +1655,20 @@
     mxAccessible = _xAccessible;
 }
 
+//IAccessibility2 Implementation 2009-----
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > HeaderBar::GetComponentInterface( sal_Bool bCreate )
+{
+    ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer 
+		(Window::GetComponentInterface(false));
+	if ( !xPeer.is() && bCreate )
+    {
+		::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXHeaderBar(this);
+		m_pVCLXHeaderBar = (VCLXHeaderBar*)(mxPeer);
+		SetComponentInterface(mxPeer);
+		return mxPeer;
+    }
+	else
+		return xPeer;
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/svtools/source/control/ruler.cxx b/main/svtools/source/control/ruler.cxx
index b1c226b..b691171 100644
--- a/main/svtools/source/control/ruler.cxx
+++ b/main/svtools/source/control/ruler.cxx
@@ -32,7 +32,15 @@
 
 #define _SV_RULER_CXX
 #include <svtools/ruler.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include <svtools/svtdata.hxx>
+#include <svtools/svtools.hrc>
+using namespace	::rtl;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+//-----IAccessibility2 Implementation 2009
 // =======================================================================
 
 #define RULER_OFF           3
@@ -299,7 +307,10 @@
     else
         aDefSize.Width() = nDefHeight;
     SetOutputSizePixel( aDefSize );
+	//IAccessibility2 Implementation 2009-----
 	SetType(WINDOW_RULER);
+	pAccContext = NULL; 
+	//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
@@ -323,6 +334,10 @@
         Application::RemoveUserEvent( mnUpdateEvtId );
     delete mpSaveData;
     delete mpDragData;
+	//IAccessibility2 Implementation 2009-----
+	if( pAccContext )
+		pAccContext->release();
+	//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
@@ -3179,3 +3194,31 @@
 sal_uInt16              Ruler::GetIndentCount() const { return mpData->nIndents; }
 const RulerIndent*  Ruler::GetIndents() const { return mpData->pIndents; }
 
+//IAccessibility2 Implementation 2009-----
+uno::Reference< XAccessible > Ruler::CreateAccessible()
+{
+	Window*						pParent = GetAccessibleParentWindow();
+	DBG_ASSERT( pParent, "-SvxRuler::CreateAccessible(): No Parent!" );
+	uno::Reference< XAccessible >	xAccParent  = pParent->GetAccessible();
+	if( xAccParent.is() )
+	{
+		// MT: Fixed compiler issue because the address from a temporary object was used.
+		// BUT: Shoudl it really be a Pointer, instead of const&???
+		OUString aStr;
+		if ( mnWinStyle & WB_HORZ )
+		{
+			aStr = OUString(XubString(SvtResId(STR_SVT_ACC_RULER_HORZ_NAME)));
+		}
+		else
+		{
+			aStr = OUString(XubString(SvtResId(STR_SVT_ACC_RULER_VERT_NAME)));
+		}
+		pAccContext = new SvtRulerAccessible( xAccParent, *this, aStr );
+		pAccContext->acquire();
+		this->SetAccessible(pAccContext);
+		return pAccContext;
+	}
+	else
+		return uno::Reference< XAccessible >();
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svtools/source/control/ruler.src b/main/svtools/source/control/ruler.src
new file mode 100644
index 0000000..deb964c
--- /dev/null
+++ b/main/svtools/source/control/ruler.src
@@ -0,0 +1,42 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "svtools/svtools.hrc"
+
+//IAccessibility2 Implementation 2009-----
+//add by duan mei hua, 2006/09/05, for issue 174
+String STR_SVT_ACC_RULER_HORZ_NAME
+{
+	Text[ en-US ] = "Horizontal Ruler";
+};
+String STR_SVT_ACC_RULER_VERT_NAME
+{
+	Text[ en-US ] = "Vertical Ruler";
+};
+//end add by duan mei hua, 2006/09/05, for issue 174
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svtools/source/control/valueacc.cxx b/main/svtools/source/control/valueacc.cxx
index 71d9c57..82cfd1f 100644
--- a/main/svtools/source/control/valueacc.cxx
+++ b/main/svtools/source/control/valueacc.cxx
@@ -34,6 +34,15 @@
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 
 // ----------------
@@ -316,6 +325,9 @@
         Window* pLabel = mpParent->GetAccessibleRelationLabeledBy();
         if ( pLabel && pLabel != mpParent )
             aRet = OutputDevice::GetNonMnemonicString( pLabel->GetText() );
+
+        if ( !aRet.Len() )
+         	aRet = mpParent->GetQuickHelpText();
     }
 
     return aRet;
@@ -327,7 +339,32 @@
     throw (uno::RuntimeException)
 {
     ThrowIfDisposed();
-    return uno::Reference< accessibility::XAccessibleRelationSet >();
+//IAccessibility2 Implementation 2009-----
+	uno::Reference< accessibility::XAccessibleRelationSet > xRelSet;
+	Window* pWindow = (Window*)mpParent;
+	if ( pWindow )
+	{
+		utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper;
+		xRelSet = pRelationSet;
+
+		Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+		if ( pLabeledBy && pLabeledBy != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pLabeledBy->GetAccessible();
+			pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+		}
+
+		Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+		if ( pMemberOf && pMemberOf != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pMemberOf->GetAccessible();
+			pRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+	}
+    return xRelSet;
+//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------------
@@ -755,7 +792,10 @@
             nIndex -= 1;
     }
     if (pItem == NULL)
-        pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex));
+//IAccessibility2 Implementation 2009-----
+        //pItem = mpParent->ImplGetVisibleItem (static_cast<sal_uInt16>(nIndex));
+	pItem = mpParent->ImplGetItem (static_cast<sal_uInt16>(nIndex));
+//-----IAccessibility2 Implementation 2009
 
     return pItem;
 }
@@ -939,7 +979,10 @@
             // just in case the number of children changes in the mean time.
             try
             {
-                pItem = mpParent->mrParent.ImplGetVisibleItem (i);
+//IAccessibility2 Implementation 2009-----
+                //pItem = mpParent->mrParent.ImplGetVisibleItem (i);
+                pItem = mpParent->mrParent.ImplGetItem(i);
+//-----IAccessibility2 Implementation 2009
             }
             catch (lang::IndexOutOfBoundsException aException)
             {
@@ -956,6 +999,17 @@
         }
     }
 
+//IAccessibility2 Implementation 2009-----
+	//if this valueset contain a none field(common value is default), then we should increase the real index and set the noitem index value equal 0.
+	if ( mpParent && ( (mpParent->mrParent.GetStyle() & WB_NONEFIELD) != 0 ) )
+	{
+		ValueSetItem* pFirstItem = mpParent->mrParent.ImplGetItem (VALUESET_ITEM_NONEITEM);
+		if( pFirstItem && pFirstItem ->GetAccessible(mbIsTransientChildrenDisabled).get() == this )
+			nIndexInParent = 0;
+		else
+			nIndexInParent++;
+	}
+//-----IAccessibility2 Implementation 2009
     return nIndexInParent;
 }
 
diff --git a/main/svtools/source/control/valueimp.hxx b/main/svtools/source/control/valueimp.hxx
index 6e06b5e..8b3657b 100644
--- a/main/svtools/source/control/valueimp.hxx
+++ b/main/svtools/source/control/valueimp.hxx
@@ -87,6 +87,9 @@
 	XubString			maText;
 	void*				mpData;
 	Rectangle			maRect;
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool				bSelected:1;
+	//-----IAccessibility2 Implementation 2009
 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >* mpxAcc;
 
     ValueSetItem( ValueSet& rParent );
diff --git a/main/svtools/source/control/valueset.cxx b/main/svtools/source/control/valueset.cxx
index 67dbdec..d25e36a 100644
--- a/main/svtools/source/control/valueset.cxx
+++ b/main/svtools/source/control/valueset.cxx
@@ -1219,7 +1219,9 @@
     {
         ValueSetItem* pItem = mpImpl->mpItemList->GetObject( n );
 
-        if( pItem->meType != VALUESETITEM_SPACE && !pItem->maRect.IsEmpty() )
+		//IAccessible2 implementation - also count empty rectangles as visible...
+        // if( pItem->meType != VALUESETITEM_SPACE && !pItem->maRect.IsEmpty() )
+		if( pItem->meType != VALUESETITEM_SPACE )
             nRet++;
     }
 
@@ -1905,6 +1907,24 @@
 		Invalidate();
 }
 
+//IAccessibility2 Implementation 2009-----
+//method to set accessible when the style is user draw.
+void ValueSet::InsertItem( sal_uInt16 nItemId, const XubString& rText, sal_uInt16 nPos	)
+{
+	DBG_ASSERT( nItemId, "ValueSet::InsertItem(): ItemId == 0" );
+	DBG_ASSERT( GetItemPos( nItemId ) == VALUESET_ITEM_NOTFOUND,
+				"ValueSet::InsertItem(): ItemId already exists" );
+	ValueSetItem* pItem = new ValueSetItem( *this );
+	pItem->mnId 	= nItemId;
+	pItem->meType	= VALUESETITEM_USERDRAW;
+	pItem->maText	= rText;
+	mpImpl->mpItemList->Insert( pItem, (sal_uLong)nPos );
+	mbFormat = sal_True;
+	if ( IsReallyVisible() && IsUpdateMode() )
+		Invalidate();
+}
+//-----IAccessibility2 Implementation 2009
+
 // -----------------------------------------------------------------------
 
 void ValueSet::InsertItem( sal_uInt16 nItemId, sal_uInt16 nPos )
@@ -2779,6 +2799,60 @@
         }
     }
 }
+//IAccessibility2 Implementation 2009-----
+//For sending out the focused event on the first focused item when this valueset is first focused.
+// MT: Focus notifications changed in DEV300 meanwhile, so this is not used for now.
+// Just keeping it here for reference, in case something in out implementation doesn't work as expected...
+/*
+void ValueSet::SetFocusedItem(sal_Bool bFocused)
+{
+	if( ImplHasAccessibleListeners() )
+	{
+        // selection event
+        ::com::sun::star::uno::Any aSelOldAny, aSelNewAny;
+		if ( mnSelItemId >= 0)
+		{
+			// focus event (select)
+		    sal_uInt16 nPos = GetItemPos( mnSelItemId );
+
+			ValueSetItem* pItem;
+			if ((GetStyle() & WB_NONEFIELD) != 0
+				&& nPos == VALUESET_ITEM_NOTFOUND 
+				&& mnSelItemId == 0)
+			{
+				// When present the first item is the then allways visible none field.
+				pItem = ImplGetItem (VALUESET_ITEM_NONEITEM);
+			}
+			else
+			{
+				if (nPos == VALUESET_ITEM_NOTFOUND)
+					nPos = 0;
+				pItem = mpImpl->mpItemList->GetObject(nPos);
+			}
+			ValueItemAcc* pItemAcc = NULL;
+			if (pItem != NULL)
+				pItemAcc = ValueItemAcc::getImplementation(pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled) );
+			if( pItemAcc )
+			{
+				if (bFocused)
+					aSelNewAny <<= pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled);
+				else
+					aSelOldAny <<= pItem->GetAccessible(mpImpl->mbIsTransientChildrenDisabled);
+			}
+			ImplFireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, aSelOldAny, aSelNewAny );
+			if (pItemAcc && bFocused)
+			{
+				pItemAcc->FireAccessibleEvent(
+					::com::sun::star::accessibility::AccessibleEventId::SELECTION_CHANGED,
+					::com::sun::star::uno::Any(),::com::sun::star::uno::Any());
+			}
+		}
+	}
+}
+*/
+//end
+//-----IAccessibility2 Implementation 2009
+
 
 // -----------------------------------------------------------------------
 // eof
diff --git a/main/svtools/source/control/vclxaccessibleheaderbar.cxx b/main/svtools/source/control/vclxaccessibleheaderbar.cxx
new file mode 100644
index 0000000..2c9b09b
--- /dev/null
+++ b/main/svtools/source/control/vclxaccessibleheaderbar.cxx
@@ -0,0 +1,200 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//IAccessibility2 Implementation 2009-----
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_
+#include <svtools/vclxaccessibleheaderbar.hxx>
+#endif
+#ifndef _SVTOOLS_VCLACCESSIBLEHEADBARITEM_HXX_
+#include <svtools/vclxaccessibleheaderbaritem.hxx>
+#endif
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+#include <toolkit/awt/vclxwindows.hxx>
+#endif
+#ifndef _HEADBAR_HXX
+#include <headbar.hxx>
+#endif
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
+#include <unotools/accessiblestatesethelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#endif
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+#ifndef _COMPHELPER_SEQUENCE_HXX_
+#include <comphelper/sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::awt;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+VCLXHeaderBar::VCLXHeaderBar(Window* pHeaderBar)
+{
+	SetWindow(pHeaderBar);
+}
+
+VCLXHeaderBar::~VCLXHeaderBar()
+{
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXHeaderBar::CreateAccessibleContext()
+{
+	return new VCLXAccessibleHeaderBar(this);
+}
+
+
+VCLXAccessibleHeaderBar::VCLXAccessibleHeaderBar( VCLXWindow* pVCLWindow )
+	:VCLXAccessibleComponent( pVCLWindow )
+	,m_pHeadBar(NULL)
+{
+	m_pHeadBar = static_cast< HeaderBar* >( GetWindow() );
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleHeaderBar::~VCLXAccessibleHeaderBar()
+{
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleHeaderBar::ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent )
+{
+	VCLXAccessibleComponent::ProcessWindowEvent( rVclWindowEvent );
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleHeaderBar::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+	VCLXAccessibleComponent::FillAccessibleStateSet( rStateSet );
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBar::getImplementationName() throw (RuntimeException)
+{
+	return ::rtl::OUString::createFromAscii( "com.sun.star.comp.toolkit.AccessibleHeaderBar" );	
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleHeaderBar::getSupportedServiceNames() throw (RuntimeException)
+{
+	Sequence< ::rtl::OUString > aNames(1);
+	aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleHeaderBar" );
+	return aNames;
+}
+
+// =======XAccessibleContext=======
+
+sal_Int32 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleChildCount(  ) 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 nCount = 0;
+	if ( m_pHeadBar )
+		nCount = m_pHeadBar->GetItemCount();
+	
+    return nCount;
+}
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL 
+		VCLXAccessibleHeaderBar::getAccessibleChild( sal_Int32 i ) 	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	if ( i < 0 || i >= getAccessibleChildCount() )
+		throw IndexOutOfBoundsException();
+
+    Reference< XAccessible > xChild;
+    // search for the child
+	if ( static_cast<sal_uInt16>(i) >= m_aAccessibleChildren.size() )
+		xChild = CreateChild (i);
+	else
+	{
+		xChild = m_aAccessibleChildren[i];
+		if ( !xChild.is() )
+			xChild = CreateChild (i);
+	}
+    return xChild;
+}
+
+sal_Int16 SAL_CALL VCLXAccessibleHeaderBar::getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException)
+{
+	return com::sun::star::accessibility::AccessibleRole::LIST;
+}
+
+void SAL_CALL VCLXAccessibleHeaderBar::disposing (void)
+{
+	ListItems().swap(m_aAccessibleChildren);
+	VCLXAccessibleComponent::disposing();	
+}
+
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > VCLXAccessibleHeaderBar::CreateChild (sal_Int32 i)
+{
+	Reference<XAccessible> xChild;
+
+	sal_uInt16 nPos = static_cast<sal_uInt16>(i);
+	if ( nPos >= m_aAccessibleChildren.size() )
+	{
+		m_aAccessibleChildren.resize(nPos + 1);
+
+		// insert into the container
+		xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
+		m_aAccessibleChildren[nPos] = xChild;
+	}
+	else
+	{
+		xChild = m_aAccessibleChildren[nPos];
+		// check if position is empty and can be used else we have to adjust all entries behind this
+		if ( !xChild.is() )		
+		{
+			xChild = new VCLXAccessibleHeaderBarItem(m_pHeadBar, i);
+			m_aAccessibleChildren[nPos] = xChild;
+		}
+	}
+    return xChild;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svtools/source/control/vclxaccessibleheaderbaritem.cxx b/main/svtools/source/control/vclxaccessibleheaderbaritem.cxx
new file mode 100644
index 0000000..8aa9b8d
--- /dev/null
+++ b/main/svtools/source/control/vclxaccessibleheaderbaritem.cxx
@@ -0,0 +1,410 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+//IAccessibility2 Implementation 2009-----
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svtools.hxx"
+
+#ifndef _SVTOOLS_VCLXACCESSIBLEHEADERBAR_HXX_
+#include <svtools/vclxaccessibleheaderbaritem.hxx>
+#endif
+
+#ifndef _HEADBAR_HXX
+#include <svtools/headbar.hxx>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
+#include <unotools/accessiblestatesethelper.hxx>
+#endif
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _TOOLKIT_AWT_VCLXFONT_HXX_
+#include <toolkit/awt/vclxfont.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_EXTERNALLOCK_HXX_
+#include <toolkit/helper/externallock.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#include <toolkit/helper/convert.hxx>
+#endif
+
+#include <vector>
+
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::accessibility;
+using namespace ::comphelper;
+
+DBG_NAME( VCLXAccessibleHeaderBarItem )
+
+//	----------------------------------------------------
+//	class AccessibleTabBar
+//	----------------------------------------------------
+
+VCLXAccessibleHeaderBarItem::VCLXAccessibleHeaderBarItem( HeaderBar*	pHeadBar, sal_Int32 _nIndexInParent )
+	:AccessibleExtendedComponentHelper_BASE( new VCLExternalSolarLock() )
+	,m_pHeadBar( pHeadBar )
+	,m_nIndexInParent(_nIndexInParent + 1)
+
+{
+	DBG_CTOR( VCLXAccessibleHeaderBarItem, NULL );
+	m_pExternalLock = static_cast< VCLExternalSolarLock* >( getExternalLock() );
+}
+
+// -----------------------------------------------------------------------------
+
+VCLXAccessibleHeaderBarItem::~VCLXAccessibleHeaderBarItem()
+{
+	delete m_pExternalLock;
+	m_pExternalLock = NULL;
+}
+
+// -----------------------------------------------------------------------------
+
+IMPL_LINK( VCLXAccessibleHeaderBarItem, WindowEventListener, VclSimpleEvent*, pEvent )
+{
+	DBG_CHKTHIS( VCLXAccessibleHeaderBarItem, 0 );
+	DBG_ASSERT( pEvent && pEvent->ISA( VclWindowEvent ), "VCLXAccessibleHeaderBarItem::WindowEventListener: unknown window event!" );
+
+	if ( pEvent && pEvent->ISA( VclWindowEvent ) )
+	{
+		DBG_ASSERT( ((VclWindowEvent*)pEvent)->GetWindow(), "VCLXAccessibleHeaderBarItem::WindowEventListener: no window!" );
+		if ( !((VclWindowEvent*)pEvent)->GetWindow()->IsAccessibilityEventsSuppressed() || ( pEvent->GetId() == VCLEVENT_OBJECT_DYING ) )
+		{
+			ProcessWindowEvent( *(VclWindowEvent*)pEvent );
+		}
+	}
+
+	return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleHeaderBarItem::ProcessWindowEvent( const VclWindowEvent& )
+{
+	Any aOldValue, aNewValue;
+}
+
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleHeaderBarItem::FillAccessibleStateSet( utl::AccessibleStateSetHelper& rStateSet )
+{
+	if ( m_pHeadBar )
+	{
+		if ( m_pHeadBar->IsEnabled() )
+			rStateSet.AddState( AccessibleStateType::ENABLED );
+
+		if ( m_pHeadBar->IsVisible() )
+		{
+			rStateSet.AddState( AccessibleStateType::VISIBLE );
+		}
+		rStateSet.AddState( AccessibleStateType::SELECTABLE );
+		rStateSet.AddState( AccessibleStateType::RESIZABLE );
+	}
+}
+
+// -----------------------------------------------------------------------------
+// OCommonAccessibleComponent 
+// -----------------------------------------------------------------------------
+
+awt::Rectangle VCLXAccessibleHeaderBarItem::implGetBounds() throw (RuntimeException)
+{
+	awt::Rectangle aBounds;
+	OExternalLockGuard aGuard( this );
+	 
+	::com::sun::star::awt::Size aSize;
+
+	if ( m_pHeadBar )
+		aBounds = AWTRectangle( m_pHeadBar->GetItemRect( sal_uInt16( m_nIndexInParent ) ) );
+
+	return aBounds;
+}
+
+// -----------------------------------------------------------------------------
+// XInterface
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XINTERFACE2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XTypeProvider
+// -----------------------------------------------------------------------------
+
+IMPLEMENT_FORWARD_XTYPEPROVIDER2( VCLXAccessibleHeaderBarItem, AccessibleExtendedComponentHelper_BASE, VCLXAccessibleHeaderBarItem_BASE )
+
+// -----------------------------------------------------------------------------
+// XComponent
+// -----------------------------------------------------------------------------
+
+void VCLXAccessibleHeaderBarItem::disposing()
+{
+	AccessibleExtendedComponentHelper_BASE::disposing();
+}
+
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBarItem::getImplementationName() throw (RuntimeException)
+{
+	return ::rtl::OUString::createFromAscii( "com.sun.star.comp.svtools.AccessibleHeaderBarItem" );
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool VCLXAccessibleHeaderBarItem::supportsService( const ::rtl::OUString& rServiceName ) throw (RuntimeException)
+{
+	Sequence< ::rtl::OUString > aNames( getSupportedServiceNames() );
+	const ::rtl::OUString* pNames = aNames.getConstArray();
+	const ::rtl::OUString* pEnd = pNames + aNames.getLength();
+	for ( ; pNames != pEnd && !pNames->equals( rServiceName ); ++pNames )
+		;
+
+	return pNames != pEnd;
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleHeaderBarItem::getSupportedServiceNames() throw (RuntimeException)
+{
+	Sequence< ::rtl::OUString > aNames(1);
+	aNames[0] = ::rtl::OUString::createFromAscii( "com.sun.star.awt.AccessibleHeaderBarItem" );
+	return aNames;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessible
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleContext > VCLXAccessibleHeaderBarItem::getAccessibleContext() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	return this;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleContext
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleChildCount() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	return 0;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleChild( sal_Int32 i ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	if ( i < 0 || i >= getAccessibleChildCount() )
+		throw IndexOutOfBoundsException();
+	 
+	return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleParent() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	Reference< XAccessible > xParent;
+	if ( m_pHeadBar )
+	{
+		xParent = m_pHeadBar->GetAccessible();
+	}
+
+	return xParent;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleHeaderBarItem::getAccessibleIndexInParent() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+	return m_nIndexInParent - 1;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int16 VCLXAccessibleHeaderBarItem::getAccessibleRole() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	return AccessibleRole::COLUMN_HEADER;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBarItem::getAccessibleDescription() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+	::rtl::OUString sDescription;
+	return sDescription;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBarItem::getAccessibleName() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	::rtl::OUString sName;
+	if(m_pHeadBar)
+		sName = m_pHeadBar->GetItemText( sal_uInt16( m_nIndexInParent ) );
+	return sName;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleRelationSet > VCLXAccessibleHeaderBarItem::getAccessibleRelationSet(  ) throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+	return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleStateSet > VCLXAccessibleHeaderBarItem::getAccessibleStateSet(  ) throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+	Reference< XAccessibleStateSet > xSet = pStateSetHelper;
+
+	if ( !rBHelper.bDisposed && !rBHelper.bInDispose )
+	{
+		FillAccessibleStateSet( *pStateSetHelper );
+	}
+	else
+	{
+		pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+	}
+
+	return xSet;
+}
+
+// -----------------------------------------------------------------------------
+
+com::sun::star::lang::Locale VCLXAccessibleHeaderBarItem::getLocale() throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	return Application::GetSettings().GetLocale();
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleComponent
+// -----------------------------------------------------------------------------
+
+Reference< XAccessible > VCLXAccessibleHeaderBarItem::getAccessibleAtPoint( const awt::Point& ) throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	return Reference< XAccessible >();
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleHeaderBarItem::getForeground() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	sal_Int32 nColor = 0;
+	return nColor;
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Int32 VCLXAccessibleHeaderBarItem::getBackground() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	sal_Int32 nColor = 0;
+	return nColor;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleExtendedComponent
+// -----------------------------------------------------------------------------
+
+Reference< awt::XFont > VCLXAccessibleHeaderBarItem::getFont() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	Reference< awt::XFont > xFont;
+	return xFont;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBarItem::getTitledBorderText() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	::rtl::OUString sText;
+	return sText;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleHeaderBarItem::getToolTipText() throw (RuntimeException)
+{
+	OExternalLockGuard aGuard( this );
+
+	::rtl::OUString sText;
+	if ( m_pHeadBar )
+		sText = m_pHeadBar->GetQuickHelpText();
+
+	return sText;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svtools/source/edit/svmedit.cxx b/main/svtools/source/edit/svmedit.cxx
index e1ea1bf..bfc70a3 100644
--- a/main/svtools/source/edit/svmedit.cxx
+++ b/main/svtools/source/edit/svmedit.cxx
@@ -941,7 +941,9 @@
 
 void TextWindow::GetFocus()
 {
-	Window::GetFocus();
+//IAccessibility2 Implementation 2009-----
+	//Window::GetFocus();
+//-----IAccessibility2 Implementation 2009
 	if ( !mbActivePopup )
 	{
 		sal_Bool bGotoCursor = !mpExtTextView->IsReadOnly();
@@ -1248,8 +1250,10 @@
 {
     if ( !pImpSvMEdit )  // might be called from within the dtor, when pImpSvMEdit == NULL is a valid state
         return;
-
-    Edit::GetFocus();
+	//IAccessibility2 Implementation 2009-----
+	//Disable the focused event on scroll pane
+	//Edit::GetFocus();
+	//-----IAccessibility2 Implementation 2009
     pImpSvMEdit->GetFocus();
 }
 
diff --git a/main/svtools/source/misc/acceleratorexecute.cxx b/main/svtools/source/misc/acceleratorexecute.cxx
index fa8edd8..265f986 100644
--- a/main/svtools/source/misc/acceleratorexecute.cxx
+++ b/main/svtools/source/misc/acceleratorexecute.cxx
@@ -72,6 +72,9 @@
 #include <vcl/window.hxx>
 #include <vcl/svapp.hxx>
 #include <vos/mutex.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <comphelper/uieventslogger.hxx>
+//-----IAccessibility2 Implementation 2009
 
 //===============================================
 // namespace
@@ -249,6 +252,24 @@
     sal_Bool bRet = xDispatch.is();
     if ( bRet )
     {
+//IAccessibility2 Implementation 2009-----
+        if(::comphelper::UiEventsLogger::isEnabled() && m_xSMGR.is() && m_xDispatcher.is()) //#i88653#
+        {
+            try
+            {
+                css::uno::Reference< css::frame::XModuleManager > xModuleDetection(
+                    m_xSMGR->createInstance(::rtl::OUString::createFromAscii("com.sun.star.frame.ModuleManager")),
+                    css::uno::UNO_QUERY_THROW);
+
+                const ::rtl::OUString sModule = xModuleDetection->identify(m_xDispatcher);
+                css::uno::Sequence<css::beans::PropertyValue> source;
+                ::comphelper::UiEventsLogger::appendDispatchOrigin(source, sModule, ::rtl::OUString::createFromAscii("AcceleratorExecute"));
+                ::comphelper::UiEventsLogger::logDispatch(aURL, source);
+            }
+            catch(const css::uno::Exception&)
+                { }
+        }
+//-----IAccessibility2 Implementation 2009
         // Note: Such instance can be used one times only and destroy itself afterwards .-)
         AsyncAccelExec* pExec = AsyncAccelExec::createOnShotInstance(xDispatch, aURL);
         pExec->execAsync();
diff --git a/main/svtools/source/misc/embedhlp.cxx b/main/svtools/source/misc/embedhlp.cxx
index 2674d2f..2bdf151 100644
--- a/main/svtools/source/misc/embedhlp.cxx
+++ b/main/svtools/source/misc/embedhlp.cxx
@@ -34,7 +34,14 @@
 #include <toolkit/helper/vclunohelper.hxx>
 #include <unotools/ucbstreamhelper.hxx>
 #include <unotools/streamwrap.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XCoordinateSystem.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/XChartType.hpp>
+//-----IAccessibility2 Implementation 2009
 #include <tools/globname.hxx>
 #include <sot/clsids.hxx>
 #include <com/sun/star/util/XModifyListener.hpp>
@@ -937,6 +944,102 @@
     return sal_False;
 }
 
+//IAccessibility2 Implementation 2009-----
+// MT: Only used for getting accessible attributes, which are not localized
+rtl::OUString EmbeddedObjectRef::GetChartType()
+{
+	rtl::OUString Style;
+	if ( mxObj.is() )
+	{
+		if ( IsChart() )
+		{
+			if ( svt::EmbeddedObjectRef::TryRunningState( mxObj ) )
+			{
+				uno::Reference< chart2::XChartDocument > xChart( mxObj->getComponent(), uno::UNO_QUERY );
+				if (xChart.is())
+				{
+					uno::Reference< chart2::XDiagram > xDiagram( xChart->getFirstDiagram());
+					if( ! xDiagram.is())
+						return String();
+					uno::Reference< chart2::XCoordinateSystemContainer > xCooSysCnt( xDiagram, uno::UNO_QUERY_THROW );
+					uno::Sequence< uno::Reference< chart2::XCoordinateSystem > > aCooSysSeq( xCooSysCnt->getCoordinateSystems());
+					// IA2 CWS. Unused: int nCoordinateCount = aCooSysSeq.getLength();
+					sal_Bool bGetChartType = sal_False;
+					for( sal_Int32 nCooSysIdx=0; nCooSysIdx<aCooSysSeq.getLength(); ++nCooSysIdx )
+					{
+						uno::Reference< chart2::XChartTypeContainer > xCTCnt( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY_THROW );
+						uno::Sequence< uno::Reference< chart2::XChartType > > aChartTypes( xCTCnt->getChartTypes());
+						int nDimesionCount = aCooSysSeq[nCooSysIdx]->getDimension();
+						if( nDimesionCount == 3 )	
+							Style += rtl::OUString::createFromAscii("3D ");	
+						else
+							Style += rtl::OUString::createFromAscii("2D ");	
+						for( sal_Int32 nCTIdx=0; nCTIdx<aChartTypes.getLength(); ++nCTIdx )
+						{
+							rtl::OUString strChartType = aChartTypes[nCTIdx]->getChartType();
+							if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.AreaChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Areas");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.BarChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Bars");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.ColumnChartType")))
+							{
+								uno::Reference< beans::XPropertySet > xProp( aCooSysSeq[nCooSysIdx], uno::UNO_QUERY );
+								if( xProp.is())
+								{
+									bool bCurrent = false;
+									if( xProp->getPropertyValue( rtl::OUString::createFromAscii("SwapXAndYAxis") ) >>= bCurrent )
+									{
+										if (bCurrent)
+											Style += rtl::OUString::createFromAscii("Bars");
+										else
+											Style += rtl::OUString::createFromAscii("Columns");
+										bGetChartType = sal_True;
+									}
+								}
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.LineChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Lines");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("XY Chart");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Pies");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Radar");
+								bGetChartType = sal_True;
+							}
+							else if (strChartType.equals(::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType")))
+							{
+								Style += rtl::OUString::createFromAscii("Candle Stick Chart");
+								bGetChartType = sal_True;
+							}
+							if (bGetChartType)
+								return Style;
+						}
+					}
+				}
+			}
+		}
+	}
+	return Style;	
+}
+//-----IAccessibility2 Implementation 2009
+
 // #i104867#
 sal_uInt32 EmbeddedObjectRef::getGraphicVersion() const
 {
diff --git a/main/svx/Library_svx.mk b/main/svx/Library_svx.mk
index 7a97ec7..3d6fc63 100644
--- a/main/svx/Library_svx.mk
+++ b/main/svx/Library_svx.mk
@@ -78,6 +78,7 @@
     svx/source/accessibility/AccessibleShape \
     svx/source/accessibility/AccessibleShapeInfo \
     svx/source/accessibility/AccessibleShapeTreeInfo \
+    svx/source/accessibility/AccessibleSvxFindReplaceDialog \
     svx/source/accessibility/AccessibleTextEventQueue \
     svx/source/accessibility/AccessibleTextHelper \
     svx/source/accessibility/charmapacc \
@@ -87,6 +88,7 @@
     svx/source/accessibility/DGColorNameLookUp \
     svx/source/accessibility/GraphCtlAccessibleContext \
     svx/source/accessibility/ShapeTypeHandler \
+    svx/source/accessibility/svxpixelctlaccessiblecontext \
     svx/source/accessibility/svxrectctaccessiblecontext \
     svx/source/accessibility/SvxShapeTypes \
     svx/source/customshapes/EnhancedCustomShape3d \
diff --git a/main/svx/inc/svx/AccessibleControlShape.hxx b/main/svx/inc/svx/AccessibleControlShape.hxx
index 145870d..171da24 100644
--- a/main/svx/inc/svx/AccessibleControlShape.hxx
+++ b/main/svx/inc/svx/AccessibleControlShape.hxx
@@ -63,6 +63,10 @@
         const AccessibleShapeTreeInfo& rShapeTreeInfo);
 	virtual ~AccessibleControlShape( );
 
+	//IAccessibility2 Implementation 2009-----
+    ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > SAL_CALL  GetControlModel( ) { return m_xControlModel;} ;
+    AccessibleControlShape* SAL_CALL GetLabeledByControlShape();
+	//-----IAccessibility2 Implementation 2009
 protected:
 	//---  XAccessible  ----------------------------------------
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
diff --git a/main/svx/inc/svx/AccessibleGraphicShape.hxx b/main/svx/inc/svx/AccessibleGraphicShape.hxx
index 472e254..8d22616 100644
--- a/main/svx/inc/svx/AccessibleGraphicShape.hxx
+++ b/main/svx/inc/svx/AccessibleGraphicShape.hxx
@@ -89,7 +89,9 @@
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
         getTypes (void)
         throw (::com::sun::star::uno::RuntimeException);
-
+///	Return this object's role.
+	virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 protected:
     ///	Create a name string that contains the accessible name.
 	virtual ::rtl::OUString
diff --git a/main/svx/inc/svx/AccessibleOLEShape.hxx b/main/svx/inc/svx/AccessibleOLEShape.hxx
index 18f880d..9400b3f 100644
--- a/main/svx/inc/svx/AccessibleOLEShape.hxx
+++ b/main/svx/inc/svx/AccessibleOLEShape.hxx
@@ -99,7 +99,10 @@
     virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type> SAL_CALL
         getTypes (void)
         throw (::com::sun::star::uno::RuntimeException);
-
+//IAccessibility2 Implementation 2009-----
+// ====== XAccessibleExtendedAttributes =====================================
+    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+//-----IAccessibility2 Implementation 2009
 protected:
     ///	Create a name string that contains the accessible name.
 	virtual ::rtl::OUString
diff --git a/main/svx/inc/svx/AccessibleShape.hxx b/main/svx/inc/svx/AccessibleShape.hxx
index 5a37a90..b953408 100644
--- a/main/svx/inc/svx/AccessibleShape.hxx
+++ b/main/svx/inc/svx/AccessibleShape.hxx
@@ -37,6 +37,30 @@
 #include <com/sun/star/lang/XUnoTunnel.hpp>
 #include <svx/AccessibleTextHelper.hxx>
 #include "svx/svxdllapi.h"
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESELECTION_HPP_ 
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGROUPPOSITION_HPP_
+#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#endif
+#ifndef INCLUDED_COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERLINK_HPP
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
+
 #include "ChildrenManager.hxx"
 
 class SdrObject;
@@ -74,6 +98,12 @@
 class SVX_DLLPUBLIC AccessibleShape
     :	public AccessibleContextBase,
         public AccessibleComponentBase,
+		//IAccessibility2 Implementation 2009-----
+        public ::com::sun::star::accessibility::XAccessibleSelection, 
+        public ::com::sun::star::accessibility::XAccessibleExtendedAttributes,
+        public ::com::sun::star::accessibility::XAccessibleGroupPosition,
+        public com::sun::star::accessibility::XAccessibleHypertext,
+		//-----IAccessibility2 Implementation 2009
         public IAccessibleViewForwarderListener,
         public ::com::sun::star::document::XEventListener,
         public ::com::sun::star::lang::XUnoTunnel
@@ -99,7 +129,56 @@
 	AccessibleShape (
         const AccessibleShapeInfo& rShapeInfo,
         const AccessibleShapeTreeInfo& rShapeTreeInfo);
+	//IAccessibility2 Implementation 2009-----
+	AccessibleShape (
+        const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& rxShape, const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible>& rxParent, const AccessibleShapeTreeInfo& rShapeTreeInfo, sal_Int32 nIndex = -1);
+	 //Solution: Overwrite the object's current name.
+    virtual ::rtl::OUString SAL_CALL  	getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL  	getAccessibleDescription() throw (::com::sun::star::uno::RuntimeException);	
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL getAccessibleRelationSet (void) throw (::com::sun::star::uno::RuntimeException);
+//=====  XAccessibleSelection  ============================================
+	
+	virtual void SAL_CALL selectAccessibleChild( 
+		sal_Int32 nChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
+	
+	virtual sal_Bool SAL_CALL isAccessibleChildSelected( 
+		sal_Int32 nChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
+	
+	virtual void SAL_CALL clearAccessibleSelection(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual void SAL_CALL selectAllAccessibleChildren(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual ::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);
+	
+	virtual void SAL_CALL deselectAccessibleChild( 
+		sal_Int32 nSelectedChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
 
+	// ====== XAccessibleExtendedAttributes =====================================
+	virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	///	Return this object's role.
+	virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+    //=====  XAccessibleGroupPosition  =========================================
+    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+        getGroupPosition( const ::com::sun::star::uno::Any& rAny )
+        throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getObjectLink( const ::com::sun::star::uno::Any& accoject )
+        throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
     /** The destructor releases its children manager and text engine if
         still existent.  These are responsible to send appropriate events.
     */
@@ -312,6 +391,32 @@
 	static AccessibleShape*										getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxIFace ) throw();
 	sal_Int64													SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& _rIdentifier ) throw(::com::sun::star::uno::RuntimeException);
 
+	//===== XAccessibleHypertext ========================================================
+    virtual sal_Int32 SAL_CALL getHyperLinkCount() 	throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > 
+		SAL_CALL getHyperLink( sal_Int32 nLinkIndex ) 	
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	//=====  XAccesibleText  ==================================================
+		virtual sal_Int32 SAL_CALL getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+		virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);//Shen Zhen Jie changed sal_Unicode to sal_uInt32; change back to sal_Unicode
+		virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+		virtual sal_Int32 SAL_CALL getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+		virtual ::rtl::OUString SAL_CALL getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Int32 SAL_CALL getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Int32 SAL_CALL getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+		virtual ::rtl::OUString SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);
+		virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+		virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+		virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
     //===== Misc ========================================================
 
     ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
@@ -378,7 +483,14 @@
 	virtual ::rtl::OUString
     	CreateAccessibleDescription (void)
         throw (::com::sun::star::uno::RuntimeException);
-
+	//IAccessibility2 Implementation 2009-----
+	virtual ::rtl::OUString
+       GetFullAccessibleName(AccessibleShape *shape) 
+       throw (::com::sun::star::uno::RuntimeException);
+    virtual::rtl::OUString GetStyle();
+	void UpdateDocumentAllSelState(::com::sun::star::uno::Reference< 
+		::com::sun::star::accessibility::XAccessibleStateSet > &xStateSet);
+	//-----IAccessibility2 Implementation 2009
     /** Update the <const>OPAQUE</const> and <const>SELECTED</const> state.
     */
     virtual void UpdateStates (void);
@@ -392,6 +504,10 @@
     SVX_DLLPRIVATE explicit AccessibleShape (const AccessibleShape&);
     /// Don't use the assignment operator.  Do we need this?
     SVX_DLLPRIVATE AccessibleShape& operator= (const AccessibleShape&);
+	//IAccessibility2 Implementation 2009-----
+    //Solution:Old accessible name
+    ::rtl::OUString aAccName;
+	//-----IAccessibility2 Implementation 2009
 
     /** Call this method when the title, name, or description of the mxShape
         member (may) have been changed.
diff --git a/main/svx/inc/svx/AccessibleSvxFindReplaceDialog.hxx b/main/svx/inc/svx/AccessibleSvxFindReplaceDialog.hxx
new file mode 100644
index 0000000..2e89614
--- /dev/null
+++ b/main/svx/inc/svx/AccessibleSvxFindReplaceDialog.hxx
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+#ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
+#define _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#include <toolkit/awt/vclxwindow.hxx>
+#endif
+#ifndef _TOOLKIT_AWT_VCLXACCESSIBLECOMPONENT_HXX_
+#include <toolkit/awt/vclxaccessiblecomponent.hxx>
+#endif
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOWS_HXX_
+#include <toolkit/awt/vclxwindows.hxx>
+#endif
+
+
+class VCLXAccessibleSvxFindReplaceDialog : public VCLXAccessibleComponent
+{
+public:
+	VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow);
+	virtual ~VCLXAccessibleSvxFindReplaceDialog();
+	virtual void FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet );
+	// XServiceInfo
+	virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
+
+};
+
+
+class VCLXSvxFindReplaceDialog : public VCLXDialog
+{
+public:
+	VCLXSvxFindReplaceDialog(Window* pSplDlg)
+	{
+		SetWindow(pSplDlg);
+	}
+	virtual ~VCLXSvxFindReplaceDialog()
+	{};
+private:	
+    virtual ::com::sun::star::uno::Reference<
+        ::com::sun::star::accessibility::XAccessibleContext >  CreateAccessibleContext()
+	{
+		return new VCLXAccessibleSvxFindReplaceDialog(this);		 
+	}
+};
+#endif // _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
diff --git a/main/svx/inc/svx/AccessibleTableShape.hxx b/main/svx/inc/svx/AccessibleTableShape.hxx
index 817445c..5ffb069 100644
--- a/main/svx/inc/svx/AccessibleTableShape.hxx
+++ b/main/svx/inc/svx/AccessibleTableShape.hxx
@@ -34,6 +34,11 @@
 #include <cppuhelper/implbase2.hxx>
 
 #include <svx/AccessibleShape.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/view/XSelectionChangeListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#include <cppuhelper/compbase5.hxx>
+//-----IAccessibility2 Implementation 2009
 
 #include <boost/noncopyable.hpp>
 
@@ -44,14 +49,22 @@
 namespace accessibility
 {
 	class AccessibleTableShapeImpl;
+	//IAccessibility2 Implementation 2009
+	class AccessibleCell;
 
-	typedef ::cppu::ImplInheritanceHelper2<	AccessibleShape,
+	//IAccessibility2 Implementation 2009-----
+	/*typedef ::cppu::ImplInheritanceHelper2<	AccessibleShape,
 											::com::sun::star::accessibility::XAccessibleSelection,
 											::com::sun::star::accessibility::XAccessibleTable
+										  >	AccessibleTableShape_Base;*/
+	typedef ::cppu::ImplInheritanceHelper2<	AccessibleShape,											
+											::com::sun::star::accessibility::XAccessibleTable,
+											::com::sun::star::view::XSelectionChangeListener
 										  >	AccessibleTableShape_Base;
+	//-----IAccessibility2 Implementation 2009
 /**	@descr
 */
-class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base
+class AccessibleTableShape : boost::noncopyable, public AccessibleTableShape_Base, public ::com::sun::star::accessibility::XAccessibleTableSelection
 {
 public:
 	AccessibleTableShape( const AccessibleShapeInfo& rShapeInfo, const AccessibleShapeTreeInfo& rShapeTreeInfo );
@@ -102,6 +115,17 @@
     virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) throw ( ::com::sun::star::uno::RuntimeException );
     virtual ::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);
     virtual void SAL_CALL deselectAccessibleChild( sal_Int32 nChildIndex )  throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException );
+	//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleTableSelection ============================================
+	virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	//-----IAccessibility2 Implementation 2009
 
 	// XServiceInfo
 	virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException);
@@ -109,7 +133,28 @@
     // XComponent
     virtual void SAL_CALL disposing( );
 
+    // XSelectionChangeListener
+    virtual void SAL_CALL 
+        disposing (const ::com::sun::star::lang::EventObject& Source) 
+        throw (::com::sun::star::uno::RuntimeException);
+    virtual void  SAL_CALL
+        selectionChanged (const ::com::sun::star::lang::EventObject& rEvent)
+        throw (::com::sun::star::uno::RuntimeException);
+	sal_Int32 mnPreviousSelectionCount;
 	using AccessibleShape::disposing;
+	//IAccessibility2 Implementation 2009-----
+	friend class AccessibleTableHeaderShape;
+	
+	void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+	// overwrite the SetState & ResetState to do special operation for table cell's internal text
+	virtual sal_Bool SetState (sal_Int16 aState);
+	virtual sal_Bool ResetState (sal_Int16 aState);
+	// The following two methods are used to set state directly on table object, instread of the internal cell or paragraph. 
+	sal_Bool SetStateDirectly (sal_Int16 aState);
+	sal_Bool ResetStateDirectly (sal_Int16 aState);
+	// Get the currently active cell which is text editing
+	AccessibleCell* GetActiveAccessibleCell();
+	//-----IAccessibility2 Implementation 2009
 
 protected:
 	virtual ::rtl::OUString CreateAccessibleBaseName(void) throw (::com::sun::star::uno::RuntimeException);
@@ -117,12 +162,98 @@
 	sdr::table::SvxTableController* getTableController();
 
 	void checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
-	void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
+	//IAccessibility2 Implementation 2009, move to public
+	//void getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException );
 
 private:
 	rtl::Reference< AccessibleTableShapeImpl > mxImpl;
+	//IAccessibility2 Implementation 2009-----
+	sal_Int32 GetIndexOfSelectedChild( sal_Int32 nSelectedChildIndex ) const;
+	//-----IAccessibility2 Implementation 2009
 };
 
+//IAccessibility2 Implementation 2009-----
+typedef ::cppu::WeakImplHelper5<
+			::com::sun::star::accessibility::XAccessible,
+			::com::sun::star::accessibility::XAccessibleComponent,
+			::com::sun::star::accessibility::XAccessibleContext,
+			::com::sun::star::accessibility::XAccessibleTable,
+			::com::sun::star::accessibility::XAccessibleTableSelection >
+			AccessibleTableHeaderShape_BASE;
+
+class AccessibleTableHeaderShape : boost::noncopyable, 
+	public MutexOwner,
+	public AccessibleTableHeaderShape_BASE 
+{
+public:
+	// bRow, sal_True means rowheader, sal_False means columnheader
+	AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow );
+	virtual ~AccessibleTableHeaderShape();
+	
+	// XAccessible
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL getAccessibleContext( ) throw(::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleContext
+	virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+	//XAccessibleComponent
+    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);	
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleTable
+	virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleColumnCount(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleRowHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL getAccessibleColumnHeaders(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleRows(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getSelectedAccessibleColumns(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleCaption(  ) throw (::com::sun::star::uno::RuntimeException); 
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleSummary(  ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleTableSelection  ============================================
+	virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+private:
+	SVX_DLLPRIVATE explicit AccessibleTableHeaderShape( const ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>& rxParent );
+	sal_Bool mbRow;
+	rtl::Reference< AccessibleTableShape > mpTable;
+};
+//-----IAccessibility2 Implementation 2009
+
 } // end of namespace accessibility
 
 #endif
diff --git a/main/svx/inc/svx/ChildrenManager.hxx b/main/svx/inc/svx/ChildrenManager.hxx
index 79ae17e..138c55b 100644
--- a/main/svx/inc/svx/ChildrenManager.hxx
+++ b/main/svx/inc/svx/ChildrenManager.hxx
@@ -130,6 +130,10 @@
     	GetChild (long nIndex)
         throw (::com::sun::star::uno::RuntimeException,
                ::com::sun::star::lang::IndexOutOfBoundsException);
+//IAccessibility2 Implementation 2009-----
+        ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetChild (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>& xShape) throw (::com::sun::star::uno::RuntimeException);
+        ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> GetChildShape (long nIndex) throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 
     /** Update the child manager.  Take care of a modified set of children
         and modified visible area.  This method can optimize the update
diff --git a/main/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx b/main/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx
index 22ec14a..d76c9df 100644
--- a/main/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx
+++ b/main/svx/inc/svx/EnhancedCustomShapeTypeNames.hxx
@@ -30,6 +30,9 @@
 {
 	SVX_DLLPUBLIC MSO_SPT Get( const rtl::OUString& );
 	SVX_DLLPUBLIC rtl::OUString Get( const MSO_SPT );
+
+	//IAccessibility2 Implementation 2009
+	rtl::OUString GetAccName( const rtl::OUString& );
 }
 
 #endif
diff --git a/main/svx/inc/svx/IAccessibleParent.hxx b/main/svx/inc/svx/IAccessibleParent.hxx
index cb87d16..1f37c86 100644
--- a/main/svx/inc/svx/IAccessibleParent.hxx
+++ b/main/svx/inc/svx/IAccessibleParent.hxx
@@ -27,7 +27,11 @@
 #include <com/sun/star/uno/RuntimeException.hpp>
 #include <com/sun/star/drawing/XShape.hpp>
 #include <sal/types.h>
-
+//IAccessibility2 Implementation 2009-----
+#ifndef _SVX_ACCESSIBILITY_ACCESSIBLE_SHAPE_MANAGER_HXX
+#include "AccessibleControlShape.hxx"
+#endif
+//-----IAccessibility2 Implementation 2009
 namespace accessibility {
 
 class AccessibleShape;
@@ -84,6 +88,18 @@
 		const long _nIndex,
 		const AccessibleShapeTreeInfo& _rShapeTreeInfo
 	)	throw (::com::sun::star::uno::RuntimeException) = 0;
+	//IAccessibility2 Implementation 2009-----
+	//Add this method to support Form Controls
+	virtual AccessibleControlShape* GetAccControlShapeFromModel
+		(::com::sun::star::beans::XPropertySet*) 
+		throw (::com::sun::star::uno::RuntimeException){return NULL;};
+	virtual  ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>
+        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
+            ::com::sun::star::drawing::XShape>&)
+			throw (::com::sun::star::uno::RuntimeException){return NULL;};
+	virtual sal_Bool IsDocumentSelAll(){ return sal_False; }
+	//-----IAccessibility2 Implementation 2009
 };
 
 } // end of namespace accessibility
diff --git a/main/svx/inc/svx/ctredlin.hxx b/main/svx/inc/svx/ctredlin.hxx
index 7d65e70..c48b84e 100644
--- a/main/svx/inc/svx/ctredlin.hxx
+++ b/main/svx/inc/svx/ctredlin.hxx
@@ -299,6 +299,10 @@
 	void			Enable( bool bEnable = true, bool bChild = true );
 	void			Disable( bool bChild = true );
 
+	//IAccessibility2 Implementation 2009-----
+	void			SetAccessibleRelationMemberOf( Window* pWindow);
+	//-----IAccessibility2 Implementation 2009
+
 	// } Methoden fuer Calc
 };
 
diff --git a/main/svx/inc/svx/dlgctrl.hxx b/main/svx/inc/svx/dlgctrl.hxx
index a761c87..580792e 100644
--- a/main/svx/inc/svx/dlgctrl.hxx
+++ b/main/svx/inc/svx/dlgctrl.hxx
@@ -78,6 +78,7 @@
 #define CS_NOVERT	2		// no vertikal input information is used
 
 class SvxRectCtlAccessibleContext;
+class SvxPixelCtlAccessible; // IAccessibility2 implementation 2009
 
 class SVX_DLLPUBLIC SvxRectCtl : public Control
 {
@@ -214,7 +215,11 @@
 	Size		aRectSize;
 	sal_uInt16* 	pPixel;
 	sal_Bool		bPaintable;
-
+	// IAccessibility2 implementation 2009. ------
+	//Solution:Add member identifying position
+	Point       aFocusPosition;
+	Rectangle   implCalFocusRect( const Point& aPosition );
+	// ------ IAccessibility2 implementation 2009.
 	void	ChangePixel( sal_uInt16 nPixel );
 
 public:
@@ -240,6 +245,25 @@
 
 	void	SetPaintable( sal_Bool bTmp ) { bPaintable = bTmp; }
 	void	Reset();
+	// IAccessibility2 implementation 2009. ------
+	SvxPixelCtlAccessible*	m_pAccess;
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >		m_xAccess;
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > CreateAccessible();
+	long GetSquares() const { return nSquares ; }
+	long GetWidth() const { return aRectSize.getWidth() ; }
+	long GetHeight() const { return aRectSize.getHeight() ; }
+
+	//Device Pixel .
+	long ShowPosition( const Point &pt);
+	
+	long PointToIndex(const Point &pt) const;
+	Point IndexToPoint(long nIndex) const ;
+	long GetFoucsPosIndex() const ;
+	//Solution:Keyboard fucntion for key input and focus handling function
+	virtual void        KeyInput( const KeyEvent& rKEvt );
+	virtual void        GetFocus();
+    virtual void        LoseFocus();
+	// ------ IAccessibility2 implementation 2009.
 };
 
 /*************************************************************************
diff --git a/main/svx/inc/svx/nbdtmg.hxx b/main/svx/inc/svx/nbdtmg.hxx
index 42af35b..26ec061 100755
--- a/main/svx/inc/svx/nbdtmg.hxx
+++ b/main/svx/inc/svx/nbdtmg.hxx
@@ -199,7 +199,7 @@
 	private:
 		const SfxItemSet*	pSet;
 		SfxMapUnit		eCoreUnit;
-		//Sym3_2508    store the attributes passed from pSet
+		// store the attributes passed from pSet
 		String			aNumCharFmtName;
 		void			StoreBulCharFmtName_impl();
 		void			StoreMapUnit_impl();
@@ -217,7 +217,7 @@
 		virtual sal_Bool IsCustomized(sal_uInt16 nIndex)=0;
 		sal_uInt16 IsSingleLevel(sal_uInt16 nCurLevel);
 		const SfxItemSet* GetItems() { return pSet;}
-		//Sym3_2508    store the attributes passed from pSet
+		// store the attributes passed from pSet
 		void SetItems(const SfxItemSet* pArg) { pSet = pArg;StoreBulCharFmtName_impl();StoreMapUnit_impl();}
 	protected:
 		String GetBulCharFmtName();
diff --git a/main/svx/inc/svx/sdr/table/tablecontroller.hxx b/main/svx/inc/svx/sdr/table/tablecontroller.hxx
index b0d8d6e..a942ed3 100755
--- a/main/svx/inc/svx/sdr/table/tablecontroller.hxx
+++ b/main/svx/inc/svx/sdr/table/tablecontroller.hxx
@@ -102,6 +102,19 @@
 
     SVX_DLLPRIVATE void onTableModified();
 
+//IAccessibility2 Implementation 2009-----
+	sal_Bool selectRow( sal_Int32 row );
+	sal_Bool selectColumn( sal_Int32 column );
+	sal_Bool deselectRow( sal_Int32 row );
+	sal_Bool deselectColumn( sal_Int32 column );
+	sal_Bool isRowSelected( sal_Int32 nRow );
+	sal_Bool isColumnSelected( sal_Int32 nColumn );
+	sal_Bool isRowHeader();
+	sal_Bool isColumnHeader();
+	::sdr::table::SdrTableObj* GetTableObj() { return dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() ); }
+	//declare event notification method
+	void NotifySelection( const CellPos& firstPos, const CellPos& lastPos, const CellPos& newPos );
+//-----IAccessibility2 Implementation 2009
 private:
     SvxTableController(SvxTableController &); // not defined
     void operator =(SvxTableController &); // not defined
diff --git a/main/svx/inc/svx/srchdlg.hxx b/main/svx/inc/svx/srchdlg.hxx
index 941d7f0..1a6fff9 100644
--- a/main/svx/inc/svx/srchdlg.hxx
+++ b/main/svx/inc/svx/srchdlg.hxx
@@ -155,8 +155,19 @@
 	PushButton&     GetReplaceBtn() { return aReplaceBtn; }
 
 	sal_Int32			GetTransliterationFlags() const;
-
+//IAccessibility2 Impplementaton 2009-----
+	void SetDocWin( Window* pDocWin ) { mpDocWin = pDocWin; }
+	Window* GetDocWin() { return mpDocWin; }
+	void SetSrchFlag( sal_Bool bSuccess = sal_False ) { mbSuccess = bSuccess; }
+	sal_Bool GetSrchFlag() { return mbSuccess; }
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > 
+		GetComponentInterface( sal_Bool bCreate );
+//-----IAccessibility2 Impplementaton 2009
 private:
+//IAccessibility2 Impplementaton 2009-----
+	Window*			mpDocWin;
+	sal_Bool			mbSuccess;
+//-----IAccessibility2 Impplementaton 2009
 	FixedText       aSearchText;
 	ComboBox        aSearchLB;
 	ListBox         aSearchTmplLB;
diff --git a/main/svx/inc/svx/svdmodel.hxx b/main/svx/inc/svx/svdmodel.hxx
index 2b658a7..07c1ddb 100644
--- a/main/svx/inc/svx/svdmodel.hxx
+++ b/main/svx/inc/svx/svdmodel.hxx
@@ -80,9 +80,17 @@
 class SdrOutlinerCache;
 class SotStorageRef;
 class SdrUndoFactory;
-namespace comphelper { class IEmbeddedHelper; }
-namespace sfx2 { class LinkManager; }
+namespace comphelper{
+    class IEmbeddedHelper;
+}
 
+//IAccessibility2 Implementation 2009-----
+class ImageMap;
+//-----IAccessibility2 Implementation 2009
+
+namespace sfx2{
+    class LinkManager;
+}
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 
 #define SDR_SWAPGRAPHICSMODE_NONE		0x00000000
@@ -720,6 +728,11 @@
 
     static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelImplementationId();
 
+	//IAccessibility2 Implementation 2009-----
+	virtual ImageMap* GetImageMapForObject(SdrObject*){return NULL;};
+	virtual sal_Int32 GetHyperlinkCount(SdrObject*){return 0;}
+	//-----IAccessibility2 Implementation 2009
+
 	/** enables (true) or disables (false) recording of undo actions
 		If undo actions are added while undo is disabled, they are deleted.
 		Disabling undo does not clear the current undo buffer! */
diff --git a/main/svx/inc/svx/svdmrkv.hxx b/main/svx/inc/svx/svdmrkv.hxx
index 8f4b373..e79340e 100644
--- a/main/svx/inc/svx/svdmrkv.hxx
+++ b/main/svx/inc/svx/svdmrkv.hxx
@@ -511,6 +511,9 @@
 	// Endpunkt der Spiegelachse
     const Point& GetRef2() const { return aRef1; }
     void SetRef2(const Point& rPt);
+//IAccessibility2 Implementation 2009-----
+	void UnmarkObj(SdrObject* pObj);
+//-----IAccessibility2 Implementation 2009
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
diff --git a/main/svx/inc/svx/svdoashp.hxx b/main/svx/inc/svx/svdoashp.hxx
index 336d635..b6e0fd5 100644
--- a/main/svx/inc/svx/svdoashp.hxx
+++ b/main/svx/inc/svx/svdoashp.hxx
@@ -258,6 +258,10 @@
 	static bool doConstructOrthogonal(const ::rtl::OUString& rName);
 
 	using SdrTextObj::NbcSetOutlinerParaObject;
+
+	//IAccessibility2 Implementation 2009-----
+	::rtl::OUString GetCustomShapeName();
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif //_SVDOASHP_HXX
diff --git a/main/svx/inc/svx/svdobj.hxx b/main/svx/inc/svx/svdobj.hxx
index 703a1b7..8597dcd 100644
--- a/main/svx/inc/svx/svdobj.hxx
+++ b/main/svx/inc/svx/svdobj.hxx
@@ -452,6 +452,9 @@
 	SdrObjUserCall*				pUserCall;
 	SdrObjPlusData*				pPlusData;    // Broadcaster, UserData, Konnektoren, ... (Das ist der Bitsack)
 
+//IAccessibility2 Implementation 2009-----
+	SdrObject*	pCaptionObj;
+//-----IAccessibility2 Implementation 2009
 	sal_uInt32					nOrdNum;      // Rangnummer des Obj in der Liste
 
     /** Position in the navigation order.  SAL_MAX_UINT32 when not used.
@@ -1128,6 +1131,9 @@
     // #121917#
     virtual bool HasText() const;
 
+//IAccessibility2 Implementation 2009-----
+	const SdrObject* GetCaptionObj() const;
+//-----IAccessibility2 Implementation 2009
 protected:
     void    impl_setUnoShape( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& _rxUnoShape );
 
diff --git a/main/svx/inc/svx/svdoole2.hxx b/main/svx/inc/svx/svdoole2.hxx
index 3411acd..f703b7a 100644
--- a/main/svx/inc/svx/svdoole2.hxx
+++ b/main/svx/inc/svx/svdoole2.hxx
@@ -84,6 +84,9 @@
 	void Init();
 
 public:
+//IAccessibility2 Implementation 2009-----
+	String GetStyleString();
+//-----IAccessibility2 Implementation 2009
 	TYPEINFO();
 
 	SdrOle2Obj(FASTBOOL bFrame_=sal_False);
diff --git a/main/svx/source/accessibility/AccessibleControlShape.cxx b/main/svx/source/accessibility/AccessibleControlShape.cxx
index a9d576f..f8b93b4 100644
--- a/main/svx/source/accessibility/AccessibleControlShape.cxx
+++ b/main/svx/source/accessibility/AccessibleControlShape.cxx
@@ -44,7 +44,23 @@
 #include <svx/svdpagv.hxx>
 #include "svx/svdstr.hrc"
 #include <algorithm>
-
+//IAccessibility2 Implementation 2009-----
+#ifndef _COMPHELPER_PROPERTY_HXX_
+#include <comphelper/property.hxx>
+#endif
+#ifndef _COMPHELPER_TYPES_HXX_
+#include <comphelper/types.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XCHILD_HPP_
+#include <com/sun/star/container/XChild.hpp>
+#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
+//-----IAccessibility2 Implementation 2009
 using namespace ::comphelper;
 using namespace ::accessibility;
 using namespace	::com::sun::star::accessibility;
@@ -78,6 +94,14 @@
 		static ::rtl::OUString s_sLabelPropertyLabel( RTL_CONSTASCII_USTRINGPARAM( "Label" ) );
 		return s_sLabelPropertyLabel;
 	}
+	//IAccessibility2 Implementation 2009-----
+	//................................................................
+	const ::rtl::OUString& lcl_getLabelControlPropertyName( )
+	{
+		static ::rtl::OUString s_sLabelControlPropertyLabel( RTL_CONSTASCII_USTRINGPARAM( "LabelControl" ) );
+		return s_sLabelControlPropertyLabel;
+	}
+	//-----IAccessibility2 Implementation 2009
 	//................................................................
 	// return the property which should be used as AccessibleName
 	const ::rtl::OUString& lcl_getPreferredAccNameProperty( const Reference< XPropertySetInfo >& _rxPSI )
@@ -636,23 +660,57 @@
 Reference< XAccessibleRelationSet > SAL_CALL AccessibleControlShape::getAccessibleRelationSet(  ) throw (RuntimeException)
 {
 	// TODO
-	return AccessibleShape::getAccessibleRelationSet( );
+	// return AccessibleShape::getAccessibleRelationSet( );
+	//IAccessibility2 Implementation 2009-----
+    utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	ensureControlModelAccess();
+	AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape();
+	if(pCtlAccShape)
+	{
+		Reference < XAccessible > xAcc (pCtlAccShape->getAccessibleContext(), UNO_QUERY);
+
+		::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > aSequence(1);
+		aSequence[0] = xAcc;
+		if( getAccessibleRole() == AccessibleRole::RADIO_BUTTON )
+		{
+			pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+		else
+		{
+			pRelationSetHelper->AddRelation( AccessibleRelation( AccessibleRelationType::LABELED_BY, aSequence ) );
+		}
+	}
+	Reference< XAccessibleRelationSet > xSet = pRelationSetHelper;
+	return xSet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
 ::rtl::OUString AccessibleControlShape::CreateAccessibleName (void) throw (RuntimeException)
 {
 	ensureControlModelAccess();
-
-	// check if we can obtain the "Name" resp. "Label" property from the model
-	const ::rtl::OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta );
-
-	::rtl::OUString sName( getControlModelStringProperty( rAccNameProperty ) );
-	if ( !sName.getLength() )
-	{	// no -> use the default
-		sName = AccessibleShape::CreateAccessibleName();
+	//IAccessibility2 Implementation 2009-----
+	::rtl::OUString sName;
+	if ( getAccessibleRole() != AccessibleRole::SHAPE	
+		&& getAccessibleRole() != AccessibleRole::RADIO_BUTTON  )
+	{
+		AccessibleControlShape* pCtlAccShape = GetLabeledByControlShape();
+		if(pCtlAccShape)
+		{
+			sName = pCtlAccShape->CreateAccessibleName();
+		}
 	}
-
+	if(sName.getLength() == 0)
+	{
+		// check if we can obtain the "Name" resp. "Label" property from the model
+		const ::rtl::OUString& rAccNameProperty = lcl_getPreferredAccNameProperty( m_xModelPropsMeta );
+		sName = getControlModelStringProperty( rAccNameProperty );
+		if ( !sName.getLength() )
+		{	// no -> use the default
+			sName = AccessibleShape::CreateAccessibleName();
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	// now that somebody first asked us for our name, ensure that we are listening to name changes on the model
 	m_bListeningForName = ensureListeningState( m_bListeningForName, sal_True, lcl_getPreferredAccNameProperty( m_xModelPropsMeta ) );
 
@@ -914,3 +972,25 @@
 {
     // not interested in
 }
+//IAccessibility2 Implementation 2009-----
+AccessibleControlShape* SAL_CALL AccessibleControlShape::GetLabeledByControlShape( )
+{
+	if(m_xControlModel.is())
+	{
+		const ::rtl::OUString& rAccLabelControlProperty = lcl_getLabelControlPropertyName();
+		Any sCtlLabelBy;
+		// get the "label by" property value of the control
+		if (::comphelper::hasProperty(rAccLabelControlProperty, m_xControlModel))
+		{
+			m_xControlModel->getPropertyValue( rAccLabelControlProperty ) >>= sCtlLabelBy;
+			if( sCtlLabelBy.hasValue() )
+			{
+				Reference< XPropertySet >  xAsSet (sCtlLabelBy, UNO_QUERY);
+				AccessibleControlShape* pCtlAccShape = mpParent->GetAccControlShapeFromModel(xAsSet.get());
+				return pCtlAccShape;
+			}
+		}
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx
index 09284b9..0bc4917 100644
--- a/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx
+++ b/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx
@@ -153,7 +153,7 @@
         OutputDevice*	GetRefDevice() const { return NULL; }
         sal_Bool		GetIndexAtPoint( const Point&, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
         sal_Bool		GetWordIndices( sal_uInt16, sal_uInt16, sal_uInt16&, sal_uInt16& ) const { return sal_False; }
-        sal_Bool 		GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16 ) const { return sal_False; }
+	sal_Bool 		GetAttributeRun( sal_uInt16&, sal_uInt16&, sal_uInt16, sal_uInt16, sal_Bool) const { return sal_False; }
         sal_uInt16			GetLineCount( sal_uInt16 nPara ) const { return nPara == 0 ? 1 : 0; }
         sal_uInt16			GetLineLen( sal_uInt16, sal_uInt16 ) const { return 0; }
         void            GetLineBoundaries( /*out*/sal_uInt16 & rStart, /*out*/sal_uInt16 & rEnd, sal_uInt16 /*nParagraph*/, sal_uInt16 /*nLine*/ ) const  { rStart = rEnd = 0; }
diff --git a/main/svx/source/accessibility/AccessibleFrameSelector.cxx b/main/svx/source/accessibility/AccessibleFrameSelector.cxx
index b4fddd4..b2d6ecb 100644
--- a/main/svx/source/accessibility/AccessibleFrameSelector.cxx
+++ b/main/svx/source/accessibility/AccessibleFrameSelector.cxx
@@ -190,7 +190,10 @@
 
 sal_Int16 AccFrameSelector::getAccessibleRole(  ) throw (RuntimeException)
 {
-    return AccessibleRole::OPTION_PANE;
+    // return AccessibleRole::OPTION_PANE;
+	//IAccessibility2 Implementation 2009-----
+	return meBorder == FRAMEBORDER_NONE ? AccessibleRole::OPTION_PANE : AccessibleRole::CHECK_BOX;
+	//-----IAccessibility2 Implementation 2009
 }
 
 // ----------------------------------------------------------------------------
@@ -222,19 +225,43 @@
     IsValid();
     utl::AccessibleRelationSetHelper* pHelper;
     Reference< XAccessibleRelationSet > xRet = pHelper = new utl::AccessibleRelationSetHelper;
+    //if(meBorder == FRAMEBORDER_NONE)
+    //{
+    //    //add the label relation
+    //    Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
+    //    if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
+    //    {
+    //        AccessibleRelation aLabelRelation;
+    //        aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
+    //        aLabelRelation.TargetSet.realloc(1);
+    //        aLabelRelation.TargetSet.getArray()[0]  = pPrev->GetAccessible();
+    //        pHelper->AddRelation(aLabelRelation);
+    //    }
+    //}
+	//IAccessibility2 Implementation 2009-----
     if(meBorder == FRAMEBORDER_NONE)
     {
         //add the label relation
-        Window* pPrev = mpFrameSel->GetWindow( WINDOW_PREV );
-        if(pPrev && WINDOW_FIXEDTEXT == pPrev->GetType())
-        {
-            AccessibleRelation aLabelRelation;
+		Window *pLabeledBy = mpFrameSel->GetAccessibleRelationLabeledBy();
+		if ( pLabeledBy && pLabeledBy != mpFrameSel )
+		{
+			AccessibleRelation aLabelRelation;
             aLabelRelation.RelationType = AccessibleRelationType::LABELED_BY;
             aLabelRelation.TargetSet.realloc(1);
-            aLabelRelation.TargetSet.getArray()[0]  = pPrev->GetAccessible();
+            aLabelRelation.TargetSet.getArray()[0]  = pLabeledBy->GetAccessible();
             pHelper->AddRelation(aLabelRelation);
-        }
+		}
+		Window* pMemberOf = mpFrameSel->GetAccessibleRelationMemberOf();
+		if ( pMemberOf && pMemberOf != mpFrameSel )
+		{
+			AccessibleRelation aMemberOfRelation;
+            aMemberOfRelation.RelationType = AccessibleRelationType::MEMBER_OF;
+            aMemberOfRelation.TargetSet.realloc(1);
+            aMemberOfRelation.TargetSet.getArray()[0]  = pMemberOf->GetAccessible();
+            pHelper->AddRelation(aMemberOfRelation);
+		}
     }
+	//-----IAccessibility2 Implementation 2009
     return xRet;
 }
 
@@ -721,6 +748,10 @@
 
 void AccFrameSelector::Invalidate()
 {
+	if ( mpFrameSel )
+    {
+        mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
+    }
     mpFrameSel = 0;
     EventObject aEvent;
     Reference < XAccessibleContext > xThis( this );
diff --git a/main/svx/source/accessibility/AccessibleGraphicShape.cxx b/main/svx/source/accessibility/AccessibleGraphicShape.cxx
index 748c2a2..8aabcff 100644
--- a/main/svx/source/accessibility/AccessibleGraphicShape.cxx
+++ b/main/svx/source/accessibility/AccessibleGraphicShape.cxx
@@ -29,6 +29,8 @@
 
 #include <svx/ShapeTypeHandler.hxx>
 #include <svx/SvxShapeTypes.hxx>
+#include <svx/svdobj.hxx>
+#include <svx/svdmodel.hxx>
 
 using namespace ::accessibility;
 using namespace ::rtl;
@@ -59,6 +61,10 @@
 ::rtl::OUString SAL_CALL AccessibleGraphicShape::getAccessibleImageDescription (void)
     throw (::com::sun::star::uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+	if(m_pShape)						 
+      		return m_pShape->GetTitle();
+//-----IAccessibility2 Implementation 2009
     return AccessibleShape::getAccessibleDescription ();
 }
 
@@ -204,5 +210,30 @@
     AccessibleGraphicShape::CreateAccessibleDescription (void)
     throw (::com::sun::star::uno::RuntimeException)
 {
-    return CreateAccessibleName ();
+//IAccessibility2 Implementation 2009-----
+	//Solution: Don't use the same information for accessible name and accessible description.
+      	//return CreateAccessibleName ();
+  	 ::rtl::OUString sDesc;
+		if(m_pShape)						 
+    	sDesc =  m_pShape->GetTitle();
+		if(sDesc.getLength() > 0)
+			return sDesc;
+    	return CreateAccessibleBaseName();
+//-----IAccessibility2 Implementation 2009
 }
+//IAccessibility2 Implementation 2009-----
+//	Return this object's role.
+sal_Int16 SAL_CALL AccessibleGraphicShape::getAccessibleRole (void)
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int16 nAccessibleRole =  AccessibleRole::SHAPE;
+	if( m_pShape->GetModel()->GetImageMapForObject(m_pShape) != NULL )
+		return AccessibleRole::IMAGE_MAP;
+	else
+		//return AccessibleRole::SHAPE;
+		return AccessibleShape::getAccessibleRole();
+	return nAccessibleRole;
+}
+//-----IAccessibility2 Implementation 2009
+
+
diff --git a/main/svx/source/accessibility/AccessibleOLEShape.cxx b/main/svx/source/accessibility/AccessibleOLEShape.cxx
index 72c810d..ae4a0d3 100644
--- a/main/svx/source/accessibility/AccessibleOLEShape.cxx
+++ b/main/svx/source/accessibility/AccessibleOLEShape.cxx
@@ -29,7 +29,9 @@
 
 #include <svx/ShapeTypeHandler.hxx>
 #include <svx/SvxShapeTypes.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#include <svx/svdoole2.hxx>
+//-----IAccessibility2 Implementation 2009
 using namespace accessibility;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
@@ -179,8 +181,24 @@
 
 	return aTypeList;
 }
-
-
+//IAccessibility2 Implementation 2009-----
+//=====  XAccessibleExtendedAttributes  ========================================================
+uno::Any SAL_CALL AccessibleOLEShape::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any strRet;
+	::rtl::OUString style;
+	if( m_pShape )
+	{        	
+		//style = ::rtl::OUString::createFromAscii("style=");
+		style = ::rtl::OUString::createFromAscii("style:");
+		style += ((SdrOle2Obj*)m_pShape)->GetStyleString();
+	}
+	style += ::rtl::OUString::createFromAscii(";");
+	strRet <<= style;
+	return strRet;
+}
+//-----IAccessibility2 Implementation 2009
 
 
 ///	Set this object's name if is different to the current name.
diff --git a/main/svx/source/accessibility/AccessibleShape.cxx b/main/svx/source/accessibility/AccessibleShape.cxx
index 3fe5c44..6dadf40 100644
--- a/main/svx/source/accessibility/AccessibleShape.cxx
+++ b/main/svx/source/accessibility/AccessibleShape.cxx
@@ -31,6 +31,11 @@
 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_ROLE_HPP_
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #endif
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLETEXTTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
 #ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLE_STATE_TYPE_HPP_
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #endif
@@ -61,12 +66,28 @@
 #include <unotools/accessiblestatesethelper.hxx>
 #include <svx/svdview.hxx>
 #include "AccessibleEmptyEditSource.hxx"
-
+//IAccessibility2 Implementation 2009-----
+#include <svx/svdpage.hxx>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 using namespace	::com::sun::star::accessibility;
+//IAccessibility2 Implementation 2009-----
+using ::com::sun::star::lang::IndexOutOfBoundsException;
+using ::com::sun::star::uno::RuntimeException;
+//-----IAccessibility2 Implementation 2009
 using ::com::sun::star::uno::Reference;
 using ::rtl::OUString;
+//IAccessibility2 Implementation 2009-----
+#include <algorithm>
 
+// #include <Accessiblehyperlink.hxx>
+//-----IAccessibility2 Implementation 2009
 namespace accessibility {
 
 namespace {
@@ -107,7 +128,9 @@
 AccessibleShape::AccessibleShape (
     const AccessibleShapeInfo& rShapeInfo,
     const AccessibleShapeTreeInfo& rShapeTreeInfo)
-    : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::LIST_ITEM),
+    //IAccessibility2 Implementation 2009-----
+    : AccessibleContextBase (rShapeInfo.mxParent,AccessibleRole::SHAPE),
+    //-----IAccessibility2 Implementation 2009
       mpChildrenManager(NULL),
       mxShape (rShapeInfo.mxShape),
       maShapeTreeInfo (rShapeTreeInfo),
@@ -119,10 +142,26 @@
 	m_pShape = GetSdrObjectFromXShape(mxShape);
     UpdateNameAndDescription();
 }
-
-
-
-
+//IAccessibility2 Implementation 2009-----
+AccessibleShape::AccessibleShape (
+        const ::com::sun::star::uno::Reference<
+            ::com::sun::star::drawing::XShape>& rxShape,
+        const ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>& rxParent,
+        const AccessibleShapeTreeInfo& rShapeTreeInfo,
+        sal_Int32 nIndex)
+    : AccessibleContextBase (rxParent,AccessibleRole::SHAPE),
+      mpChildrenManager(NULL),
+      mxShape (rxShape),
+      maShapeTreeInfo (rShapeTreeInfo),
+      mnIndex (nIndex),
+      m_nIndexInParent(-1),
+      mpText (NULL),
+      mpParent (NULL)
+{
+	m_pShape = GetSdrObjectFromXShape(mxShape);
+}
+//-----IAccessibility2 Implementation 2009
 AccessibleShape::~AccessibleShape (void)
 {
     if (mpChildrenManager != NULL)
@@ -258,10 +297,13 @@
     else
         pStateSet->RemoveState (AccessibleStateType::SELECTED);
 }
+//IAccessibility2 Implementation 2009-----
+    ::rtl::OUString AccessibleShape::GetStyle()
+    {
+	    return ShapeTypeHandler::CreateAccessibleBaseName( mxShape );
+    }
 
-
-
-
+//-----IAccessibility2 Implementation 2009
 bool AccessibleShape::operator== (const AccessibleShape& rShape)
 {
     return this==&rShape;
@@ -323,10 +365,28 @@
     else
         return AccessibleContextBase::GetState (aState);
 }
+//IAccessibility2 Implementation 2009-----
+// Solution: OverWrite the parent's getAccessibleName method
+::rtl::OUString SAL_CALL AccessibleShape::getAccessibleName (void)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    	ThrowIfDisposed ();
+	if( m_pShape && m_pShape->GetTitle().Len() > 0)
+		return CreateAccessibleName() + ::rtl::OUString(' ') + m_pShape->GetTitle();
+	else
+		return CreateAccessibleName();	
+}
 
-
-
-
+::rtl::OUString SAL_CALL AccessibleShape::getAccessibleDescription (void)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    	ThrowIfDisposed ();
+	if( m_pShape && m_pShape->GetDescription().Len() > 0)
+		return	m_pShape->GetDescription() ;
+	else
+		return OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
+}
+//-----IAccessibility2 Implementation 2009
 //=====  XAccessibleContext  ==================================================
 
 /** The children of this shape come from two sources: The children from
@@ -386,8 +446,45 @@
     return xChild;
 }
 
-
-
+//IAccessibility2 Implementation 2009-----
+uno::Reference<XAccessibleRelationSet> SAL_CALL
+	AccessibleShape::getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	::osl::MutexGuard aGuard (maMutex);
+    ::utl::AccessibleRelationSetHelper* pRelationSet =
+		new utl::AccessibleRelationSetHelper;
+	SdrObject* pCaptionSdr = const_cast < SdrObject* > ( m_pShape->GetCaptionObj() )  ;
+	if(pCaptionSdr!=NULL)
+	{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			uno::Reference<drawing::XShape> xCaptionShape ( pCaptionSdr->getUnoShape(),uno::UNO_QUERY);
+			if(xCaptionShape.is())
+			{
+				aSequence[0] = mpParent->GetAccessibleCaption(xCaptionShape);
+				pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
+		}
+	}
+	else
+	{
+		//this mxshape is the captioned shape, only for sw
+		if(mpParent->GetAccessibleCaption(mxShape).get())
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = mpParent->GetAccessibleCaption(mxShape);
+			pRelationSet->AddRelation( AccessibleRelation( AccessibleRelationType::DESCRIBED_BY, aSequence ) );
+		}
+	}
+   if (pRelationSet != NULL)
+    {
+        return uno::Reference<XAccessibleRelationSet> (
+            new ::utl::AccessibleRelationSetHelper (*pRelationSet));
+    }
+    else
+        return uno::Reference<XAccessibleRelationSet>(NULL);
+	return uno::Reference<XAccessibleRelationSet>();
+}
+//-----IAccessibility2 Implementation 2009
 
 /**	Return a copy of the state set.
     Possible states are:
@@ -404,8 +501,41 @@
 
 	if (rBHelper.bDisposed || mpText == NULL)
         // Return a minimal state set that only contains the DEFUNC state.
+	//IAccessibility2 Implementation 2009-----
+	//xStateSet = AccessibleContextBase::getAccessibleStateSet ();
+	{
         xStateSet = AccessibleContextBase::getAccessibleStateSet ();
-    else
+		::utl::AccessibleStateSetHelper* pStateSet = 
+              static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
+		    ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
+		    if( xTempAcc.is() )
+		    {
+		    	::com::sun::star::uno::Reference<XAccessibleContext> 
+		    							xTempAccContext = xTempAcc->getAccessibleContext();
+		    	if( xTempAccContext.is() )
+		    	{
+		    		::com::sun::star::uno::Reference<XAccessibleStateSet> rState = 
+		    			xTempAccContext->getAccessibleStateSet();
+		    		if( rState.is() )    		{
+						com::sun::star::uno::Sequence<short> pStates = rState->getStates();
+						int count = pStates.getLength();
+						for( int iIndex = 0;iIndex < count;iIndex++ )
+						{
+							if( pStates[iIndex] == AccessibleStateType::EDITABLE )
+							{
+								pStateSet->AddState (AccessibleStateType::EDITABLE);
+							    pStateSet->AddState (AccessibleStateType::RESIZABLE);
+							    pStateSet->AddState (AccessibleStateType::MOVEABLE);
+								break;	
+							}
+						}
+					}
+				}
+		    }
+			xStateSet = Reference<XAccessibleStateSet>(
+                new ::utl::AccessibleStateSetHelper (*pStateSet));
+			//-----IAccessibility2 Implementation 2009
+    }else
     {
         ::utl::AccessibleStateSetHelper* pStateSet =
               static_cast< ::utl::AccessibleStateSetHelper*>(mxStateSet.get());
@@ -420,14 +550,43 @@
                 else
                     pStateSet->RemoveState (AccessibleStateType::FOCUSED);
             }
-
+			//IAccessibility2 Implementation 2009-----
+			//Solution:Just when the document is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
+		    ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
+		    if( xTempAcc.is() )
+		    {
+		    	::com::sun::star::uno::Reference<XAccessibleContext> 
+		    							xTempAccContext = xTempAcc->getAccessibleContext();
+		    	if( xTempAccContext.is() )
+		    	{
+		    		::com::sun::star::uno::Reference<XAccessibleStateSet> rState = 
+		    			xTempAccContext->getAccessibleStateSet();
+		    		if( rState.is() )    		{
+						com::sun::star::uno::Sequence<short> pStates = rState->getStates();
+						int count = pStates.getLength();
+						for( int iIndex = 0;iIndex < count;iIndex++ )
+						{
+							if( pStates[iIndex] == AccessibleStateType::EDITABLE )
+							{
+								pStateSet->AddState (AccessibleStateType::EDITABLE);
+							    pStateSet->AddState (AccessibleStateType::RESIZABLE);
+							    pStateSet->AddState (AccessibleStateType::MOVEABLE);
+								break;	
+							}
+						}
+					}
+				}
+		    }
+			//-----IAccessibility2 Implementation 2009
             // Create a copy of the state set that may be modified by the
             // caller without affecting the current state set.
             xStateSet = Reference<XAccessibleStateSet>(
                 new ::utl::AccessibleStateSetHelper (*pStateSet));
         }
     }
-
+//IAccessibility2 Implementation 2009-----
+	UpdateDocumentAllSelState(xStateSet);
+//-----IAccessibility2 Implementation 2009
     return xStateSet;
 }
 
@@ -705,6 +864,22 @@
             uno::Any aColor;
             aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillColor"));
             aColor >>= nColor;
+			//IAccessibility2 Implementation 2009-----
+			aColor = aSet->getPropertyValue (OUString::createFromAscii ("FillTransparence"));
+			short nTrans=0;
+			aColor >>= nTrans;
+			Color crBk(nColor);
+			if (nTrans == 0 )
+			{
+				crBk.SetTransparency(0xff);
+			}
+			else
+			{
+				nTrans = short(256 - nTrans / 100. * 256);
+				crBk.SetTransparency(sal_uInt8(nTrans));
+			}
+			nColor = crBk.GetColor();
+			//-----IAccessibility2 Implementation 2009
         }
     }
     catch (::com::sun::star::beans::UnknownPropertyException)
@@ -763,9 +938,18 @@
         aReturn = ::cppu::queryInterface (rType,
             static_cast<XAccessibleComponent*>(this),
             static_cast<XAccessibleExtendedComponent*>(this),
+	    //IAccessibility2 Implementation 2009-----
+            static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this),
+
+	     static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this),
+	     //-----IAccessibility2 Implementation 2009
             static_cast<lang::XEventListener*>(this),
             static_cast<document::XEventListener*>(this),
-            static_cast<lang::XUnoTunnel*>(this)
+            static_cast<lang::XUnoTunnel*>(this),
+	//IAccessibility2 Implementation 2009-----
+            static_cast<XAccessibleGroupPosition*>(this),
+            static_cast<XAccessibleHypertext*>(this)
+	//-----IAccessibility2 Implementation 2009
             );
     return aReturn;
 }
@@ -789,10 +973,127 @@
 {
     AccessibleContextBase::release ();
 }
+//IAccessibility2 Implementation 2009-----
+//
+//=====  XAccessibleSelection  ============================================
+//
 
+//--------------------------------------------------------------------------------
+void SAL_CALL AccessibleShape::selectAccessibleChild( sal_Int32 ) 
+throw ( IndexOutOfBoundsException, RuntimeException )
+{
+}
 
+//----------------------------------------------------------------------------------
+sal_Bool SAL_CALL AccessibleShape::isAccessibleChildSelected( sal_Int32 nChildIndex ) 
+throw ( IndexOutOfBoundsException, 
+	   RuntimeException )
+{	
+	uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
+	uno::Reference<XAccessibleContext> xContext;
+	if( xAcc.is() )
+	{
+		xContext = xAcc->getAccessibleContext();
+	}
+	
+	if( xContext.is() )
+	{
+		if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+		{
+			uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
+				xText(xAcc, uno::UNO_QUERY);
+			if( xText.is() )
+			{				
+				if( xText->getSelectionStart() >= 0 ) return sal_True;
+			}
+		}
+		else if( xContext->getAccessibleRole() == AccessibleRole::SHAPE )
+		{		    
+			Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
+			if( !pRState.is() )
+				return sal_False;
+			
+			uno::Sequence<short> pStates = pRState->getStates();
+			int nCount = pStates.getLength();
+			for( int i = 0; i < nCount; i++ )
+			{
+				if(pStates[i] == AccessibleStateType::SELECTED)
+					return sal_True;
+			}
+			return sal_False;
+		}
+	}	
+	
+	return sal_False;	
+}
 
+//---------------------------------------------------------------------
+void SAL_CALL AccessibleShape::clearAccessibleSelection(  ) 
+throw ( RuntimeException )
+{
+}
 
+//-------------------------------------------------------------------------
+void SAL_CALL AccessibleShape::selectAllAccessibleChildren(  ) 
+throw ( RuntimeException )
+{
+}
+
+//----------------------------------------------------------------------------
+sal_Int32 SAL_CALL AccessibleShape::getSelectedAccessibleChildCount() 
+throw ( RuntimeException )
+{	
+	sal_Int32 nCount = 0;
+	sal_Int32 TotalCount = getAccessibleChildCount();
+	for( sal_Int32 i = 0; i < TotalCount; i++ )
+		if( isAccessibleChildSelected(i) ) nCount++;
+
+	return nCount;
+}
+
+//--------------------------------------------------------------------------------------
+Reference<XAccessible> SAL_CALL AccessibleShape::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 
+throw ( IndexOutOfBoundsException, RuntimeException)
+{
+	if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
+		throw IndexOutOfBoundsException();
+	sal_Int32 i1, i2;
+	for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
+		if( isAccessibleChildSelected(i1) )
+		{
+			if( i2 == nSelectedChildIndex )
+				return getAccessibleChild( i1 );
+			i2++;
+		}
+	return Reference<XAccessible>();
+}
+
+//----------------------------------------------------------------------------------
+void SAL_CALL AccessibleShape::deselectAccessibleChild( sal_Int32 ) 
+															throw ( IndexOutOfBoundsException, 
+															RuntimeException )
+{    
+	
+}
+
+//=====  XAccessibleExtendedAttributes  ========================================================
+uno::Any SAL_CALL AccessibleShape::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any strRet;
+	::rtl::OUString style;
+	if( getAccessibleRole() != AccessibleRole::SHAPE ) return strRet;
+	if( m_pShape )
+	{        	
+		//style = ::rtl::OUString::createFromAscii("style=");
+		style = ::rtl::OUString::createFromAscii("style:");
+		style += GetStyle();
+	}
+	style += ::rtl::OUString::createFromAscii(";");
+	strRet <<= style;
+	return strRet;
+}
+//-----IAccessibility2 Implementation 2009
 //=====  XServiceInfo  ========================================================
 
 ::rtl::OUString SAL_CALL
@@ -917,6 +1218,11 @@
     {
         if (rEventObject.EventName.equals (sShapeModified))
         {
+			//Need to update text children when receiving ShapeModified hint when exiting edit mode for text box
+			if (mpText)
+				mpText->UpdateChildren();
+
+
             // Some property of a shape has been modified.  Send an event
             // that indicates a change of the visible data to all listeners.
             CommitChange (
@@ -1021,47 +1327,103 @@
     AccessibleShape::CreateAccessibleName (void)
     throw (::com::sun::star::uno::RuntimeException)
 {
-    OUString sName (CreateAccessibleBaseName());
+    //OUString sName (CreateAccessibleBaseName());
+//IAccessibility2 Implementation 2009-----
+	OUString sName;
+	sName = GetFullAccessibleName(this);
+	return sName;
+}
 
+::rtl::OUString
+    AccessibleShape::GetFullAccessibleName (AccessibleShape *shape)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    OUString sName (shape->CreateAccessibleBaseName());
     // Append the shape's index to the name to disambiguate between shapes
     // of the same type.  If such an index where not given to the
     // constructor then use the z-order instead.  If even that does not exist
     // we throw an exception.
-    long nIndex = mnIndex;
-    if (nIndex == -1)
+    //long nIndex = mnIndex;
+    //if (nIndex == -1)
+    //{
+    //    try
+    //    {
+    //        uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
+    //        if (xSet.is())
+    //        {
+    //            uno::Any aZOrder (xSet->getPropertyValue (::rtl::OUString::createFromAscii ("ZOrder")));
+    //            aZOrder >>= nIndex;
+
+    //            // Add one to be not zero based.
+    //            nIndex += 1;
+    //        }
+    //    }
+    //    catch (beans::UnknownPropertyException)
+    //    {
+    //        // We throw our own exception that is a bit more informative.
+    //        throw uno::RuntimeException (::rtl::OUString (
+    //            RTL_CONSTASCII_USTRINGPARAM("AccessibleShape has invalid index and no ZOrder property")),
+    //            static_cast<uno::XWeak*>(this));
+    //    }
+
+    //}
+
+    //// Put a space between name and index because of Gnopernicus othewise
+    //// spells the name.
+    //sName += OUString (RTL_CONSTASCII_USTRINGPARAM(" ")) + OUString::valueOf (nIndex);
+
+    //return sName;
+ 
+	XubString nameStr;
+	if(shape->m_pShape) 
+		nameStr = shape->m_pShape->GetName();
+	if(nameStr.Len() == 0)
+	{
+		sName +=  OUString( RTL_CONSTASCII_USTRINGPARAM( " " ));
+	}
+	else
+	{
+		sName = nameStr;
+	}	
+	/*
+    sal_Int32 nChildCount = shape->getAccessibleChildCount();
+ 	if(nChildCount > 0)
+      {
+	    for (sal_Int32 i=0; i<nChildCount; ++i)
+	    {
+	        Reference<XAccessible> xChild (shape->getAccessibleChild (i));
+	        if (xChild.is())
+	        {
+			uno::Reference <XAccessibleContext> xChildContext(xChild->getAccessibleContext());
+			if (xChildContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+			{
+				uno::Reference<XAccessibleText> xText = uno::Reference<XAccessibleText> ( xChild, uno::UNO_QUERY );
+				sName += OUString( RTL_CONSTASCII_USTRINGPARAM( " " )) + xText->getText();
+			}
+			else if (xChildContext->getAccessibleRole() == AccessibleRole::SHAPE)
+			{
+				sName += OUString( RTL_CONSTASCII_USTRINGPARAM( " " )) + GetFullAccessibleName(static_cast< AccessibleShape*>( xChild.get()));
+			}
+	        }
+	    }
+      }
+	 */
+    //Solution:If the new produced name if not the same with last,notify name changed 
+	//         Event
+    if( aAccName != sName && aAccName.getLength() != 0 )
     {
-        try
-        {
-            uno::Reference<beans::XPropertySet> xSet (mxShape, uno::UNO_QUERY);
-            if (xSet.is())
-            {
-                uno::Any aZOrder (xSet->getPropertyValue (::rtl::OUString::createFromAscii ("ZOrder")));
-                aZOrder >>= nIndex;
-
-                // Add one to be not zero based.
-                nIndex += 1;
-            }
-        }
-        catch (beans::UnknownPropertyException)
-        {
-            // We throw our own exception that is a bit more informative.
-            throw uno::RuntimeException (::rtl::OUString (
-                RTL_CONSTASCII_USTRINGPARAM("AccessibleShape has invalid index and no ZOrder property")),
-                static_cast<uno::XWeak*>(this));
-        }
-
+    	uno::Any aOldValue, aNewValue;
+		aOldValue <<= aAccName;
+		aNewValue <<= sName;
+        CommitChange(
+            AccessibleEventId::NAME_CHANGED,
+            aNewValue,
+            aOldValue);
     }
-
-    // Put a space between name and index because of Gnopernicus othewise
-    // spells the name.
-    sName += OUString (RTL_CONSTASCII_USTRINGPARAM(" ")) + OUString::valueOf (nIndex);
-
-    return sName;
+    aAccName = sName;
+	return sName;    
 }
-
-
-
-
+//-----IAccessibility2 Implementation 2009
 ::rtl::OUString
     AccessibleShape::CreateAccessibleDescription (void)
     throw (::com::sun::star::uno::RuntimeException)
@@ -1233,8 +1595,250 @@
     {
     }
 }
+//IAccessibility2 Implementation 2009-----
+//	Return this object's role.
+sal_Int16 SAL_CALL AccessibleShape::getAccessibleRole (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int16 nAccessibleRole =  AccessibleRole::SHAPE ;		
+	switch (ShapeTypeHandler::Instance().GetTypeId (mxShape))
+    {
+		case     DRAWING_GRAPHIC_OBJECT:                  
+				 nAccessibleRole =  AccessibleRole::GRAPHIC ;				break;
+		case     DRAWING_OLE:                             
+				 nAccessibleRole =  AccessibleRole::EMBEDDED_OBJECT ;		break;	
+
+		default:
+			nAccessibleRole = AccessibleContextBase::getAccessibleRole();
+			break;
+	}
+	
+	return nAccessibleRole;
+}
 
 
+void AccessibleShape::UpdateDocumentAllSelState(Reference<XAccessibleStateSet> &xStateSet)
+{
+	if (mpParent && mpParent->IsDocumentSelAll())
+	{
+		::utl::AccessibleStateSetHelper* pStateSet =
+			static_cast< ::utl::AccessibleStateSetHelper*>(xStateSet.get());
+		pStateSet->AddState (AccessibleStateType::SELECTED);
+			
+		//uno::Any NewValue;
+		//NewValue <<= AccessibleStateType::SELECTED;
+
+		//CommitChange(AccessibleEventId::STATE_CHANGED,NewValue,uno::Any());
+	}
+}
+
+//sort the drawing objects from up to down, from left to right
+struct XShapePosCompareHelper
+{
+    bool operator() ( const uno::Reference<drawing::XShape>& xshape1, 
+        const uno::Reference<drawing::XShape>& xshape2 ) const
+    {        
+        SdrObject* pObj1 = GetSdrObjectFromXShape(xshape1);
+        SdrObject* pObj2 = GetSdrObjectFromXShape(xshape2);		
+        if(pObj1 && pObj2)
+            return pObj1->GetOrdNum() < pObj2->GetOrdNum();
+        else
+            return 0;
+    }
+};
+//end of group position
+
+//=====  XAccessibleGroupPosition  =========================================
+uno::Sequence< sal_Int32 > SAL_CALL
+AccessibleShape::getGroupPosition( const uno::Any& )
+throw (uno::RuntimeException)
+{
+    // we will return the:
+    // [0] group level
+    // [1] similar items counts in the group
+    // [2] the position of the object in the group
+    uno::Sequence< sal_Int32 > aRet( 3 );
+    aRet[0] = 0; 
+    aRet[1] = 0;
+    aRet[2] = 0;
+
+    ::com::sun::star::uno::Reference<XAccessible> xParent = getAccessibleParent();
+    if (!xParent.is())
+    {
+        return aRet;
+    }
+    SdrObject *pObj = GetSdrObjectFromXShape(mxShape);
 
 
+    if(pObj == NULL )
+    {
+        return aRet;
+    }
+	
+    // Compute object's group level.
+    sal_Int32 nGroupLevel = 0;
+    SdrObject * pUper = pObj->GetUpGroup();
+    while( pUper )
+    {
+        ++nGroupLevel;
+        pUper = pUper->GetUpGroup();
+    }
+
+    ::com::sun::star::uno::Reference<XAccessibleContext> xParentContext = xParent->getAccessibleContext();
+    if( xParentContext->getAccessibleRole()  == AccessibleRole::DOCUMENT)//Document
+    {
+        Reference< XAccessibleGroupPosition > xGroupPosition( xParent,uno::UNO_QUERY );
+        if ( xGroupPosition.is() )
+        {
+            aRet = xGroupPosition->getGroupPosition( uno::makeAny( getAccessibleContext() ) );
+        }
+        return aRet;
+    }
+    if (xParentContext->getAccessibleRole() != AccessibleRole::SHAPE)
+    {
+        return aRet;
+    }
+
+	SdrObjList *pGrpList = NULL;
+	if( pObj->GetUpGroup() )
+		pGrpList = pObj->GetUpGroup()->GetSubList();
+	else
+		return aRet;
+
+	std::vector< uno::Reference<drawing::XShape> > vXShapes;
+    if (pGrpList)
+    {	
+        const sal_Int32 nObj = pGrpList->GetObjCount();
+        for(sal_Int32 i = 0 ; i < nObj ; ++i)
+        {
+            SdrObject *pSubObj = pGrpList->GetObj(i);
+			//IAccessibility2 Implementation 2009-----
+            if (pSubObj && 
+				xParentContext->getAccessibleChild(i)->getAccessibleContext()->getAccessibleRole() != AccessibleRole::GROUP_BOX)
+			//-----IAccessibility2 Implementation 2009
+            {
+				vXShapes.push_back( GetXShapeForSdrObject(pSubObj) );
+            }
+        }
+    }
+    
+    std::sort( vXShapes.begin(), vXShapes.end(), XShapePosCompareHelper() );
+
+    //get the the index of the selected object in the group
+    std::vector< uno::Reference<drawing::XShape> >::iterator aIter;
+    //we start counting position from 1
+    sal_Int32 nPos = 1;
+    for ( aIter = vXShapes.begin(); aIter != vXShapes.end(); aIter++, nPos++ )
+    {
+        if ( (*aIter).get() == mxShape.get() )
+        {
+            sal_Int32* pArray = aRet.getArray();
+            pArray[0] = nGroupLevel; 
+            pArray[1] = vXShapes.size();
+            pArray[2] = nPos;
+            break;
+        }
+    }
+
+    return aRet;
+}
+
+::rtl::OUString AccessibleShape::getObjectLink( const uno::Any& )
+	throw (uno::RuntimeException)
+{	
+    ::rtl::OUString aRet;
+
+    SdrObject *pObj = GetSdrObjectFromXShape(mxShape);
+    if(pObj == NULL )
+    {
+        return aRet;
+    }
+	if (maShapeTreeInfo.GetDocumentWindow().is())
+	{
+		Reference< XAccessibleGroupPosition > xGroupPosition( maShapeTreeInfo.GetDocumentWindow(), uno::UNO_QUERY );
+		if (xGroupPosition.is())
+		{
+			aRet = xGroupPosition->getObjectLink( uno::makeAny( getAccessibleContext() ) );
+		}
+	}
+	return aRet;
+}
+
+//=====  XAccesibleHypertext  ==================================================
+sal_Int32 SAL_CALL AccessibleShape::getHyperLinkCount()
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	// MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
+	// Code need to be adapted....
+	return 0;
+	
+	/*
+	SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
+	if (pLink->IsValidHyperlink())
+		return 1;
+	else
+		return 0;
+	*/
+}
+uno::Reference< XAccessibleHyperlink > SAL_CALL 
+	AccessibleShape::getHyperLink( sal_Int32 )
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	uno::Reference< XAccessibleHyperlink > xRet;
+	// MT: Introduced with IA2 CWS, but SvxAccessibleHyperlink was redundant to svx::AccessibleHyperlink which we introduced meanwhile.
+	// Code need to be adapted....
+	/*		
+	SvxAccessibleHyperlink* pLink = new SvxAccessibleHyperlink(m_pShape,this);
+	if (pLink->IsValidHyperlink())
+		xRet = pLink;
+	if( !xRet.is() )
+		throw ::com::sun::star::lang::IndexOutOfBoundsException();
+	*/
+	return xRet;
+}
+sal_Int32 SAL_CALL AccessibleShape::getHyperLinkIndex( sal_Int32 )
+throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 nRet = 0;	
+	return nRet;
+}
+//=====  XAccesibleText  ==================================================
+sal_Int32 SAL_CALL AccessibleShape::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL AccessibleShape::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+sal_Unicode SAL_CALL AccessibleShape::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL AccessibleShape::getCharacterAttributes( sal_Int32, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	uno::Sequence< ::com::sun::star::beans::PropertyValue > aValues(0);
+	return aValues;
+}
+::com::sun::star::awt::Rectangle SAL_CALL AccessibleShape::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
+}
+sal_Int32 SAL_CALL AccessibleShape::getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL AccessibleShape::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+::rtl::OUString SAL_CALL AccessibleShape::getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+sal_Int32 SAL_CALL AccessibleShape::getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL AccessibleShape::getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL AccessibleShape::setSelection( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+::rtl::OUString SAL_CALL AccessibleShape::getText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+::rtl::OUString SAL_CALL AccessibleShape::getTextRange( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
+::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextAtIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+	return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+    return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL AccessibleShape::getTextBehindIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+    return aResult;
+}
+sal_Bool SAL_CALL AccessibleShape::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+
+//-----IAccessibility2 Implementation 2009
 } // end of namespace accessibility
diff --git a/main/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx b/main/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
new file mode 100644
index 0000000..839b95a
--- /dev/null
+++ b/main/svx/source/accessibility/AccessibleSvxFindReplaceDialog.cxx
@@ -0,0 +1,120 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#include <svx/AccessibleSvxFindReplaceDialog.hxx>
+
+
+#ifndef _TOOLKIT_AWT_VCLXWINDOW_HXX_
+#include "toolkit/awt/vclxwindow.hxx"
+#endif
+
+#ifndef _SVX_SRCHDLG_HXX
+#include <svx/srchdlg.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
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
+#endif
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+
+VCLXAccessibleSvxFindReplaceDialog::VCLXAccessibleSvxFindReplaceDialog(VCLXWindow* pVCLXindow)
+	:VCLXAccessibleComponent( pVCLXindow )
+{
+
+}
+
+VCLXAccessibleSvxFindReplaceDialog::~VCLXAccessibleSvxFindReplaceDialog()
+{
+}
+
+void VCLXAccessibleSvxFindReplaceDialog::FillAccessibleRelationSet( utl::AccessibleRelationSetHelper& rRelationSet )
+{
+	VCLXAccessibleComponent::FillAccessibleRelationSet( rRelationSet );
+	Window* pDlg = GetWindow();
+	if ( pDlg )
+	{
+		SvxSearchDialog* pSrchDlg = static_cast<SvxSearchDialog*>( pDlg );
+		Window* pDocWin = pSrchDlg->GetDocWin();
+		if ( !pDocWin )
+		{
+			return;
+		}
+		Reference < accessibility::XAccessible > xDocAcc = pDocWin->GetAccessible();
+		if ( !xDocAcc.is() )
+		{
+			return;
+		}
+		Reference< accessibility::XAccessibleGetAccFlowTo > xGetAccFlowTo( xDocAcc, UNO_QUERY );
+		if ( !xGetAccFlowTo.is() )
+		{
+			return;
+		}
+		Any aAny;
+		aAny <<= ( pSrchDlg->GetSrchFlag() );
+
+		const sal_Int32 FORFINDREPLACEFLOWTO = 2;
+		uno::Sequence<uno::Any> aAnySeq = xGetAccFlowTo->get_AccFlowTo( aAny,  FORFINDREPLACEFLOWTO );
+		
+		sal_Int32 nLen = aAnySeq.getLength();
+		if ( nLen )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence( nLen );
+			for ( sal_Int32 i = 0; i < nLen; i++ )
+			{
+				uno::Reference < accessibility::XAccessible > xAcc;
+				aAnySeq[i] >>= xAcc;
+				aSequence[i] = xAcc;
+			}
+			rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aSequence ) );
+		}	
+	}
+}
+// -----------------------------------------------------------------------------
+// XServiceInfo
+// -----------------------------------------------------------------------------
+
+::rtl::OUString VCLXAccessibleSvxFindReplaceDialog::getImplementationName() throw (RuntimeException)
+{
+	return ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" );	
+}
+
+// -----------------------------------------------------------------------------
+
+Sequence< ::rtl::OUString > VCLXAccessibleSvxFindReplaceDialog::getSupportedServiceNames() throw (RuntimeException)
+{
+	Sequence< ::rtl::OUString > aNames(1);
+	aNames[0] = ::rtl::OUString::createFromAscii( "VCLXAccessibleSvxFindReplaceDialog" );
+	return aNames;
+}
diff --git a/main/svx/source/accessibility/AccessibleTextHelper.cxx b/main/svx/source/accessibility/AccessibleTextHelper.cxx
index ea2f2bf..f7af8c3 100644
--- a/main/svx/source/accessibility/AccessibleTextHelper.cxx
+++ b/main/svx/source/accessibility/AccessibleTextHelper.cxx
@@ -50,7 +50,15 @@
 #include <unotools/accessiblestatesethelper.hxx>
 #include <vcl/unohelp.hxx>
 #include <vcl/svapp.hxx>
+//IAccessibility2 Implementation 2009-----
+//add TEXT_SELECTION_CHANGED event
+#ifndef _TEXTDATA_HXX
+#include <svtools/textdata.hxx>
+#endif
 
+#include <sfx2/viewfrm.hxx>
+#include <sfx2/viewsh.hxx>
+//-----IAccessibility2 Implementation 2009
 //------------------------------------------------------------------------
 //
 // Project-local header
@@ -68,6 +76,10 @@
 #include "editeng/AccessibleEditableTextPara.hxx"
 #include <svx/svdmodel.hxx>
 #include <svx/svdpntv.hxx>
+//IAccessibility2 Implementation 2009-----
+#include "../table/cell.hxx"
+#include "../table/accessiblecell.hxx"
+//-----IAccessibility2 Implementation 2009
 #include <editeng/editdata.hxx>
 #include <editeng/editeng.hxx>
 #include <editeng/editview.hxx>
@@ -77,6 +89,22 @@
 
 namespace accessibility
 {
+//IAccessibility2 Implementation 2009-----
+	Window* GetCurrentEditorWnd()
+	{
+		Window* pWin = NULL;
+		SfxViewFrame* pFrame = SfxViewFrame::Current();
+		if (pFrame)
+		{
+			const SfxViewShell * pViewShell = pFrame->GetViewShell();
+			if(pViewShell)
+			{
+				pWin = pViewShell->GetWindow();
+			}
+		}
+		return pWin;
+	}
+//-----IAccessibility2 Implementation 2009
 
 //------------------------------------------------------------------------
 //
@@ -484,12 +512,38 @@
         {
             if( bHaveFocus )
             {
-                GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+				//IAccessibility2 Implementation 2009-----
+				if( mxFrontEnd.is() )
+				{
+					AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
+					if ( !pAccessibleCell )
+						GotPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+					else	// the focus event on cell should be fired on table directly
+					{
+						AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable();
+						if (pAccTable)
+							pAccTable->SetStateDirectly(AccessibleStateType::FOCUSED);
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
                 DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object received focus" );
             }
             else
             {
-                LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+                // The focus state should be reset directly on table.
+                //LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+                if( mxFrontEnd.is() )
+                {
+                	AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
+                	if ( !pAccessibleCell )
+                        	LostPropertyEvent( uno::makeAny(AccessibleStateType::FOCUSED), AccessibleEventId::STATE_CHANGED );
+                	else
+                	{
+                       		AccessibleTableShape* pAccTable = pAccessibleCell->GetParentTable();
+                       		if (pAccTable)
+                       			pAccTable->ResetStateDirectly(AccessibleStateType::FOCUSED);
+                	}
+                }
                 DBG_TRACE("AccessibleTextHelper_Impl::SetShapeFocus(): Parent object lost focus" );
             }
         }
@@ -543,6 +597,18 @@
             if( !pViewForwarder )
                 return sal_False;
 
+			//IAccessibility2 Implementation 2009-----
+			if( mxFrontEnd.is() )
+			{
+				AccessibleCell* pAccessibleCell = dynamic_cast< AccessibleCell* > ( mxFrontEnd.get() );
+				if ( pAccessibleCell )
+				{
+					sdr::table::CellRef xCell = pAccessibleCell->getCellRef();
+					if ( xCell.is() )
+						return xCell->IsTextEditActive();
+				}
+			}
+			//-----IAccessibility2 Implementation 2009
             if( pViewForwarder->IsValid() )
                 return sal_True;
             else
@@ -861,9 +927,12 @@
 
                 // convert to screen coordinates
                 aParaBB = ::accessibility::AccessibleEditableTextPara::LogicToPixel( aTmpBB, rCacheTF.GetMapMode(), rCacheVF );
-
+		//IAccessibility2 Implementation 2009-----
+				/*
                 if( aParaBB.IsOver( aViewArea ) )
                 {
+                */
+				//-----IAccessibility2 Implementation 2009
                     // at least partially visible
                     if( bFirstChild )
                     {
@@ -884,6 +953,8 @@
                                                                                    mxFrontEnd, GetEditSource(), nCurrPara ).first ),
                                           AccessibleEventId::CHILD );
                     }
+		    //IAccessibility2 Implementation 2009-----
+				/*
                 }
                 else
                 {
@@ -897,7 +968,8 @@
                         // clear reference
                         maParaManager.Release( nCurrPara );
                     }
-                }
+                }*/
+				//-----IAccessibility2 Implementation 2009
             }
         }
         catch( const uno::Exception& )
@@ -1376,6 +1448,12 @@
                         {
                             case HINT_BEGEDIT:
                             {
+			    //IAccessibility2 Implementation 2009-----
+								if(!IsActive())
+								{
+									break;
+								}
+//-----IAccessibility2 Implementation 2009
                                 // change children state
                                 maParaManager.SetActive();
 
diff --git a/main/svx/source/accessibility/ChildrenManager.cxx b/main/svx/source/accessibility/ChildrenManager.cxx
index 00df72a..1aba1e6 100644
--- a/main/svx/source/accessibility/ChildrenManager.cxx
+++ b/main/svx/source/accessibility/ChildrenManager.cxx
@@ -86,7 +86,22 @@
     return mpImpl->GetChild (nIndex);
 }
 
+//IAccessibility2 Implementation 2009-----
+Reference<XAccessible> ChildrenManager::GetChild (const Reference<drawing::XShape>& xShape)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    OSL_ASSERT (mpImpl != NULL);
+    return mpImpl->GetChild (xShape);
+}
 
+::com::sun::star::uno::Reference<
+        ::com::sun::star::drawing::XShape> ChildrenManager::GetChildShape(long nIndex)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+	OSL_ASSERT (mpImpl != NULL);
+    return mpImpl->GetChildShape(nIndex);
+}
+//-----IAccessibility2 Implementation 2009
 
 
 void ChildrenManager::Update (bool bCreateNewObjectsOnDemand)
diff --git a/main/svx/source/accessibility/ChildrenManagerImpl.cxx b/main/svx/source/accessibility/ChildrenManagerImpl.cxx
index 3142ebd..4359f25 100644
--- a/main/svx/source/accessibility/ChildrenManagerImpl.cxx
+++ b/main/svx/source/accessibility/ChildrenManagerImpl.cxx
@@ -37,7 +37,18 @@
 
 #include <rtl/ustring.hxx>
 #include <tools/debug.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+#include <svx/SvxShapeTypes.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/unohlp.hxx>
+#endif
 
+#ifndef _SV_WINDOW_HXX
+#include <vcl/window.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 using ::com::sun::star::uno::Reference;
@@ -117,7 +128,21 @@
 }
 
 
-
+//IAccessibility2 Implementation 2009-----
+::com::sun::star::uno::Reference<
+        ::com::sun::star::drawing::XShape> ChildrenManagerImpl::GetChildShape(long nIndex)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+	uno::Reference<XAccessible> xAcc = GetChild(nIndex);
+	ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
+    for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+    {
+        if (I->mxAccessibleShape == xAcc)
+            return I->mxShape;
+    }
+	return uno::Reference< drawing::XShape > ();
+}
+//-----IAccessibility2 Implementation 2009
 
 /** Return the requested accessible child object.  Create it if it is not
     yet in the cache.
@@ -871,9 +896,36 @@
 
     return bResult;
 }
-
-
-
+//IAccessibility2 Implementation 2009-----
+// Add the impl method for IAccessibleParent interface
+AccessibleControlShape * ChildrenManagerImpl::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 count = GetChildCount();
+	for (sal_Int32 index=0;index<count;index++)
+	{
+		AccessibleShape* pAccShape = maVisibleChildren[index].GetAccessibleShape();
+      	 	if (pAccShape  && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == DRAWING_CONTROL)
+      	  	{
+			::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+			if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+				return pCtlAccShape;
+            	}
+	}
+	return NULL;
+}
+uno::Reference<XAccessible>
+    ChildrenManagerImpl::GetAccessibleCaption (const uno::Reference<drawing::XShape>& xShape)
+    throw (uno::RuntimeException)
+{
+    ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
+    for (I = maVisibleChildren.begin(); I != aEnd; ++I)
+    {
+        if ( I->mxShape.get() == xShape.get() )
+            return I->mxAccessibleShape;
+    }
+    return uno::Reference<XAccessible> ();
+}
+//-----IAccessibility2 Implementation 2009
 
 /** Update the <const>SELECTED</const> and the <const>FOCUSED</const> state
     of all visible children.  Maybe this should be changed to all children.
@@ -906,13 +958,30 @@
     // Remember the current and new focused shape.
     AccessibleShape* pCurrentlyFocusedShape = NULL;
     AccessibleShape* pNewFocusedShape = NULL;
-
+//IAccessibility2 Implementation 2009-----
+	typedef std::pair< AccessibleShape* , sal_Bool > PAIR_SHAPE;//sal_Bool Selected,UnSelected.
+	typedef std::vector< PAIR_SHAPE > VEC_SHAPE;
+	VEC_SHAPE vecSelect;
+	int nAddSelect=0;
+	int nRemoveSelect=0;
+	sal_Bool bHasSelectedShape=sal_False;
+//-----IAccessibility2 Implementation 2009
     ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
     for (I=maVisibleChildren.begin(); I != aEnd; ++I)
     {
         AccessibleShape* pAccessibleShape = I->GetAccessibleShape();
         if (I->mxAccessibleShape.is() && I->mxShape.is() && pAccessibleShape!=NULL)
         {
+	//IAccessibility2 Implementation 2009-----
+			short nRole = pAccessibleShape->getAccessibleRole();
+			bool bDrawShape = (
+				nRole == AccessibleRole::GRAPHIC || 
+				nRole == AccessibleRole::EMBEDDED_OBJECT || 
+				nRole == AccessibleRole::SHAPE || 
+				nRole == AccessibleRole::IMAGE_MAP || 
+				nRole == AccessibleRole::TABLE_CELL || 
+				nRole == AccessibleRole::TABLE );
+//-----IAccessibility2 Implementation 2009
             bool bShapeIsSelected = false;
 
             // Look up the shape in the (single or multi-) selection.
@@ -939,16 +1008,42 @@
 
             // Set or reset the SELECTED state.
             if (bShapeIsSelected)
-                pAccessibleShape->SetState (AccessibleStateType::SELECTED);
+	    //IAccessibility2 Implementation 2009-----
+                //pAccessibleShape->SetState (AccessibleStateType::SELECTED);
+			{
+				if (pAccessibleShape->SetState (AccessibleStateType::SELECTED))
+				{
+					if (bDrawShape)
+					{
+						vecSelect.push_back(std::make_pair(pAccessibleShape,sal_True));
+						++nAddSelect;
+					}
+				}
+				else
+				{//Selected not change,has selected shape before
+					bHasSelectedShape=sal_True;
+				}
+			}
             else
-                pAccessibleShape->ResetState (AccessibleStateType::SELECTED);
-
+                //pAccessibleShape->ResetState (AccessibleStateType::SELECTED);
+			{
+                if(pAccessibleShape->ResetState (AccessibleStateType::SELECTED))
+				{
+					if(bDrawShape)
+					{
+						vecSelect.push_back(std::make_pair(pAccessibleShape,sal_False));
+						++nRemoveSelect;
+					}
+				}
+			}
+//-----IAccessibility2 Implementation 2009
             // Does the shape have the current selection?
             if (pAccessibleShape->GetState (AccessibleStateType::FOCUSED))
                 pCurrentlyFocusedShape = pAccessibleShape;
         }
     }
-
+//IAccessibility2 Implementation 2009-----
+    /*
     // Check if the frame we are in is currently active.  If not then make
     // sure to not send a FOCUSED state change.
     if (xController.is())
@@ -958,15 +1053,73 @@
             if ( ! xFrame->isActive())
                 pNewFocusedShape = NULL;
     }
-
+    */
+	Window *pParentWidow = maShapeTreeInfo.GetWindow();
+	bool bShapeActive= false;
+	// For table cell, the table's parent must be checked to make sure it has focus. 
+	Window *pPWindow = pParentWidow->GetParent();
+	if (pParentWidow && ( pParentWidow->HasFocus() || (pPWindow && pPWindow->HasFocus())))
+	{
+		bShapeActive =true;
+	}
+//-----IAccessibility2 Implementation 2009
     // Move focus from current to newly focused shape.
     if (pCurrentlyFocusedShape != pNewFocusedShape)
     {
         if (pCurrentlyFocusedShape != NULL)
             pCurrentlyFocusedShape->ResetState (AccessibleStateType::FOCUSED);
-        if (pNewFocusedShape != NULL)
+	    //IAccessibility2 Implementation 2009-----
+        //if (pNewFocusedShape != NULL)
+	//-----IAccessibility2 Implementation 2009
+	if (pNewFocusedShape != NULL && bShapeActive)
             pNewFocusedShape->SetState (AccessibleStateType::FOCUSED);
-    }
+	}
+//IAccessibility2 Implementation 2009-----
+
+	if (nAddSelect >= 10 )//fire selection  within 
+	{
+		mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_WITHIN,uno::Any(),uno::Any());
+		nAddSelect =0 ;//not fire selection event
+	}
+	//VEC_SHAPE::iterator vi = vecSelect.begin();
+	//for (; vi != vecSelect.end() ;++vi)
+	VEC_SHAPE::reverse_iterator vi = vecSelect.rbegin();
+	for (; vi != vecSelect.rend() ;++vi)
+
+	{
+		PAIR_SHAPE &pairShape= *vi;
+		Reference< XAccessible > xShape(pairShape.first);
+		uno::Any anyShape;
+		anyShape <<= xShape;
+
+		if (pairShape.second)//Selection add
+		{
+			if (bHasSelectedShape)
+			{
+				if (  nAddSelect > 0 )
+				{
+					mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD,anyShape,uno::Any());
+				}				
+			}
+			else
+			{
+				//if has not selected shape ,first selected shape is fire selection event;
+				if (nAddSelect > 0 )
+				{
+					mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED,anyShape,uno::Any());
+				}
+				if (nAddSelect > 1 )//check other selected shape fire selection add event
+				{
+					bHasSelectedShape=sal_True;
+				}
+			}
+		}
+		else //selection remove
+		{
+			mrContext.CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE,anyShape,uno::Any());
+		}
+	}
+//-----IAccessibility2 Implementation 2009
 
     // Remember whether there is a shape that now has the focus.
     mpFocusedShape = pNewFocusedShape;
diff --git a/main/svx/source/accessibility/ChildrenManagerImpl.hxx b/main/svx/source/accessibility/ChildrenManagerImpl.hxx
index 731b67d..9af96cd 100644
--- a/main/svx/source/accessibility/ChildrenManagerImpl.hxx
+++ b/main/svx/source/accessibility/ChildrenManagerImpl.hxx
@@ -126,6 +126,11 @@
     */
     long GetChildCount (void) const throw ();
 
+//IAccessibility2 Implementation 2009-----
+	::com::sun::star::uno::Reference<
+        ::com::sun::star::drawing::XShape> GetChildShape(long nIndex)
+		throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
     /**	Return the requested accessible child or throw and
         IndexOutOfBoundsException if the given index is invalid.
         @param nIndex
@@ -298,8 +303,17 @@
 		const long _nIndex,
 		const AccessibleShapeTreeInfo& _rShapeTreeInfo
 	)	throw (::com::sun::star::uno::RuntimeException);
-
-
+	//IAccessibility2 Implementation 2009-----
+    // Add the impl method for IAccessibleParent interface
+    virtual AccessibleControlShape* GetAccControlShapeFromModel
+		(::com::sun::star::beans::XPropertySet* pSet) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>
+        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
+            ::com::sun::star::drawing::XShape>& xShape)
+        throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 protected:
     /** This list holds the descriptors of all currently visible shapes and
         associated accessible object.
diff --git a/main/svx/source/accessibility/ShapeTypeHandler.cxx b/main/svx/source/accessibility/ShapeTypeHandler.cxx
index 8e72f70..c78c88b 100644
--- a/main/svx/source/accessibility/ShapeTypeHandler.cxx
+++ b/main/svx/source/accessibility/ShapeTypeHandler.cxx
@@ -31,8 +31,14 @@
 #include <vos/mutex.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/dialmgr.hxx>
-#include "svx/svdstr.hrc"
 
+//IAccessibility2 Implementation 2009-----
+#include <svx/unoshape.hxx>
+#include <svx/svdoashp.hxx>
+#include "svx/unoapi.hxx"
+//-----IAccessibility2 Implementation 2009
+
+#include "svx/svdstr.hrc"
 
 using namespace ::rtl;
 using namespace ::com::sun::star;
@@ -309,6 +315,37 @@
         case DRAWING_RECTANGLE:
             nResourceId = STR_ObjNameSingulRECT;
             break;
+		//IAccessibility2 Implementation 2009-----
+        case DRAWING_CUSTOM:
+			{
+				nResourceId = STR_ObjNameSingulCUSTOMSHAPE;
+
+				SvxShape* pShape = SvxShape::getImplementation( rxShape );
+				if (pShape)
+				{					
+					SdrObject *pSdrObj = pShape->GetSdrObject();
+					if (pSdrObj)
+					{
+						String aTmp;
+						pSdrObj->TakeObjNameSingul( aTmp );
+
+						if(pSdrObj->ISA(SdrObjCustomShape))
+						{
+							SdrObjCustomShape* pCustomShape = (SdrObjCustomShape*)pSdrObj;
+							if(pCustomShape)
+								if (pCustomShape->IsTextPath())
+					 				nResourceId = STR_ObjNameSingulFONTWORK;
+								else
+								{
+									nResourceId = -1;
+									sName = pCustomShape->GetCustomShapeName();
+								}
+						}
+					}
+				}
+                break;
+			}
+		//-----IAccessibility2 Implementation 2009
         case DRAWING_TEXT:
             nResourceId = STR_ObjNameSingulTEXT;
             break;
diff --git a/main/svx/source/accessibility/charmapacc.cxx b/main/svx/source/accessibility/charmapacc.cxx
index 538fb08..36dc601 100644
--- a/main/svx/source/accessibility/charmapacc.cxx
+++ b/main/svx/source/accessibility/charmapacc.cxx
@@ -166,7 +166,8 @@
 // -----------------------------------------------------------------------------
 ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetVirtualAcc::implGetBounds(  ) throw (RuntimeException)
 {
-	const Point   aOutPos( mpParent->GetPosPixel() );
+//IAccessibility2 Implementation 2009-----
+/*	const Point   aOutPos( mpParent->GetPosPixel() );
     Size          aOutSize( mpParent->GetOutputSizePixel() );
 	if ( mpParent->getScrollBar()->IsVisible() )
 	{
@@ -183,6 +184,24 @@
     aRet.Height = aOutSize.Height();
 
     return aRet;
+*/ 
+	::com::sun::star::awt::Rectangle aBounds ( 0, 0, 0, 0 );
+	Window* pWindow = mpParent;
+	if ( pWindow )
+	{
+		Rectangle aRect = pWindow->GetWindowExtentsRelative( NULL );
+		aBounds = AWTRectangle( aRect );
+		Window* pParent = pWindow->GetAccessibleParentWindow();
+		if ( pParent )
+		{
+			Rectangle aParentRect = pParent->GetWindowExtentsRelative( NULL );
+			::com::sun::star::awt::Point aParentScreenLoc = AWTPoint( aParentRect.TopLeft() );
+			aBounds.X -= aParentScreenLoc.X;
+			aBounds.Y -= aParentScreenLoc.Y;
+		}
+	}
+	return aBounds;
+	//-----IAccessibility2 Implementation 2009
 }
 // -----------------------------------------------------------------------------
 sal_Int16 SAL_CALL SvxShowCharSetVirtualAcc::getAccessibleRole(  ) throw (RuntimeException)
@@ -346,13 +365,15 @@
 // -----------------------------------------------------------------------------
 ::com::sun::star::awt::Rectangle SAL_CALL SvxShowCharSetAcc::implGetBounds(  ) throw (RuntimeException)
 {
-	const Point   aOutPos( m_pParent->getCharSetControl()->GetPosPixel() );
+//IAccessibility2 Implementation 2009-----
+	const Point   aOutPos;//( m_pParent->getCharSetControl()->GetPosPixel() ); 
     Size          aOutSize( m_pParent->getCharSetControl()->GetOutputSizePixel());
 	if ( m_pParent->getCharSetControl()->getScrollBar()->IsVisible() )
 	{
 		const Size aScrollBar = m_pParent->getCharSetControl()->getScrollBar()->GetOutputSizePixel();
 		aOutSize.Width() -= aScrollBar.Width();
-		aOutSize.Height() -= aScrollBar.Height();
+		//aOutSize.Height() -= aScrollBar.Height(); 
+		//-----IAccessibility2 Implementation 2009
 	}
 
     awt::Rectangle aRet;
@@ -694,7 +715,10 @@
 sal_Int16 SAL_CALL SvxShowCharSetItemAcc::getAccessibleRole()
     throw (uno::RuntimeException)
 {
-    return accessibility::AccessibleRole::LABEL;
+    //return accessibility::AccessibleRole::LABEL;
+//IAccessibility2 Implementation 2009-----
+    return accessibility::AccessibleRole::TABLE_CELL;
+//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------------
@@ -709,14 +733,30 @@
 	sal_Unicode c = mpParent->maText.GetChar(0);
 	char buf[16] = "0x0000";
     sal_Unicode c_Shifted = c;
+//IAccessibility2 Implementation 2009-----
+/*
     for( int i = 0; i < 4; ++i )
     {
         char h = (char)(c_Shifted & 0x0F);
         buf[5-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
         c_Shifted >>= 4;
     }
+*/
+	int tmp_len = 4;
+	if(c_Shifted>0xFFFF) tmp_len = 8;
+    for( int i = 0; i < tmp_len; ++i )
+    {
+        char h = c_Shifted & 0x0F;
+        //buf[9-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
+		buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0');
+        c_Shifted >>= 4;
+    }
+//-----IAccessibility2 Implementation 2009
     if( c < 256 )
         snprintf( buf+6, 10, " (%d)", c );
+	//IAccessibility2 Implementation 2009-----
+	sDescription.AppendAscii(" ");
+	//-----IAccessibility2 Implementation 2009
 	sDescription.AppendAscii(buf);
 
     return sDescription;
@@ -762,9 +802,15 @@
 
     if( mpParent )
     {
-	    // SELECTABLE
-	    pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
-	    pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
+    //IAccessibility2 Implementation 2009-----
+		if(mpParent->mrParent.IsEnabled())
+		{
+			pStateSet->AddState( accessibility::AccessibleStateType::ENABLED );
+			// SELECTABLE
+			pStateSet->AddState( accessibility::AccessibleStateType::SELECTABLE );
+			pStateSet->AddState( accessibility::AccessibleStateType::FOCUSABLE );
+		}
+		//-----IAccessibility2 Implementation 2009
 
 	    // SELECTED
         if( mpParent->mrParent.GetSelectIndexId() == mpParent->mnId )
@@ -773,7 +819,12 @@
        	    pStateSet->AddState( accessibility::AccessibleStateType::FOCUSED );
         }
 		if ( mpParent->mnId >= mpParent->mrParent.FirstInView() && mpParent->mnId <= mpParent->mrParent.LastInView() )
+		//IAccessibility2 Implementation 2009-----
+		{
 			pStateSet->AddState( AccessibleStateType::VISIBLE );
+			pStateSet->AddState( AccessibleStateType::SHOWING );
+		}
+		//-----IAccessibility2 Implementation 2009
 		pStateSet->AddState( AccessibleStateType::TRANSIENT );
     }
 
diff --git a/main/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx b/main/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
new file mode 100644
index 0000000..93fb30f
--- /dev/null
+++ b/main/svx/source/accessibility/svxpixelctlaccessiblecontext.cxx
@@ -0,0 +1,1281 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#endif
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX_
+#include <unotools/accessiblestatesethelper.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+
+#ifndef	_COM_SUN_STAR_BEANS_PROPERTYCHANGEEVENT_HPP_
+#include <com/sun/star/beans/PropertyChangeEvent.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_AWT_XWINDOW_HPP_
+#include <com/sun/star/awt/XWindow.hpp>
+#endif
+
+#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
+#include <cppuhelper/typeprovider.hxx>
+#endif
+
+#ifndef _TOOLKIT_HELPER_VCLUNOHELPER_HXX_
+#include <toolkit/helper/vclunohelper.hxx>
+#endif
+#ifndef _TOOLKIT_HELPER_CONVERT_HXX_
+#include <toolkit/helper/convert.hxx>
+#endif
+
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_UUID_H_
+#include <rtl/uuid.h>
+#endif
+#ifndef _TOOLS_DEBUG_HXX
+#include <tools/debug.hxx>
+#endif
+#ifndef _SV_GEN_HXX
+#include <tools/gen.hxx>
+#endif
+
+#include <svx/dialogs.hrc>
+#include "accessibility.hrc"
+#include <svx/dlgctrl.hxx>
+
+#ifndef _SVX_DIALMGR_HXX
+#include <svx/dialmgr.hxx>
+#endif
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#include <comphelper/accessibleeventnotifier.hxx>
+#endif
+
+#include <unotools/accessiblerelationsethelper.hxx>
+
+#ifndef _SVXPIXELACCESSIBLECONTEXT_HXX
+#include "svxpixelctlaccessiblecontext.hxx"
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
+using namespace ::cppu;
+using namespace ::osl;
+using namespace	::rtl;
+using namespace	::com::sun::star;
+using namespace	::com::sun::star::uno;
+using namespace	::com::sun::star::accessibility;
+
+SvxPixelCtlAccessible::SvxPixelCtlAccessible( SvxPixelCtl& rControl) :
+	SvxPixelCtlAccessible_BASE(m_aMutex),
+    pPixelCtl(&rControl),
+    mnClientId(0)
+{
+    //FreeResource();
+}
+
+SvxPixelCtlAccessible::~SvxPixelCtlAccessible()
+{
+//	DBG_DTOR( SvxPixelCtlAccessible, NULL );
+
+	if( IsAlive() )
+	{
+		osl_incrementInterlockedCount( &m_refCount );
+		dispose();		// set mpRepr = NULL & release all childs
+	}
+}
+/*-- 04.02.2002 14:11:55---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+uno::Reference< XAccessibleContext > SvxPixelCtlAccessible::getAccessibleContext(  )
+    throw (uno::RuntimeException)
+{
+    return this;
+}
+
+sal_Int32 SvxPixelCtlAccessible::getAccessibleChildCount(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+	if(pPixelCtl)
+	{
+	    return pPixelCtl->GetSquares();
+	}
+	else
+		return 0;
+}
+/*-- 04.02.2002 14:11:56---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleChild( sal_Int32 i )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    if ( i < 0 || i >= getAccessibleChildCount())
+	throw lang::IndexOutOfBoundsException();
+    uno::Reference <XAccessible> xAcc;
+    if(pPixelCtl)
+	{
+		return CreateChild(i, pPixelCtl->IndexToPoint(i));
+	}
+    else
+		return xAcc;
+    /*
+    throw lang::IndexOutOfBoundsException (
+        ::rtl::OUString::createFromAscii ("no child with index " + i),
+		NULL);
+    */		
+}
+
+
+
+uno::Reference< XAccessible > SvxPixelCtlAccessible::getAccessibleParent(  )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    uno::Reference< XAccessible > xRet;
+    if(pPixelCtl)
+	    xRet = pPixelCtl->GetParent()->GetAccessible( sal_True );
+    return xRet;
+}
+
+sal_Int32 SvxPixelCtlAccessible::getAccessibleIndexInParent(  )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    sal_uInt16 nIdx = 0;
+    if(pPixelCtl)
+    {
+        Window* pTabPage = pPixelCtl->GetParent();
+        sal_uInt16 nChildren = pTabPage->GetChildCount();
+        for(nIdx = 0; nIdx < nChildren; nIdx++)
+            if(pTabPage->GetChild( nIdx ) == pPixelCtl)
+                break;
+    }
+    return nIdx;
+}
+/*-- 04.02.2002 14:11:57---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+sal_Int16 SvxPixelCtlAccessible::getAccessibleRole(  ) throw (uno::RuntimeException)
+{
+    return AccessibleRole::LIST;
+}
+
+::rtl::OUString SvxPixelCtlAccessible::getAccessibleDescription(  )
+    throw (uno::RuntimeException)
+{
+
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    if(pPixelCtl)
+	return pPixelCtl->GetAccessibleDescription();
+    else
+	return String();
+
+}
+
+::rtl::OUString SvxPixelCtlAccessible::getAccessibleName(  )
+    throw (uno::RuntimeException)
+{
+	
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    if(pPixelCtl)
+	    return pPixelCtl->GetAccessibleName();
+    else
+	    return String();
+
+}
+
+uno::Reference< XAccessibleRelationSet > SvxPixelCtlAccessible::getAccessibleRelationSet(  )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+	Window* pWindow = (Window*)pPixelCtl;
+	utl::AccessibleRelationSetHelper* rRelationSet = new utl::AccessibleRelationSetHelper;
+	uno::Reference< accessibility::XAccessibleRelationSet > rSet = rRelationSet;
+	if ( pWindow )
+	{
+		Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+		if ( pLabeledBy && pLabeledBy != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pLabeledBy->GetAccessible();
+			rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+		}
+
+		Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+		if ( pMemberOf && pMemberOf != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pMemberOf->GetAccessible();
+			rRelationSet->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+		return rSet;
+	}
+    
+    return new utl::AccessibleRelationSetHelper;
+}
+
+
+uno::Reference< XAccessibleStateSet > SvxPixelCtlAccessible::getAccessibleStateSet(  )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    utl::AccessibleStateSetHelper* pStateSetHelper = new utl::AccessibleStateSetHelper;
+    uno::Reference< XAccessibleStateSet > xRet = pStateSetHelper;
+	
+    if(!pPixelCtl)
+        pStateSetHelper->AddState(AccessibleStateType::DEFUNC);
+    else
+    {
+        const sal_Int16 aStandardStates[] =
+        {
+            AccessibleStateType::FOCUSABLE,
+				AccessibleStateType::SELECTABLE,
+				AccessibleStateType::SHOWING,
+				AccessibleStateType::VISIBLE,
+				AccessibleStateType::OPAQUE,
+				0};
+			
+			sal_Int16 nState = 0;
+			while(aStandardStates[nState])
+			{
+				pStateSetHelper->AddState(aStandardStates[nState++]);
+			}
+			if(pPixelCtl->IsEnabled())
+				pStateSetHelper->AddState(AccessibleStateType::ENABLED);
+			if(pPixelCtl->HasFocus())
+				pStateSetHelper->AddState(AccessibleStateType::FOCUSED);
+			pStateSetHelper->AddState(AccessibleStateType::MANAGES_DESCENDANTS);	
+    }
+    return xRet;
+}
+
+
+com::sun::star::lang::Locale SvxPixelCtlAccessible::getLocale(  )
+    throw (IllegalAccessibleComponentStateException, uno::RuntimeException)
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	if( getAccessibleParent().is() )
+    {
+    	uno::Reference< XAccessibleContext >		xParentContext( getAccessibleParent()->getAccessibleContext() );
+        if( xParentContext.is() )
+	    	return xParentContext->getLocale();
+    }
+
+    //	No locale and no parent.  Therefore throw exception to indicate this
+    //	cluelessness.
+    throw IllegalAccessibleComponentStateException();
+}
+
+
+sal_Bool SvxPixelCtlAccessible::containsPoint( const awt::Point& aPt )
+    throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    Point aPoint(aPt.X, aPt.Y);
+    if(pPixelCtl)
+	    return (aPoint.X() >= 0)
+	        && (aPoint.X() < pPixelCtl->GetSizePixel().getWidth())
+	        && (aPoint.Y() >= 0)
+	        && (aPoint.Y() < pPixelCtl->GetSizePixel().getHeight());
+    else
+	    return sal_False;
+}
+uno::Reference<XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleAtPoint (
+        const awt::Point& aPoint) 
+    throw (uno::RuntimeException)
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	ensureIsAlive();
+	uno::Reference <XAccessible> xAcc;
+
+	Point childPoint;
+	childPoint.X() = aPoint.X;
+	childPoint.Y() = aPoint.Y;
+
+    if(pPixelCtl)
+   	{
+		Point pt= pPixelCtl->PixelToLogic(childPoint);
+		long nIndex = pPixelCtl->PointToIndex(pt);
+	    return CreateChild(nIndex,pPixelCtl->IndexToPoint(nIndex));
+    }
+    else
+	   return xAcc;
+
+}
+
+awt::Rectangle SvxPixelCtlAccessible::getBounds(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    Size aSz;
+    Point aPos(0,0);
+    awt::Rectangle aRet;
+	if(pPixelCtl)
+	{
+	    aSz = pPixelCtl->GetSizePixel();	
+	    aPos = pPixelCtl->GetPosPixel();
+	    aRet.X = aPos.X();
+	    aRet.Y = aPos.Y();
+	    aRet.Width = aSz.Width();
+	    aRet.Height = aSz.Height();
+	}
+    return aRet;
+}
+
+awt::Point SvxPixelCtlAccessible::getLocation(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    Point aPos;
+    aPos = pPixelCtl->GetPosPixel();
+    awt::Point aRet(aPos.X(), aPos.Y());
+    return aRet;
+}
+
+awt::Point SvxPixelCtlAccessible::getLocationOnScreen(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    Rectangle rect;
+    rect = pPixelCtl->GetWindowExtentsRelative(NULL);
+    awt::Point aRet(rect.Left(),rect.Top() );
+    return aRet;
+}
+
+awt::Size SvxPixelCtlAccessible::getSize(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    Size aSz;
+    aSz = pPixelCtl->GetSizePixel();
+    awt::Size aRet(aSz.Width(),aSz.Height());
+    return aRet;
+}
+void SvxPixelCtlAccessible::grabFocus(  ) throw (uno::RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    if(pPixelCtl)
+	pPixelCtl->GrabFocus();
+}
+
+sal_Int32 SvxPixelCtlAccessible::getForeground(  )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    uno::Any aRet;
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    return pPixelCtl->GetControlForeground().GetColor();
+}
+
+sal_Int32 SvxPixelCtlAccessible::getBackground(  )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    uno::Any aRet;
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+    return pPixelCtl->GetControlBackground().GetColor();
+}
+
+::rtl::OUString SvxPixelCtlAccessible::getImplementationName(  ) throw (uno::RuntimeException)
+{
+    return rtl::OUString::createFromAscii("SvxPixelCtlAccessible");
+}
+/*-- 04.02.2002 14:12:05---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+const sal_Char sAccessible[]          = "Accessible";
+const sal_Char sAccessibleContext[]   = "AccessibleContext";
+const sal_Char sAccessibleComponent[] = "AccessibleComponent";
+//const sal_Char sAccessibleTable[] = "AccessibleTable";
+
+sal_Bool SvxPixelCtlAccessible::supportsService( const ::rtl::OUString& rServiceName )
+    throw (uno::RuntimeException)
+{
+    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
+            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
+            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );// ||
+//            rServiceName.equalsAsciiL( sAccessibleTable, sizeof(sAccessibleTable)-1 );
+}
+/*-- 04.02.2002 14:12:05---------------------------------------------------
+
+  -----------------------------------------------------------------------*/
+uno::Sequence< ::rtl::OUString > SvxPixelCtlAccessible::getSupportedServiceNames(  )
+    throw (uno::RuntimeException)
+{
+    uno::Sequence< OUString > aRet(2);
+	OUString* pArray = aRet.getArray();
+    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
+    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
+    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
+//    pArray[3] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleTable) );
+    return aRet;
+}
+
+// -----------------------------------------------------------------------------
+// XAccessibleSelection
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxPixelCtlAccessible::selectAccessibleChild( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    IsValid();
+	
+	if ( nChildIndex < 0 || nChildIndex >= getAccessibleChildCount())
+		throw lang::IndexOutOfBoundsException();
+
+	long nIndex = pPixelCtl->ShowPosition(pPixelCtl->IndexToPoint(nChildIndex));
+	NotifyChild(nIndex,sal_True,sal_False);
+}
+// -----------------------------------------------------------------------------
+sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+
+	return pPixelCtl->GetFoucsPosIndex() == nChildIndex;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxPixelCtlAccessible::clearAccessibleSelection(  ) throw (RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+	
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxPixelCtlAccessible::selectAllAccessibleChildren(  ) throw (RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+	
+}
+// -----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChildCount(  ) throw (RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+	
+	return 1;
+}
+// -----------------------------------------------------------------------------
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+	
+	if ( nSelectedChildIndex >= 1)
+		throw lang::IndexOutOfBoundsException();
+	
+	uno::Reference< XAccessible > xChild;
+	if(pPixelCtl)
+	{
+		if(m_xCurChild.is())
+		{
+			xChild = m_xCurChild;
+		}
+	}
+	return xChild;
+}
+// -----------------------------------------------------------------------------
+void SAL_CALL SvxPixelCtlAccessible::deselectAccessibleChild( sal_Int32 ) throw (lang::IndexOutOfBoundsException, RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+	
+    IsValid();
+	
+	
+}
+
+// Added by lq
+void SvxPixelCtlAccessible::ensureIsAlive() const
+    throw ( lang::DisposedException )
+{
+    if( !IsAlive() )
+        throw lang::DisposedException();
+}
+
+void SvxPixelCtlAccessible::ensureIsValidRow( sal_Int32 nRow )
+    throw ( lang::IndexOutOfBoundsException )
+{
+    if( nRow >= pPixelCtl->GetHeight() || nRow <0)
+        throw lang::IndexOutOfBoundsException(
+            OUString( RTL_CONSTASCII_USTRINGPARAM( "row index is invalid" ) ), *this );
+}
+
+void SvxPixelCtlAccessible::ensureIsValidColumn( sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException )
+{
+    if( nColumn >= pPixelCtl->GetWidth() || nColumn <0 )
+        throw lang::IndexOutOfBoundsException(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("column index is invalid") ), *this );
+}
+
+void SvxPixelCtlAccessible::ensureIsValidAddress(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException )
+{
+    ensureIsValidRow( nRow );
+    ensureIsValidColumn( nColumn );
+}
+
+void SvxPixelCtlAccessible::ensureIsValidIndex( sal_Int32 nChildIndex )
+    throw ( lang::IndexOutOfBoundsException )
+{
+    if( nChildIndex >=  pPixelCtl->GetSquares())
+        throw lang::IndexOutOfBoundsException(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("child index is invalid") ), *this );
+}
+
+// XAccessibleTable -----------------------------------------------------------
+/*
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowCount()
+    throw ( uno::RuntimeException )
+{
+   ::osl::MutexGuard	aGuard( m_aMutex );
+   ensureIsAlive();
+    return pPixelCtl->GetLineCount();
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnCount()
+    throw ( uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    return pPixelCtl->GetLineCount();
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRowExtentAt(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    return 1;   // merged cells not supported
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnExtentAt(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    return 1;   // merged cells not supported
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCaption()
+    throw ( uno::RuntimeException )
+{
+	uno::Reference< XAccessible > xAccessble;
+    ensureIsAlive();
+    return xAccessble;    // not supported
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleSummary()
+    throw ( uno::RuntimeException )
+{
+	uno::Reference< XAccessible > xAccessble;
+    ensureIsAlive();
+    return xAccessble;    // not supported
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleIndex(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidAddress(nRow,nColumn);
+    return nRow + nColumn * pPixelCtl->GetLineCount() ;
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleRow( sal_Int32 nChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidIndex( nChildIndex );
+    return nChildIndex/pPixelCtl->GetLineCount();
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessible::getAccessibleColumn( sal_Int32 nChildIndex )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidIndex( nChildIndex );
+    return nChildIndex%pPixelCtl->GetLineCount();
+}
+
+::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleRowDescription( sal_Int32 nRow )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidRow( nRow );
+    return ::rtl::OUString::createFromAscii ("");
+}
+
+::rtl::OUString SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnDescription( sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidColumn( nColumn );
+    return ::rtl::OUString::createFromAscii ("");
+}
+
+uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleRowHeaders()
+    throw ( uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    uno::Reference< XAccessibleTable > xAccessble;
+    ensureIsAlive();
+    return xAccessble;
+}
+
+uno::Reference< XAccessibleTable > SAL_CALL SvxPixelCtlAccessible::getAccessibleColumnHeaders()
+    throw ( uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    uno::Reference< XAccessibleTable > xAccessble;
+    ensureIsAlive();
+    return xAccessble;
+}
+
+Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleRows()
+    throw ( uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    Sequence< sal_Int32 > accRows;
+    ensureIsAlive();
+
+    return accRows;
+}
+
+Sequence< sal_Int32 > SAL_CALL SvxPixelCtlAccessible::getSelectedAccessibleColumns()
+    throw ( uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    Sequence< sal_Int32 > accColumns;
+    ensureIsAlive();
+
+    return accColumns;
+}
+
+sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleRowSelected( sal_Int32 nRow )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidRow( nRow );
+    return sal_False;
+}
+
+sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleColumnSelected( sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidColumn( nColumn );
+    return sal_False;
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessible::getAccessibleCellAt(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidAddress( nRow, nColumn );
+    return getAccessibleChild(nRow*pPixelCtl->GetLineCount()+nColumn);
+}
+
+sal_Bool SAL_CALL SvxPixelCtlAccessible::isAccessibleSelected(
+        sal_Int32 nRow, sal_Int32 nColumn )
+    throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    ::osl::MutexGuard	aGuard( m_aMutex );
+    ensureIsAlive();
+    ensureIsValidAddress( nRow, nColumn );
+    return isAccessibleChildSelected(nRow*pPixelCtl->GetLineCount()+nColumn);
+}
+// Added by lq end
+*/
+
+//XAccessibleEventBroadcaster
+void SAL_CALL SvxPixelCtlAccessible::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener )  throw( RuntimeException )
+{
+	if (xListener.is())
+    {
+		::osl::MutexGuard	aGuard( m_aMutex );
+		if (!mnClientId)
+	            mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+		comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+    }
+}
+
+void SAL_CALL SvxPixelCtlAccessible::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
+    throw( RuntimeException )
+{
+	if (xListener.is())
+	{
+    	::osl::MutexGuard	aGuard( m_aMutex );
+
+        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+		if ( !nListenerCount )
+		{
+			comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+			mnClientId = 0;
+		}
+	}
+}
+void SvxPixelCtlAccessible::CommitChange( const AccessibleEventObject& rEvent )
+{
+	if (mnClientId)
+		comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
+}
+
+//Solution:Add the event handling method
+void SvxPixelCtlAccessible::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew)
+{
+	const uno::Reference< XInterface >	xSource( *this );
+	CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
+}
+
+void SAL_CALL SvxPixelCtlAccessible::disposing()
+{
+	if( !rBHelper.bDisposed )
+	{
+		{
+			::osl::MutexGuard	aGuard( m_aMutex );
+			if ( mnClientId )
+			{
+				comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+				mnClientId =  0;
+			}
+		}
+	    //mxParent = uno::Reference< XAccessible >();
+	    
+	}
+}
+void SvxPixelCtlAccessible::Invalidate()
+{
+	pPixelCtl = 0;
+}
+void SvxPixelCtlAccessible::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
+{
+	if( IsNotAlive() )
+		throw lang::DisposedException();
+}
+void SvxPixelCtlAccessible::IsValid() throw (uno::RuntimeException)
+{
+    if(!pPixelCtl)
+        throw uno::RuntimeException();
+}
+
+
+void SvxPixelCtlAccessible::NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck)
+{
+	DBG_ASSERT( !(!bSelect && !bCheck),"" );//non is false
+
+	SvxPixelCtlAccessibleChild *pChild= NULL;
+	
+	if (m_xCurChild.is())
+	{
+		pChild= static_cast<SvxPixelCtlAccessibleChild*>(m_xCurChild.get());
+		DBG_ASSERT(pChild,"Child Must be Valid");
+		if (pChild->getAccessibleIndexInParent() == nIndex )
+		{
+			if (bSelect)
+			{
+				pChild->SelectChild(sal_True);
+			}
+			if (bCheck)
+			{
+				pChild->ChangePixelColorOrBG(sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex))));
+				pChild->CheckChild();
+			}
+			return ;
+		}
+	}
+	uno::Reference <XAccessible> xNewChild =CreateChild(nIndex, pPixelCtl->IndexToPoint(nIndex));
+	SvxPixelCtlAccessibleChild *pNewChild= static_cast<SvxPixelCtlAccessibleChild*>(xNewChild.get());
+	DBG_ASSERT(pNewChild,"Child Must be Valid");
+
+	Any aNewValue,aOldValue;
+	aNewValue<<= xNewChild;
+	FireAccessibleEvent(	AccessibleEventId::ACTIVE_DESCENDANT_CHANGED,
+							aOldValue,
+							aNewValue );
+
+	if (bSelect)
+	{
+		if (pChild)
+		{
+			pChild->SelectChild(sal_False);
+		}
+		pNewChild->SelectChild(sal_True);
+	}
+	if (bCheck)
+	{
+		pNewChild->CheckChild();
+	}
+	m_xCurChild= xNewChild;
+
+
+}
+
+uno::Reference<XAccessible> SvxPixelCtlAccessible::CreateChild (long nIndex,Point mPoint)
+{
+	long nX = mPoint.X();
+	long nY = mPoint.Y();
+	if( Application::GetSettings().GetLayoutRTL())
+	{
+	    nX = (sal_uInt16) pPixelCtl->GetWidth() - 1 - nX;
+	}
+
+	sal_Bool bPixelColorOrBG= sal_Bool(pPixelCtl->GetBitmapPixel(sal_uInt16(nIndex)));
+	Size size(pPixelCtl->GetWidth() / pPixelCtl->GetLineCount(),pPixelCtl->GetHeight() / pPixelCtl->GetLineCount());
+	uno::Reference<XAccessible> xChild;
+	xChild = new SvxPixelCtlAccessibleChild(pPixelCtl, 
+				bPixelColorOrBG, 
+				Point(nX,nY),
+				Rectangle(mPoint,size),
+				this,
+				nIndex);
+
+	return xChild;
+}
+
+
+void SvxPixelCtlAccessible::LoseFocus()
+{
+	m_xCurChild = uno::Reference< XAccessible >() ;
+}
+
+void SvxPixelCtlAccessibleChild::CheckChild()
+{
+	Any aChecked;
+	aChecked <<= AccessibleStateType::CHECKED;
+
+	if (m_bPixelColorOrBG)//Current Child State
+	{
+		FireAccessibleEvent(	AccessibleEventId::STATE_CHANGED,								
+								Any(),
+								aChecked);
+	}
+	else
+	{
+		FireAccessibleEvent(	AccessibleEventId::STATE_CHANGED,
+								aChecked,
+								Any() );
+	}
+}
+
+void SvxPixelCtlAccessibleChild::SelectChild( sal_Bool bSelect)
+{
+	Any aSelected;
+	aSelected <<= AccessibleStateType::SELECTED;
+
+	if (bSelect)
+	{
+		FireAccessibleEvent(	AccessibleEventId::STATE_CHANGED,
+								Any(),
+								aSelected);
+	}
+	else
+	{
+		FireAccessibleEvent(	AccessibleEventId::STATE_CHANGED,
+								aSelected,
+								Any());
+	}
+}
+void SvxPixelCtlAccessibleChild::FireAccessibleEvent (
+	short nEventId, 
+	const ::com::sun::star::uno::Any& rOld, 
+	const ::com::sun::star::uno::Any& rNew)
+{
+	const uno::Reference< XInterface >	xSource( *this );
+	CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
+}
+
+
+
+DBG_NAME( SvxPixelCtlAccessibleChild )
+
+
+SvxPixelCtlAccessibleChild::SvxPixelCtlAccessibleChild(
+	SvxPixelCtl* rWindow, 
+	sal_Bool bPixelColorOrBG,
+	const Point &aPoint,
+	const Rectangle& rBoundingBox,
+	const uno::Reference<XAccessible>&	rxParent,
+	long nIndexInParent ) :
+	SvxPixelCtlAccessibleChild_BASE( m_aMutex ),
+	mrParentWindow( rWindow ),
+	mxParent(rxParent),
+	m_bPixelColorOrBG(bPixelColorOrBG),
+	maPoint(aPoint),
+	mpBoundingBox( new Rectangle( rBoundingBox ) ),
+	mnIndexInParent( nIndexInParent ),
+	mnClientId( 0 )
+{
+	DBG_CTOR( SvxPixelCtlAccessibleChild, NULL );
+}
+
+
+SvxPixelCtlAccessibleChild::~SvxPixelCtlAccessibleChild()
+{
+	DBG_DTOR( SvxPixelCtlAccessibleChild, NULL );
+
+	if( IsAlive() )
+	{
+		osl_incrementInterlockedCount( &m_refCount );
+		dispose();		// set mpRepr = NULL & release all childs
+	}
+}
+
+//=====  XAccessible  =========================================================
+
+uno::Reference< XAccessibleContext> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleContext( void ) throw( RuntimeException )
+{
+	return this;
+}
+
+//=====  XAccessibleComponent  ================================================
+
+sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::containsPoint( const awt::Point& rPoint ) throw( RuntimeException )
+{
+	// no guard -> done in getBounds()
+//	return GetBoundingBox().IsInside( VCLPoint( rPoint ) );
+	return Rectangle( Point( 0, 0 ), GetBoundingBox().GetSize() ).IsInside( VCLPoint( rPoint ) );
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleAtPoint( const awt::Point& ) throw( RuntimeException )
+{
+	return uno::Reference< XAccessible >();
+}
+
+awt::Rectangle SAL_CALL SvxPixelCtlAccessibleChild::getBounds() throw( RuntimeException )
+{
+	// no guard -> done in getBoundingBox()
+	//Modified by lq, 09/26
+	//return AWTRectangle( GetBoundingBox() );
+	awt::Rectangle rect = AWTRectangle( GetBoundingBox() );
+	rect.X = rect.X + mrParentWindow->GetClientWindowExtentsRelative(NULL).Left()-mrParentWindow->GetWindowExtentsRelative(NULL).Left();
+	rect.Y = rect.Y + mrParentWindow->GetClientWindowExtentsRelative(NULL).Top()-mrParentWindow->GetWindowExtentsRelative(NULL).Top();
+	return rect;
+	// End
+}
+
+awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocation() throw( RuntimeException )
+{
+	// no guard -> done in getBoundingBox()
+	return AWTPoint( GetBoundingBox().TopLeft() );
+}
+
+awt::Point SAL_CALL SvxPixelCtlAccessibleChild::getLocationOnScreen() throw( RuntimeException )
+{
+	// no guard -> done in getBoundingBoxOnScreen()
+	return AWTPoint( GetBoundingBoxOnScreen().TopLeft() );
+}
+
+awt::Size SAL_CALL SvxPixelCtlAccessibleChild::getSize() throw( RuntimeException )
+{
+	// no guard -> done in getBoundingBox()
+	return AWTSize( GetBoundingBox().GetSize() );
+}
+
+void SAL_CALL SvxPixelCtlAccessibleChild::grabFocus() throw( RuntimeException )
+{
+}
+
+sal_Int32 SvxPixelCtlAccessibleChild::getForeground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    //::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
+    ::osl::MutexGuard   aGuard( m_aMutex );
+    ThrowExceptionIfNotAlive();
+    return mrParentWindow->GetControlForeground().GetColor();
+}
+sal_Int32 SvxPixelCtlAccessibleChild::getBackground(  ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+    //::vos::OGuard       aSolarGuard( Application::GetSolarMutex() );
+    ::osl::MutexGuard   aGuard( m_aMutex );
+
+    ThrowExceptionIfNotAlive();
+    return mrParentWindow->GetControlBackground().GetColor();
+}
+
+//=====  XAccessibleContext  ==================================================
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChildCount( void ) throw( RuntimeException )
+{
+	return 0;
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleChild( sal_Int32 ) throw ( RuntimeException )
+{
+	throw lang::IndexOutOfBoundsException();
+}
+
+uno::Reference< XAccessible > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleParent( void ) throw( RuntimeException )
+{
+	return mxParent;
+}
+
+sal_Int32 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleIndexInParent( void ) throw( RuntimeException )
+{
+   return mnIndexInParent;
+}
+
+sal_Int16 SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRole( void ) throw( RuntimeException )
+{
+	return AccessibleRole::CHECK_BOX;
+}
+
+OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleDescription( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	return  GetName();
+}
+
+OUString SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleName( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );	
+	return  GetName();
+}
+
+/**	Return empty uno::Reference to indicate that the relation set is not
+	supported.
+*/
+uno::Reference<XAccessibleRelationSet> SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleRelationSet( void ) throw( RuntimeException )
+{
+	return uno::Reference< XAccessibleRelationSet >();
+}
+
+uno::Reference< XAccessibleStateSet > SAL_CALL SvxPixelCtlAccessibleChild::getAccessibleStateSet( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard						aGuard( m_aMutex );
+	utl::AccessibleStateSetHelper*			pStateSetHelper = new utl::AccessibleStateSetHelper;
+
+	if( IsAlive() )
+	{
+
+		pStateSetHelper->AddState( AccessibleStateType::TRANSIENT );
+		pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+		pStateSetHelper->AddState( AccessibleStateType::OPAQUE );
+		pStateSetHelper->AddState( AccessibleStateType::SELECTABLE );
+		pStateSetHelper->AddState( AccessibleStateType::SHOWING );
+		pStateSetHelper->AddState( AccessibleStateType::VISIBLE );
+
+		if (mrParentWindow )
+		{
+			long nIndex = mrParentWindow->GetFoucsPosIndex();
+			if ( nIndex == mnIndexInParent)
+			{
+				pStateSetHelper->AddState( AccessibleStateType::SELECTED );
+			}
+			//IAccessibility2 Implementation 2009-----
+			if (mrParentWindow->GetBitmapPixel(sal_uInt16(mnIndexInParent)))
+			//-----IAccessibility2 Implementation 2009
+			{
+				pStateSetHelper->AddState( AccessibleStateType::CHECKED );
+			}
+		}
+	}
+	else
+		pStateSetHelper->AddState( AccessibleStateType::DEFUNC );
+
+	return pStateSetHelper;
+}
+
+lang::Locale SAL_CALL SvxPixelCtlAccessibleChild::getLocale( void ) throw( IllegalAccessibleComponentStateException, RuntimeException )
+{
+	::osl::MutexGuard						aGuard( m_aMutex );
+	if( mxParent.is() )
+    {
+    	uno::Reference< XAccessibleContext >		xParentContext( mxParent->getAccessibleContext() );
+        if( xParentContext.is() )
+	    	return xParentContext->getLocale();
+    }
+
+    //	No locale and no parent.  Therefore throw exception to indicate this
+    //	cluelessness.
+    throw IllegalAccessibleComponentStateException();
+}
+
+void SAL_CALL SvxPixelCtlAccessibleChild::addEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
+    throw( RuntimeException )
+{
+	if (xListener.is())
+    {
+    	::osl::MutexGuard	aGuard( m_aMutex );
+		if (!mnClientId)
+            mnClientId = comphelper::AccessibleEventNotifier::registerClient( );
+		comphelper::AccessibleEventNotifier::addEventListener( mnClientId, xListener );
+    }
+}
+
+
+
+
+void SAL_CALL SvxPixelCtlAccessibleChild::removeEventListener( const uno::Reference< XAccessibleEventListener >& xListener )
+    throw( RuntimeException )
+{
+	if (xListener.is())
+	{
+    	::osl::MutexGuard	aGuard( m_aMutex );
+
+        sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( mnClientId, xListener );
+		if ( !nListenerCount )
+		{
+			// no listeners anymore
+			// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+			// and at least to us not firing any events anymore, in case somebody calls
+			// NotifyAccessibleEvent, again
+			comphelper::AccessibleEventNotifier::revokeClient( mnClientId );
+			mnClientId = 0;
+		}
+	}
+}
+
+
+//=====  XServiceInfo  ========================================================
+
+OUString SAL_CALL SvxPixelCtlAccessibleChild::getImplementationName( void ) throw( RuntimeException )
+{
+	return OUString( RTL_CONSTASCII_USTRINGPARAM( "SvxPixelCtlAccessibleChild" ) );
+}
+
+sal_Bool SAL_CALL SvxPixelCtlAccessibleChild::supportsService( const OUString& rServiceName ) throw( RuntimeException )
+{
+    return  rServiceName.equalsAsciiL( sAccessible         , sizeof(sAccessible         )-1 ) ||
+            rServiceName.equalsAsciiL( sAccessibleContext  , sizeof(sAccessibleContext  )-1 ) ||
+            rServiceName.equalsAsciiL( sAccessibleComponent, sizeof(sAccessibleComponent)-1 );
+
+}
+
+Sequence< OUString > SAL_CALL SvxPixelCtlAccessibleChild::getSupportedServiceNames( void ) throw( RuntimeException )
+{
+    uno::Sequence< OUString > aRet(3);
+	OUString* pArray = aRet.getArray();
+    pArray[0] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessible         ) );
+    pArray[1] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleContext  ) );
+    pArray[2] = OUString( RTL_CONSTASCII_USTRINGPARAM(sAccessibleComponent) );
+    return aRet;
+}
+
+//=====  internal  ============================================================
+
+void SvxPixelCtlAccessibleChild::CommitChange( const AccessibleEventObject& rEvent )
+{
+	if (mnClientId)
+		comphelper::AccessibleEventNotifier::addEvent( mnClientId, rEvent );
+}
+
+void SAL_CALL SvxPixelCtlAccessibleChild::disposing()
+{
+	if( !rBHelper.bDisposed )
+	{
+		::osl::MutexGuard	aGuard( m_aMutex );
+
+        // Send a disposing to all listeners.
+	    if ( mnClientId )
+	    {
+            comphelper::AccessibleEventNotifier::revokeClientNotifyDisposing( mnClientId, *this );
+		    mnClientId =  0;
+	    }
+
+		mxParent = uno::Reference< XAccessible >();
+        
+	    delete mpBoundingBox;
+	}
+}
+
+void SvxPixelCtlAccessibleChild::ThrowExceptionIfNotAlive( void ) throw( lang::DisposedException )
+{
+	if( IsNotAlive() )
+		throw lang::DisposedException();
+}
+
+Rectangle SvxPixelCtlAccessibleChild::GetBoundingBoxOnScreen( void ) throw( RuntimeException )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+
+	// no ThrowExceptionIfNotAlive() because its done in GetBoundingBox()
+	Rectangle			aRect( GetBoundingBox() );
+
+	return Rectangle( mrParentWindow->OutputToAbsoluteScreenPixel( aRect.TopLeft() ), aRect.GetSize() );
+}
+
+Rectangle SvxPixelCtlAccessibleChild::GetBoundingBox( void ) throw( RuntimeException )
+{
+	// no guard neccessary, because no one changes mpBoundingBox after creating it
+	ThrowExceptionIfNotAlive();
+
+	return *mpBoundingBox;
+}
+
+::rtl::OUString SvxPixelCtlAccessibleChild::GetName()
+{
+	sal_Int32 nXIndex = mnIndexInParent % mrParentWindow->GetLineCount();
+	sal_Int32 nYIndex = mnIndexInParent / mrParentWindow->GetLineCount();
+	
+	OUString str;
+	str += OUString::createFromAscii("(");
+	str += OUString::valueOf(nXIndex);
+	str += OUString::createFromAscii(",");
+	str += OUString::valueOf(nYIndex);
+// 	str += OUString::createFromAscii(",");
+// 	str += OUString::valueOf(m_bPixelColorOrBG);
+	str += OUString::createFromAscii(")");
+	return str;
+}
diff --git a/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx b/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx
index ec6841e..1ccbe71 100644
--- a/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx
+++ b/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx
@@ -46,7 +46,14 @@
 #include <svx/dlgctrl.hxx>
 #include <svx/dialmgr.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
-
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLERELATIONTYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#endif
+#ifndef _UTL_ACCESSIBLERELATIONSETHELPER_HXX_
+#include <unotools/accessiblerelationsethelper.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 
 using namespace ::cppu;
 using namespace ::osl;
@@ -54,6 +61,9 @@
 using namespace	::com::sun::star::uno;
 using namespace	::com::sun::star::accessibility;
 
+//IAccessibility2 Implementation 2009-----
+using namespace ::com::sun::star::lang;
+//-----IAccessibility2 Implementation 2009
 
 #define MAX_NUM_OF_CHILDS	9
 #define NOCHILDSELECTED		-1
@@ -354,13 +364,19 @@
 
 sal_Int16 SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRole( void ) throw( RuntimeException )
 {
+//IAccessibility2 Implementation 2009-----
+	//return AccessibleRole::GROUP_BOX;
 	return AccessibleRole::PANEL;
+//-----IAccessibility2 Implementation 2009
 }
 
 ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleDescription( void ) throw( RuntimeException )
 {
 	::osl::MutexGuard	aGuard( m_aMutex );
-	return msDescription;
+	//IAccessibility2 Implementation 2009-----
+	//return msDescription;
+	return msDescription +::rtl::OUString::createFromAscii(" Please use arrow key to selection.");
+	//-----IAccessibility2 Implementation 2009
 }
 
 ::rtl::OUString SAL_CALL SvxRectCtlAccessibleContext::getAccessibleName( void ) throw( RuntimeException )
@@ -374,9 +390,40 @@
 */
 Reference< XAccessibleRelationSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
 {
-	return Reference< XAccessibleRelationSet >();
+//IAccessibility2 Implementation 2009-----
+	//return Reference< XAccessibleRelationSet >();
+	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+	Window* pWindow = mpRepr;
+	if ( pWindow )
+	{
+		// Window *pLabeledBy = pWindow->GetAccRelationLabeledBy();
+		Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+		if ( pLabeledBy && pLabeledBy != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pLabeledBy->GetAccessible();
+			pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABELED_BY, aSequence ) );
+		}
+		Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();
+		if ( pMemberOf && pMemberOf != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pMemberOf->GetAccessible();
+			pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+	}
+	return xSet;
+	//-----IAccessibility2 Implementation 2009
 }
-
+//IAccessibility2 Implementation 2009-----
+//Solution:Add the event handling method
+void SvxRectCtlAccessibleContext::FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew)
+{
+	const Reference< XInterface >	xSource( *this );
+	CommitChange( AccessibleEventObject( xSource, nEventId, rNew,rOld ) );
+}
+//-----IAccessibility2 Implementation 2009	
 Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
 {
 	::osl::MutexGuard						aGuard( m_aMutex );
@@ -384,8 +431,10 @@
 
 	if( IsAlive() )
 	{
-		// pStateSetHelper->AddState( AccessibleStateType::ENABLED );
+//IAccessibility2 Implementation 2009-----
+		pStateSetHelper->AddState( AccessibleStateType::ENABLED );
         // pStateSetHelper->AddState( AccessibleStateType::SENSITIVE );
+//-----IAccessibility2 Implementation 2009
 		pStateSetHelper->AddState( AccessibleStateType::FOCUSABLE );
 		if( mpRepr->HasFocus() )
 			pStateSetHelper->AddState( AccessibleStateType::FOCUSED );
@@ -634,8 +683,38 @@
 		// in our case only for the first (0) _selected_ child this is a valid request
 		throw lang::IndexOutOfBoundsException();
 }
-
-void SvxRectCtlAccessibleContext::selectChild( long nNew )
+// IAccessibility2 implementation 2009.  ------
+void SvxRectCtlAccessibleContext::FireChildFocus( RECT_POINT eButton )
+{
+	::osl::MutexGuard	aGuard( m_aMutex );
+	long nNew = PointToIndex( eButton, mbAngleMode );
+	long	nNumOfChilds = getAccessibleChildCount();
+	if( nNew < nNumOfChilds )
+	{
+		// select new child
+		SvxRectCtlChildAccessibleContext*	pChild;
+		mnSelectedChild = nNew;
+		if( nNew != NOCHILDSELECTED )
+		{
+			pChild = mpChilds[ nNew ];
+			if( pChild )
+			{
+				pChild->FireFocusEvent();
+			}
+		}
+		else
+		{
+			const Reference< XInterface >	xSource( *this );
+			Any 							aOld;
+			Any 							aNew;
+			aNew <<= AccessibleStateType::FOCUSED;
+			CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
+		}
+	}
+	else
+		mnSelectedChild = NOCHILDSELECTED;
+}
+void SvxRectCtlAccessibleContext::selectChild( long nNew, sal_Bool bFireFocus )
 {
 	::osl::MutexGuard	aGuard( m_aMutex );
 	if( nNew != mnSelectedChild )
@@ -648,7 +727,7 @@
 			{	// deselect old selected child if one is selected
 				pChild = mpChilds[ mnSelectedChild ];
 				if( pChild )
-					pChild->setStateChecked( sal_False );
+					pChild->setStateChecked( sal_False, bFireFocus );
 			}
 
 			// select new child
@@ -658,7 +737,7 @@
 			{
 				pChild = mpChilds[ nNew ];
 				if( pChild )
-					pChild->setStateChecked( sal_True );
+					pChild->setStateChecked( sal_True, bFireFocus );
 			}
 		}
 		else
@@ -666,12 +745,12 @@
 	}
 }
 
-void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton )
+void SvxRectCtlAccessibleContext::selectChild( RECT_POINT eButton , sal_Bool bFireFocus)
 {
 	// no guard -> is done in next selectChild
-	selectChild( PointToIndex( eButton, mbAngleMode ) );
+	selectChild( PointToIndex( eButton, mbAngleMode ) , bFireFocus);
 }
-
+// ------ IAccessibility2 implementation 2009.
 void SvxRectCtlAccessibleContext::setName( const ::rtl::OUString& rName )
 {
 	Any						aPreVal, aPostVal;
@@ -976,7 +1055,20 @@
 */
 Reference<XAccessibleRelationSet> SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleRelationSet( void ) throw( RuntimeException )
 {
-	return Reference< XAccessibleRelationSet >();
+	//return Reference< XAccessibleRelationSet >();
+	//IAccessibility2 Implementation 2009-----
+	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;	
+	if( mxParent.is() )
+      {
+		uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+		aSequence[0] = mxParent;
+		pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+		
+	}
+	
+	return xSet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 Reference< XAccessibleStateSet > SAL_CALL SvxRectCtlChildAccessibleContext::getAccessibleStateSet( void ) throw( RuntimeException )
@@ -1085,6 +1177,59 @@
 	return aRet;
 }
 
+//IAccessibility2 Implementation 2009-----
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+
+sal_Int32 SvxRectCtlChildAccessibleContext::getAccessibleActionCount( ) throw (RuntimeException)
+{
+	::osl::MutexGuard	aGuard( maMutex );
+
+	return 1;	
+}
+
+// -----------------------------------------------------------------------------
+
+sal_Bool SvxRectCtlChildAccessibleContext::doAccessibleAction ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::osl::MutexGuard	aGuard( maMutex );
+
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw IndexOutOfBoundsException();
+
+	Reference<XAccessibleSelection> xSelection( mxParent, UNO_QUERY);
+
+	xSelection->selectAccessibleChild(mnIndexInParent);
+	
+	return sal_True;
+}
+
+// -----------------------------------------------------------------------------
+
+::rtl::OUString SvxRectCtlChildAccessibleContext::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::osl::MutexGuard	aGuard( maMutex );
+
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw IndexOutOfBoundsException();
+	return ::rtl::OUString::createFromAscii("select");
+}
+
+// -----------------------------------------------------------------------------
+
+Reference< XAccessibleKeyBinding > SvxRectCtlChildAccessibleContext::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+    ::osl::MutexGuard	aGuard( maMutex );
+
+    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw IndexOutOfBoundsException();
+	
+    return Reference< XAccessibleKeyBinding >();
+}
+
+//-----IAccessibility2 Implementation 2009
+
 //=====  XServiceInfo  ========================================================
 
 ::rtl::OUString SAL_CALL SvxRectCtlChildAccessibleContext::getImplementationName( void ) throw( RuntimeException )
@@ -1181,8 +1326,8 @@
 
 	return *mpBoundingBox;
 }
-
-void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked )
+// IAccessibility2 implementation 2009. ------
+void SvxRectCtlChildAccessibleContext::setStateChecked( sal_Bool bChecked, sal_Bool bFireFocus )
 {
 	if( mbIsChecked != bChecked )
 	{
@@ -1193,10 +1338,24 @@
 		Any								aOld;
 		Any								aNew;
 		Any&							rMod = bChecked? aNew : aOld;
-
+		if( bFireFocus )
+		{
+			//Solution: Send the STATE_CHANGED(Focused) event to accessible
+			rMod <<= AccessibleStateType::FOCUSED;
+			CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
+		}
 		rMod <<= AccessibleStateType::CHECKED;
 
 		CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
 	}
 }
 
+void SvxRectCtlChildAccessibleContext::FireFocusEvent()
+{
+	const Reference< XInterface >	xSource( *this );
+	Any								aOld;
+	Any								aNew;
+	aNew <<= AccessibleStateType::FOCUSED;
+	CommitChange( AccessibleEventObject( xSource, AccessibleEventId::STATE_CHANGED, aNew, aOld ) );
+}
+// ------ IAccessibility2 implementation 2009.
diff --git a/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
index 953f32f..0eda3df 100644
--- a/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
+++ b/main/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx
@@ -19,15 +19,19 @@
  * 
  *************************************************************/
 
-
-
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_svx.hxx"
 #include "svx/EnhancedCustomShapeTypeNames.hxx"
 #include <osl/mutex.hxx>
 #include <hash_map>
-#include "rtl/string.hxx"
 
+struct TCheck
+{
+	bool operator()( const char* s1, const char* s2 ) const
+	{
+		return strcmp( s1, s2 ) == 0;
+	}
+};
 typedef std::hash_map< const char*, MSO_SPT, rtl::CStringHash, rtl::CStringEqual> TypeNameHashMap;
 static TypeNameHashMap* pHashMap = NULL;
 static ::osl::Mutex& getHashMapMutex()
@@ -310,3 +314,250 @@
 		? rtl::OUString::createFromAscii( pNameTypeTableArray[ eShapeType ].pS )
 		: rtl::OUString();
 }
+//IAccessibility2 Implementation 2009-----
+typedef std::hash_map< const char*, const char*, std::hash<const char*>, TCheck> TypeACCNameHashMap;
+static TypeACCNameHashMap* pACCHashMap = NULL;
+struct ACCNameTypeTable
+{
+	const char*	pS;
+	const char*	pE;
+};
+static const ACCNameTypeTable pACCNameTypeTableArray[] = 
+{
+	{ "non-primitive", "Non Primitive Shape" },
+	{ "rectangle", "Rectangle" },
+	{ "round-rectangle", "Rounded Rectangle" },
+	{ "ellipse", "Ellipse" },
+	{ "diamond", "Diamond" },
+	{ "isosceles-triangle", "Triangle" },
+	{ "right-triangle", "Right Triangle" },
+	{ "parallelogram", "Parallelogram" },
+	{ "trapezoid", "Trapezoid" },
+	{ "hexagon", "Hexagon" },
+	{ "octagon", "Octagon" },
+	{ "cross", "Cross" },
+	{ "star5", "5-Point Star" },
+	{ "right-arrow", "Right Arrow" },
+	//{ "mso-spt14", mso_sptThickArrow },
+	{ "pentagon-right", "Pentagon" },
+	{ "cube", "Cube" },
+	{ "mso-spt21", "Doorplate" },
+	/*{ "mso-spt17", mso_sptBalloon },
+	{ "mso-spt18", mso_sptSeal },
+	{ "mso-spt19", mso_sptArc },
+	{ "mso-spt20", mso_sptLine },
+	{ "mso-spt21", mso_sptPlaque },
+	{ "can", mso_sptCan },*/
+	{ "ring", "Ring" },
+	/*{ "mso-spt24", mso_sptTextSimple },
+	{ "mso-spt25", mso_sptTextOctagon },
+	{ "mso-spt26", mso_sptTextHexagon },
+	{ "mso-spt27", mso_sptTextCurve },
+	{ "mso-spt28", mso_sptTextWave },
+	{ "mso-spt29", mso_sptTextRing },
+	{ "mso-spt30", mso_sptTextOnCurve },
+	{ "mso-spt31", mso_sptTextOnRing },
+	{ "mso-spt32", mso_sptStraightConnector1 },
+	{ "mso-spt33", mso_sptBentConnector2 },
+	{ "mso-spt34", mso_sptBentConnector3 },
+	{ "mso-spt35", mso_sptBentConnector4 },
+	{ "mso-spt36", mso_sptBentConnector5 },
+	{ "mso-spt37", mso_sptCurvedConnector2 },
+	{ "mso-spt38", mso_sptCurvedConnector3 },
+	{ "mso-spt39", mso_sptCurvedConnector4 },
+	{ "mso-spt40", mso_sptCurvedConnector5 },
+	{ "mso-spt41", mso_sptCallout1 },
+	{ "mso-spt42", mso_sptCallout2 },
+	{ "mso-spt43", mso_sptCallout3 },
+	{ "mso-spt44", mso_sptAccentCallout1 },
+	{ "mso-spt45", mso_sptAccentCallout2 },
+	{ "mso-spt46", mso_sptAccentCallout3 },*/
+	{ "line-callout-1", "Line Callout 1" },
+	{ "line-callout-2", "Line Callout 2" },
+	/*{ "mso-spt49", mso_sptBorderCallout3 },
+	{ "mso-spt50", mso_sptAccentBorderCallout1 },
+	{ "mso-spt51", mso_sptAccentBorderCallout2 },
+	{ "mso-spt52", mso_sptAccentBorderCallout3 },
+	{ "mso-spt53", mso_sptRibbon },
+	{ "mso-spt54", mso_sptRibbon2 },*/
+	{ "chevron", "Chevron" },
+	{ "pentagon", "Regular Pentagon" },
+	{ "forbidden", "'No' Symbol" },
+	{ "star8", "8-Point Star" },
+	/*{ "mso-spt59", mso_sptSeal16 },
+	{ "mso-spt60", mso_sptSeal32 },*/
+	{ "rectangular-callout", "Rectangular Callout" },
+	{ "round-rectangular-callout", "Rounded Rectangular Callout" },
+	{ "round-callout", "Round Callout" },
+	//{ "mso-spt64", mso_sptWave },
+	{ "paper", "Folded Corner" },
+	{ "left-arrow", "Left Arrow" },
+	{ "down-arrow", "Down Arrow" },
+	{ "up-arrow", "Up Arrow" },
+	{ "left-right-arrow", "Left and Right Arrow" },
+	{ "up-down-arrow", "Up and Down Arrow" },
+	//{ "mso-spt71", mso_sptIrregularSeal1 },
+	{ "bang", "Explosion" },
+	{ "lightning", "Lighting Bolt" },
+	{ "heart", "Heart" },
+	//{ "mso-spt75", mso_sptPictureFrame },
+	{ "quad-arrow", "4-Way Arrow" },
+	{ "left-arrow-callout", "Left Arrow Callout" },
+	{ "right-arrow-callout", "Right Arrow Callout" },
+	{ "up-arrow-callout", "Up Arrow Callout" },
+	{ "down-arrow-callout", "Down Arrow Callout" },
+	{ "left-right-arrow-callout", "Left and Right Arrow Callout" },
+	{ "up-down-arrow-callout", "Up and Down Arrow Callout" },
+	{ "quad-arrow-callout", "4-Way Arrow Callout" },
+	{ "quad-bevel", "Square Bevel" },
+	{ "left-bracket", "Left Bracket" },
+	{ "right-bracket", "Right Bracket" },
+	{ "left-brace", "Left Brace" },
+	{ "right-brace", "Right Brace" },
+	{ "mso-spt89", "Up and Left Arrow" },
+	//{ "mso-spt90", mso_sptBentUpArrow },
+	//{ "mso-spt91", mso_sptBentArrow },
+	{ "star24", "24-Point Star" },
+	{ "striped-right-arrow", "Striped Right Arrow" },
+	{ "notched-right-arrow", "Notched Right Arrow" },
+	{ "block-arc", "Block Arc" },
+	{ "smiley", "Smile Face" },
+	{ "vertical-scroll", "Vertical Scroll" },
+	{ "horizontal-scroll", "Horizontal Scroll" },
+	{ "circular-arrow", "Circular Arrow" },
+	{ "mso-spt100", "Notched Circular Arrow" },
+	/*
+	{ "mso-spt101", mso_sptUturnArrow },
+	{ "mso-spt102", mso_sptCurvedRightArrow },
+	{ "mso-spt103", mso_sptCurvedLeftArrow },
+	{ "mso-spt104", mso_sptCurvedUpArrow },
+	{ "mso-spt105", mso_sptCurvedDownArrow },*/
+	{ "cloud-callout", "Cloud Callout" },
+	/*{ "mso-spt107", mso_sptEllipseRibbon },
+	{ "mso-spt108", mso_sptEllipseRibbon2 },*/
+	{ "flowchart-process", "Flowchart:Process" },
+	{ "flowchart-decision", "Flowchart:Decision" },
+	{ "flowchart-data", "Flowchart:Data" },
+	{ "flowchart-predefined-process", "Flowchart:Predefined Process" },
+	{ "flowchart-internal-storage", "Flowchart:Internal Storage" },
+	{ "flowchart-document", "Flowchart:Document" },
+	{ "flowchart-multidocument", "Flowchart:Multidocument" },
+	{ "flowchart-terminator", "Flowchart:Terminator" },
+	{ "flowchart-preparation", "Flowchart:Preparation" },
+	{ "flowchart-manual-input", "Flowchart:Manual Input" },
+	{ "flowchart-manual-operation", "Flowchart:Manual Operation" },
+	{ "flowchart-connector", "Flowchart:Connector" },
+	{ "flowchart-card", "Flowchart:Card" },
+	{ "flowchart-punched-tape", "Flowchart:Punched Tape" },
+	{ "flowchart-summing-junction", "Flowchart:Summing Junction" },
+	{ "flowchart-or", "Flowchart:Or" },
+	{ "flowchart-collate", "Flowchart:Collate" },
+	{ "flowchart-sort", "Flowchart:Sort" },
+	{ "flowchart-extract", "Flowchart:Extract" },
+	{ "flowchart-merge", "Flowchart:Merge" },
+	//{ "mso-spt129", mso_sptFlowChartOfflineStorage },
+	{ "flowchart-stored-data", "Flowchart:Stored Data" },
+	{ "flowchart-sequential-access", "drawingbar.fc.25=Flowchart:Sequential Access" },
+	{ "flowchart-magnetic-disk", "Flowchart:Magnetic Disk" },
+	{ "flowchart-direct-access-storage", "Flowchart:Direct Access Storage" },
+	{ "flowchart-display", "Flowchart:Display" },
+	{ "flowchart-delay", "Flowchart:Delay" },
+	/*{ "fontwork-plain-text", mso_sptTextPlainText },
+	{ "fontwork-stop", mso_sptTextStop },
+	{ "fontwork-triangle-up", mso_sptTextTriangle },
+	{ "fontwork-triangle-down", mso_sptTextTriangleInverted },
+	{ "fontwork-chevron-up", mso_sptTextChevron },
+	{ "fontwork-chevron-down", mso_sptTextChevronInverted },
+	{ "mso-spt142", mso_sptTextRingInside },
+	{ "mso-spt143", mso_sptTextRingOutside },
+	{ "fontwork-arch-up-curve", mso_sptTextArchUpCurve },
+	{ "fontwork-arch-down-curve", mso_sptTextArchDownCurve },
+	{ "fontwork-circle-curve", mso_sptTextCircleCurve },
+	{ "fontwork-open-circle-curve", mso_sptTextButtonCurve },
+	{ "fontwork-arch-up-pour", mso_sptTextArchUpPour },
+	{ "fontwork-arch-down-pour", mso_sptTextArchDownPour },
+	{ "fontwork-circle-pour", mso_sptTextCirclePour },
+	{ "fontwork-open-circle-pour", mso_sptTextButtonPour },
+	{ "fontwork-curve-up", mso_sptTextCurveUp },
+	{ "fontwork-curve-down", mso_sptTextCurveDown },
+	{ "fontwork-fade-up-and-right", mso_sptTextCascadeUp },
+	{ "fontwork-fade-up-and-left", mso_sptTextCascadeDown },
+	{ "fontwork-wave", mso_sptTextWave1 },
+	{ "mso-spt157", mso_sptTextWave2 },
+	{ "mso-spt158", mso_sptTextWave3 },
+	{ "mso-spt159", mso_sptTextWave4 },
+	{ "fontwork-inflate", mso_sptTextInflate },
+	{ "mso-spt161", mso_sptTextDeflate },
+	{ "mso-spt162", mso_sptTextInflateBottom },
+	{ "mso-spt163", mso_sptTextDeflateBottom },
+	{ "mso-spt164", mso_sptTextInflateTop },
+	{ "mso-spt165", mso_sptTextDeflateTop },
+	{ "mso-spt166", mso_sptTextDeflateInflate },
+	{ "mso-spt167", mso_sptTextDeflateInflateDeflate },
+	{ "fontwork-fade-right", mso_sptTextFadeRight },
+	{ "fontwork-fade-left", mso_sptTextFadeLeft },
+	{ "fontwork-fade-up", mso_sptTextFadeUp },
+	{ "fontwork-fade-down", mso_sptTextFadeDown },
+	{ "fontwork-slant-up", mso_sptTextSlantUp },
+	{ "fontwork-slant-down", mso_sptTextSlantDown },
+	{ "mso-spt174", mso_sptTextCanUp },
+	{ "mso-spt175", mso_sptTextCanDown },*/
+	{ "flowchart-alternate-process", "Flowchart:Alternate Process " },
+	{ "flowchart-off-page-connector", "Flowchart:Off-page Connector" },
+	/*{ "mso-spt178", mso_sptCallout90 },
+	{ "mso-spt179", mso_sptAccentCallout90 },
+	{ "mso-spt180", mso_sptBorderCallout90 },*/
+	{ "line-callout-3", "Line Callout 3" },
+	//{ "mso-spt182", mso_sptLeftRightUpArrow },
+	{ "sun", "Sun" },
+	{ "moon", "Moon" },
+	{ "bracket-pair", "Double Bracket" },
+	{ "brace-pair", "Double Brace" },
+	{ "star4", "4-Point Star" },
+	/*{ "mso-spt188", mso_sptDoubleWave },
+	{ "mso-spt189", mso_sptActionButtonBlank },
+	{ "mso-spt190", mso_sptActionButtonHome },
+	{ "mso-spt191", mso_sptActionButtonHelp },
+	{ "mso-spt192", mso_sptActionButtonInformation },
+	{ "mso-spt193", mso_sptActionButtonForwardNext },
+	{ "mso-spt194", mso_sptActionButtonBackPrevious },
+	{ "mso-spt195", mso_sptActionButtonEnd },
+	{ "mso-spt196", mso_sptActionButtonBeginning },
+	{ "mso-spt197", mso_sptActionButtonReturn },
+	{ "mso-spt198", mso_sptActionButtonDocument },
+	{ "mso-spt199", mso_sptActionButtonSound },
+	{ "mso-spt200", mso_sptActionButtonMovie },
+	{ "mso-spt201", mso_sptHostControl },
+	{ "mso-spt202", mso_sptTextBox },*/
+	{ "frame", "Frame" },
+	{ "col-60da8460", "Octagon Bevel" },
+	{ "col-502ad400", "Diamond Bevel" }
+};
+rtl::OUString EnhancedCustomShapeTypeNames::GetAccName( const rtl::OUString& rShapeType )
+{
+	if ( !pACCHashMap )
+	{	// init hash map
+		::osl::MutexGuard aGuard( getHashMapMutex() );
+		if ( !pACCHashMap )
+		{
+			TypeACCNameHashMap* pH = new TypeACCNameHashMap;
+			const ACCNameTypeTable* pPtr = pACCNameTypeTableArray;
+			const ACCNameTypeTable* pEnd = pPtr + ( sizeof( pACCNameTypeTableArray ) / sizeof( ACCNameTypeTable ) );
+			for ( ; pPtr < pEnd; pPtr++ )
+				(*pH)[ pPtr->pS ] = pPtr->pE;
+			pACCHashMap = pH;
+		}
+	}
+	rtl::OUString sRetValue;
+	int i, nLen = rShapeType.getLength();
+	char* pBuf = new char[ nLen + 1 ];
+	for ( i = 0; i < nLen; i++ )
+		pBuf[ i ] = (char)rShapeType[ i ];
+	pBuf[ i ] = 0;
+	TypeACCNameHashMap::iterator aHashIter( pACCHashMap->find( pBuf ) );
+	delete[] pBuf;
+	if ( aHashIter != pACCHashMap->end() )
+		sRetValue = rtl::OUString::createFromAscii( (*aHashIter).second );
+	return sRetValue;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/svx/source/dialog/_bmpmask.cxx b/main/svx/source/dialog/_bmpmask.cxx
index 702deb4..d437724 100644
--- a/main/svx/source/dialog/_bmpmask.cxx
+++ b/main/svx/source/dialog/_bmpmask.cxx
@@ -137,6 +137,9 @@
 
 void MaskSet::GetFocus()
 {
+	//IAccessibility2 Implementation 2009-----
+	ValueSet::GetFocus();
+	//-----IAccessibility2 Implementation 2009
 	SelectItem( 1 );
 	pSvxBmpMask->onSelect( this );
 }
@@ -327,10 +330,13 @@
 
 IMPL_LINK( MaskData, FocusLbHdl, ColorLB*, pLb )
 {
-	pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 );
-	pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 );
-	pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 );
-	pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 );
+	//IAccessibility2 Implementation 2009-----
+	// MT: bFireFox as API parameter is ugly, find better solution????
+	pMask->pQSet1->SelectItem( pLb == &( pMask->aLbColor1 ) ? 1 : 0 /* , false */ );
+	pMask->pQSet2->SelectItem( pLb == &( pMask->aLbColor2 ) ? 1 : 0 /* , false */ );
+	pMask->pQSet3->SelectItem( pLb == &( pMask->aLbColor3 ) ? 1 : 0 /* , false */ );
+	pMask->pQSet4->SelectItem( pLb == &( pMask->aLbColor4 ) ? 1 : 0 /* , false */ );
+	//-----IAccessibility2 Implementation 2009
 
 	return 0;
 }
@@ -477,35 +483,57 @@
 	pQSet1->SetColCount( 1 );
 	pQSet1->SetLineCount( 1 );
 //	pQSet1->SetExtraSpacing( 1 );
-	pQSet1->InsertItem( 1, aPipetteColor );
+	//-----IAccessibility2 Implementation 2009
+	String sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE));
+    String sColorPaletteN;
+    sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+	//pQSet1->InsertItem( 1, aPipetteColor );
+	pQSet1->InsertItem( 1, aPipetteColor, sColorPaletteN);
+	//IAccessibility2 Implementation 2009-----
 	pQSet1->SelectItem( 1 );
 
 	pQSet2->SetStyle( pQSet2->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
 	pQSet2->SetColCount( 1 );
 	pQSet2->SetLineCount( 1 );
 //	pQSet2->SetExtraSpacing( 1 );
-	pQSet2->InsertItem( 1, aPipetteColor );
+	//IAccessibility2 Implementation 2009-----
+	sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+	//pQSet2->InsertItem( 1, aPipetteColor );
+	pQSet2->InsertItem( 1, aPipetteColor, sColorPaletteN);
+	//-----IAccessibility2 Implementation 2009
 	pQSet2->SelectItem( 0 );
 
 	pQSet3->SetStyle( pQSet3->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
 	pQSet3->SetColCount( 1 );
 	pQSet3->SetLineCount( 1 );
 //	pQSet3->SetExtraSpacing( 1 );
-	pQSet3->InsertItem( 1, aPipetteColor );
+	//IAccessibility2 Implementation 2009-----
+	sColorPaletteN = sColorPalette;
+ 	sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+	pQSet3->InsertItem( 1, aPipetteColor, sColorPaletteN);
+	//pQSet3->InsertItem( 1, aPipetteColor );
+	//-----IAccessibility2 Implementation 2009
 	pQSet3->SelectItem( 0 );
 
 	pQSet4->SetStyle( pQSet4->GetStyle() | WB_DOUBLEBORDER | WB_ITEMBORDER );
 	pQSet4->SetColCount( 1 );
 	pQSet4->SetLineCount( 1 );
 //	pQSet4->SetExtraSpacing( 1 );
-	pQSet4->InsertItem( 1, aPipetteColor );
+	//IAccessibility2 Implementation 2009-----
+	sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+	pQSet4->InsertItem( 1, aPipetteColor, sColorPaletteN);
+	//pQSet4->InsertItem( 1, aPipetteColor );
+	//-----IAccessibility2 Implementation 2009
 	pQSet4->SelectItem( 0 );
 
 	pQSet1->Show();
 	pQSet2->Show();
 	pQSet3->Show();
 	pQSet4->Show();
-
+	//IAccessibility2 Implementation 2009-----
 	aCbx1.SetAccessibleRelationMemberOf( &aGrpQ );
 	pQSet1->SetAccessibleRelationMemberOf( &aGrpQ );
 	aSp1.SetAccessibleRelationMemberOf( &aGrpQ );
@@ -541,6 +569,7 @@
 	aLbColorTrans.SetAccessibleRelationLabeledBy( &aCbxTrans );
 	aLbColorTrans.SetAccessibleRelationMemberOf( &aGrpQ );
 	aCbxTrans.SetAccessibleRelationMemberOf( &aGrpQ );
+	//-----IAccessibility2 Implementation 2009
 }
 
 //-------------------------------------------------------------------------
@@ -1271,4 +1300,51 @@
     sSourceColorN = sSourceColor;
     sSourceColorN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
     aCbx4.SetAccessibleName (sSourceColorN);
+	//IAccessibility2 Implementation 2009-----
+	// set the accessible name for valueset
+	String sColorPalette (BMP_RESID( RID_SVXDLG_BMPMASK_STR_PALETTE));
+    String sColorPaletteN;
+    sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+    pQSet1->SetText (sColorPaletteN);
+    sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+    pQSet2->SetText (sColorPaletteN);
+    sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+    pQSet3->SetText (sColorPaletteN);
+    sColorPaletteN = sColorPalette;
+    sColorPaletteN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+    pQSet4->SetText (sColorPaletteN);
+    // set the accessible for replace with spin boxes.
+	String sTolerance(BMP_RESID( RID_SVXDLG_BMPMASK_STR_TOLERANCE));
+    String sToleranceN;
+    sToleranceN = sTolerance;
+    sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+    aSp1.SetAccessibleName (sToleranceN);
+    sToleranceN = sTolerance;
+    sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+    aSp2.SetAccessibleName (sToleranceN);
+    sToleranceN = sTolerance;
+    sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+    aSp3.SetAccessibleName (sToleranceN);
+    sToleranceN = sTolerance;
+    sToleranceN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+    aSp4.SetAccessibleName (sToleranceN);
+    // set the accessible for replace with combo boxes.
+   	String sReplaceWith(BMP_RESID( RID_SVXDLG_BMPMASK_STR_REPLACEWITH));
+    String sReplaceWithN;
+    sReplaceWithN = sReplaceWith;
+    sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 1"));
+    aLbColor1.SetAccessibleName (sReplaceWithN);
+    sReplaceWithN = sReplaceWith;
+    sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 2"));
+    aLbColor2.SetAccessibleName (sReplaceWithN);
+    sReplaceWithN = sReplaceWith;
+    sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 3"));
+    aLbColor3.SetAccessibleName (sReplaceWithN);
+    sReplaceWithN = sReplaceWith;
+    sReplaceWithN.AppendAscii (RTL_CONSTASCII_STRINGPARAM (" 4"));
+    aLbColor4.SetAccessibleName (sReplaceWithN); 
+	//-----IAccessibility2 Implementation 2009
 }
diff --git a/main/svx/source/dialog/charmap.cxx b/main/svx/source/dialog/charmap.cxx
index b5cc3b5..a7a33b0 100644
--- a/main/svx/source/dialog/charmap.cxx
+++ b/main/svx/source/dialog/charmap.cxx
@@ -136,7 +136,8 @@
             CaptureMouse();
 
             int nIndex = PixelToMapIndex( rMEvt.GetPosPixel() );
-            SelectIndex( nIndex );
+	    // Fire the focus event
+            SelectIndex( nIndex , sal_True);
         }
 
         if ( !(rMEvt.GetClicks() % 2) )
@@ -177,7 +178,8 @@
             aPos.Y() = aSize.Height()-5;
 
         int nIndex = PixelToMapIndex( aPos );
-        SelectIndex( nIndex );
+	// Fire the focus event. 
+        SelectIndex( nIndex , sal_True );
     }
 }
 
@@ -585,12 +587,18 @@
 		if( m_pAccessible )
 		{
 			::svx::SvxShowCharSetItem* pItem = ImplGetItem(nSelectedIndex);
-			m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
+			// Don't fire the focus event. 
+			if ( bFocus )
+				m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
+			else
+				m_pAccessible->fireEvent( AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS, Any(), makeAny(pItem->GetAccessible()) ); // this call asures that m_pItem is set
 
 			OSL_ENSURE(pItem->m_pItem,"No accessible created!");
 			Any aOldAny, aNewAny;
 			aNewAny <<= AccessibleStateType::FOCUSED;
-			pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
+			// Don't fire the focus event. 
+			if ( bFocus )
+				pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
 
 			aNewAny <<= AccessibleStateType::SELECTED;
 			pItem->m_pItem->fireEvent( AccessibleEventId::STATE_CHANGED, aOldAny, aNewAny );
diff --git a/main/svx/source/dialog/ctredlin.cxx b/main/svx/source/dialog/ctredlin.cxx
index c74e73d..28d64ea 100644
--- a/main/svx/source/dialog/ctredlin.cxx
+++ b/main/svx/source/dialog/ctredlin.cxx
@@ -1345,6 +1345,29 @@
 	Enable( false, bChild );
 }
 
+//IAccessibility2 Implementation 2009-----
+void SvxTPFilter::SetAccessibleRelationMemberOf( Window* pWin )
+{
+	aCbDate.SetAccessibleRelationMemberOf(pWin);
+	aLbDate.SetAccessibleRelationMemberOf(pWin);
+	aDfDate.SetAccessibleRelationMemberOf(pWin);
+	aTfDate.SetAccessibleRelationMemberOf(pWin);
+	aIbClock.SetAccessibleRelationMemberOf(pWin);
+	aFtDate2.SetAccessibleRelationMemberOf(pWin);
+	aDfDate2.SetAccessibleRelationMemberOf(pWin);
+	aTfDate2.SetAccessibleRelationMemberOf(pWin);
+	aIbClock2.SetAccessibleRelationMemberOf(pWin);
+	aCbAuthor.SetAccessibleRelationMemberOf(pWin);
+	aLbAuthor.SetAccessibleRelationMemberOf(pWin);
+	aCbRange.SetAccessibleRelationMemberOf(pWin);
+	aEdRange.SetAccessibleRelationMemberOf(pWin);
+	aBtnRange.SetAccessibleRelationMemberOf(pWin);
+	aLbAction.SetAccessibleRelationMemberOf(pWin);
+	aCbComment.SetAccessibleRelationMemberOf(pWin);
+	aEdComment.SetAccessibleRelationMemberOf(pWin);
+}
+//-----IAccessibility2 Implementation 2009
+
 IMPL_LINK( SvxTPFilter, ModifyDate, void*,pTF)
 {
 
diff --git a/main/svx/source/dialog/ctredlin.src b/main/svx/source/dialog/ctredlin.src
index 4253683..6ee0664 100644
--- a/main/svx/source/dialog/ctredlin.src
+++ b/main/svx/source/dialog/ctredlin.src
@@ -277,6 +277,10 @@
 	{
 		Text [ en-US ] = "End Time" ;
 	};
+	String STR_TREE
+	{
+		Text [ en-US ] = "Changes" ;
+	};
 	/*-----IAccessibility2 Implementation 2009*/
 };
 TabPage SID_REDLIN_VIEW_PAGE
@@ -354,10 +358,6 @@
 	{
 		Text [ en-US ] = "Comment" ;
 	};
-	String STR_TREE
-	{
-		Text [ en-US ] = "Changes" ;
-	};
 };
 
 
diff --git a/main/svx/source/dialog/dlgctrl.cxx b/main/svx/source/dialog/dlgctrl.cxx
index 7128615..8566d6f 100644
--- a/main/svx/source/dialog/dlgctrl.cxx
+++ b/main/svx/source/dialog/dlgctrl.cxx
@@ -37,6 +37,18 @@
 #include <vcl/region.hxx>
 #include <vcl/gradient.hxx>
 #include <vcl/hatch.hxx>
+// IAccessibility2 implementation 2009. ------
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTOBJECT_HPP_
+#include <com/sun/star/accessibility/AccessibleEventObject.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEEVENTID_HPP_
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+#include "svxpixelctlaccessiblecontext.hxx"
+// ------ IAccessibility2 implementation 2009.
 #include <svtools/colorcfg.hxx>
 #include <svxrectctaccessiblecontext.hxx>
 #include <com/sun/star/lang/XUnoTunnel.hpp>
@@ -563,6 +575,15 @@
 void SvxRectCtl::GetFocus()
 {
 	SetFocusRect();
+	// IAccessibility2 implementation 2009. ------
+	//Solution: Send the accessible focused event
+	Control::GetFocus();
+	// Send accessibility event.
+	if(pAccContext)
+	{
+		pAccContext->FireChildFocus(GetActualRP());		
+	}
+	// ------ IAccessibility2 implementation 2009.
 }
 
 
@@ -656,9 +677,10 @@
 |*	Gibt den aktuell ausgewaehlten RECT_POINT zur�ck
 |*
 \************************************************************************/
-
-void SvxRectCtl::SetActualRP( RECT_POINT eNewRP )
+// IAccessibility2 implementation 2009. ------
+void SvxRectCtl::SetActualRP( RECT_POINT eNewRP /* MT: , sal_Bool bFireFocus */ )
 {
+	// MT: bFireFox as API parameter is ugly...
 	Point aPtLast( SetActualRPWithoutInvalidate( eNewRP ) );
 
 	Invalidate( Rectangle( aPtLast - Point( nRadius, nRadius ), aPtLast + Point( nRadius, nRadius ) ) );
@@ -666,9 +688,9 @@
 
 	// notify accessibility object about change
 	if( pAccContext )
-		pAccContext->selectChild( eNewRP );
+		pAccContext->selectChild( eNewRP /* MT, bFireFocus */ );
 }
-
+// ------ IAccessibility2 implementation 2009.
 void SvxRectCtl::SetState( CTL_STATE nState )
 {
 	m_nState = nState;
@@ -863,11 +885,74 @@
 |*	Control zum Editieren von Bitmaps
 |*
 \************************************************************************/
+// IAccessibility2 implementation 2009. ------
 
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SvxPixelCtl::CreateAccessible()
+{
+    if(!m_xAccess.is())
+	{
+		m_xAccess = m_pAccess =  new SvxPixelCtlAccessible(*this);	
+	}	
+    return m_xAccess;
+}
+
+//Logic Pixel
+long SvxPixelCtl::PointToIndex(const Point &aPt) const 
+{
+	sal_uInt16	nX, nY;
+
+	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
+	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
+
+	return nX + nY * nLines ;
+}
+Point SvxPixelCtl::IndexToPoint(long nIndex) const 
+{
+	DBG_ASSERT(nIndex >= 0 && nIndex < nSquares ," Check Index");
+
+	sal_uInt16 nXIndex = nIndex % nLines ;
+	sal_uInt16 nYIndex = sal_uInt16(nIndex / nLines) ;
+	
+	Point aPtTl;
+	aPtTl.Y() = aRectSize.Height() * nYIndex / nLines + 1;
+	aPtTl.X() = aRectSize.Width() * nXIndex / nLines + 1;
+
+	return aPtTl;
+}
+long SvxPixelCtl::GetFoucsPosIndex() const 
+{
+	return aFocusPosition.getX() + aFocusPosition.getY() * nLines ;
+}
+long SvxPixelCtl::ShowPosition( const Point &pt)
+{
+	Point aPt = PixelToLogic( pt );
+	
+	sal_uInt16	nX, nY;
+	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
+	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
+
+	ChangePixel( nX + nY * nLines );
+
+	//Solution:Set new focus position and repaint
+	//Invalidate( Rectangle( aPtTl, aPtBr ) );
+	aFocusPosition.setX(nX);
+	aFocusPosition.setY(nY);
+	Invalidate(Rectangle(Point(0,0),aRectSize));
+
+	if( WINDOW_TABPAGE == GetParent()->GetType() )
+		( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
+
+	return GetFoucsPosIndex();
+
+}
+// ------ IAccessibility2 implementation 2009.
 SvxPixelCtl::SvxPixelCtl( Window* pParent, const ResId& rResId, sal_uInt16 nNumber ) :
 						Control		( pParent, rResId ),
 						nLines		( nNumber ),
 						bPaintable	( sal_True )
+						// IAccessibility2 implementation 2009. ------
+						//Solution:Initialize it's value to Point(0,0)
+						,aFocusPosition(0,0)
 {
 	// SetMapMode( MAP_100TH_MM );
 	aRectSize = GetOutputSize();
@@ -879,6 +964,8 @@
 	nSquares = nLines * nLines;
 	pPixel = new sal_uInt16[ nSquares ];
 	rtl_zeroMemory(pPixel, nSquares * sizeof(sal_uInt16));
+	// IAccessibility2 implementation 2009. ------
+	m_pAccess=NULL;
 }
 
 /*************************************************************************
@@ -914,24 +1001,37 @@
 
 void SvxPixelCtl::MouseButtonDown( const MouseEvent& rMEvt )
 {
-	Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
-	Point aPtTl, aPtBr;
-	sal_uInt16	nX, nY;
+	// IAccessibility2 implementation 2009. ------
+	//Point aPt = PixelToLogic( rMEvt.GetPosPixel() );
+	//Point aPtTl, aPtBr;
+	//sal_uInt16	nX, nY;
 
-	nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
-	nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
+	//nX = (sal_uInt16) ( aPt.X() * nLines / aRectSize.Width() );
+	//nY = (sal_uInt16) ( aPt.Y() * nLines / aRectSize.Height() );
 
-	ChangePixel( nX + nY * nLines );
+	//ChangePixel( nX + nY * nLines );
 
-	aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
-	aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
-	aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
-	aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
+	//aPtTl.X() = aRectSize.Width() * nX / nLines + 1;
+	//aPtBr.X() = aRectSize.Width() * (nX + 1) / nLines - 1;
+	//aPtTl.Y() = aRectSize.Height() * nY / nLines + 1;
+	//aPtBr.Y() = aRectSize.Height() * (nY + 1) / nLines - 1;
 
-	Invalidate( Rectangle( aPtTl, aPtBr ) );
+	//Invalidate( Rectangle( aPtTl, aPtBr ) );
 
-	if( WINDOW_TABPAGE == GetParent()->GetType() )
-		( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
+	//if( WINDOW_TABPAGE == GetParent()->GetType() )
+	//	( (SvxTabPage*) GetParent() )->PointChanged( this, RP_MM ); // RectPoint ist dummy
+	//Solution:Grab focus when click in window
+	if( !HasFocus() )
+	{		
+		GrabFocus();
+	}
+	long nIndex = ShowPosition(rMEvt.GetPosPixel());
+
+	if(m_pAccess)
+	{
+		m_pAccess->NotifyChild(nIndex,sal_True,sal_True);
+	}
+	// ------ IAccessibility2 implementation 2009.
 }
 
 /*************************************************************************
@@ -982,6 +1082,13 @@
 				DrawRect( Rectangle( aPtTl, aPtBr ) );
 			}
 		}
+		// IAccessibility2 implementation 2009. ------
+		//Solution:Draw visual focus when has focus
+		if( HasFocus() )
+		{
+			ShowFocus(implCalFocusRect(aFocusPosition));	
+		}
+		// ------ IAccessibility2 implementation 2009.
 	} // bPaintable
 	else
 	{
@@ -991,6 +1098,130 @@
 		DrawLine( Point( 0, aRectSize.Height() ), Point( aRectSize.Width(), 0 ) );
 	}
 }
+// IAccessibility2 implementation 2009. ------
+//Solution:Caculate visual focus rectangle via focus position
+Rectangle SvxPixelCtl::implCalFocusRect( const Point& aPosition )
+{
+	long nLeft,nTop,nRight,nBottom;
+	long i,j;
+	i = aPosition.Y();
+	j = aPosition.X();
+	nLeft = aRectSize.Width() * j / nLines + 1;
+	nRight = aRectSize.Width() * (j + 1) / nLines - 1;
+	nTop = aRectSize.Height() * i / nLines + 1;
+	nBottom = aRectSize.Height() * (i + 1) / nLines - 1;
+	return Rectangle(nLeft,nTop,nRight,nBottom);
+}
+
+//Solution:Keyboard fucntion
+void SvxPixelCtl::KeyInput( const KeyEvent& rKEvt )
+{
+	KeyCode aKeyCode = rKEvt.GetKeyCode();
+	sal_uInt16 nCode = aKeyCode.GetCode();
+	sal_Bool bIsMod = aKeyCode.IsShift() || aKeyCode.IsMod1() || aKeyCode.IsMod2();
+						
+	if( !bIsMod )
+	{
+		Point pRepaintPoint( aRectSize.Width() *( aFocusPosition.getX() - 1)/ nLines - 1,
+		                     aRectSize.Height() *( aFocusPosition.getY() - 1)/ nLines -1
+		                    );
+		Size  mRepaintSize( aRectSize.Width() *3/ nLines + 2,aRectSize.Height() *3/ nLines + 2);
+		Rectangle mRepaintRect( pRepaintPoint, mRepaintSize );			
+		sal_Bool bFocusPosChanged=sal_False;
+		switch(nCode)
+		{
+			case KEY_LEFT:
+				if((aFocusPosition.getX() >= 1))
+				{
+					aFocusPosition.setX( aFocusPosition.getX() - 1 );
+					Invalidate(mRepaintRect);
+					bFocusPosChanged=sal_True;
+				}
+				break;
+			case KEY_RIGHT:
+				if( aFocusPosition.getX() < (nLines - 1) )
+				{
+					aFocusPosition.setX( aFocusPosition.getX() + 1 );
+					Invalidate(mRepaintRect);
+					bFocusPosChanged=sal_True;
+				}
+				break;					
+			case KEY_UP:
+				if((aFocusPosition.getY() >= 1))
+				{
+					aFocusPosition.setY( aFocusPosition.getY() - 1 );
+					Invalidate(mRepaintRect);
+					bFocusPosChanged=sal_True;
+				}
+				break;
+			case KEY_DOWN:
+				if( aFocusPosition.getY() < ( nLines - 1 ) )
+				{
+					aFocusPosition.setY( aFocusPosition.getY() + 1 );
+					Invalidate(mRepaintRect);
+					bFocusPosChanged=sal_True;
+				}
+				break;
+			case KEY_SPACE:
+				ChangePixel( sal_uInt16(aFocusPosition.getX() + aFocusPosition.getY() * nLines) );
+				Invalidate( implCalFocusRect(aFocusPosition) );
+				break;
+			default:
+				Control::KeyInput( rKEvt );		
+				return;
+		}
+		if(m_xAccess.is())
+		{
+			long nIndex = GetFoucsPosIndex();
+			switch(nCode)
+			{
+			case KEY_LEFT:
+			case KEY_RIGHT:
+			case KEY_UP:
+			case KEY_DOWN:
+				if (bFocusPosChanged)
+				{
+					m_pAccess->NotifyChild(nIndex,sal_False,sal_False);
+				}				
+				break;
+			case KEY_SPACE:
+				m_pAccess->NotifyChild(nIndex,sal_False,sal_True);
+				break;
+			default:
+				break;
+			}
+		}
+	}
+	else
+	{
+		Control::KeyInput( rKEvt );
+	}
+}
+
+//Draw focus when get focus
+void SvxPixelCtl::GetFocus()
+{
+	Invalidate(implCalFocusRect(aFocusPosition));
+	
+	if(m_pAccess)
+	{
+		m_pAccess->NotifyChild(GetFoucsPosIndex(),sal_True,sal_False);
+	}
+
+	Control::GetFocus();
+}
+
+//Hide focus when lose focus
+void SvxPixelCtl::LoseFocus()
+{
+	HideFocus();
+	if (m_pAccess)
+	{
+		m_pAccess->LoseFocus();
+	}
+	Control::LoseFocus();
+}
+// ------ IAccessibility2 implementation 2009.
 
 /*************************************************************************
 |*
diff --git a/main/svx/source/dialog/frmsel.cxx b/main/svx/source/dialog/frmsel.cxx
index 6cc1672..11dc0a5 100644
--- a/main/svx/source/dialog/frmsel.cxx
+++ b/main/svx/source/dialog/frmsel.cxx
@@ -30,6 +30,12 @@
 #include "frmselimpl.hxx"
 #include "AccessibleFrameSelector.hxx"
 #include <svx/dialmgr.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HDL_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
 
 #ifndef _SVX_DIALOGS_HRC
 #include <svx/dialogs.hrc>
@@ -43,8 +49,11 @@
 namespace svx {
 
 using ::com::sun::star::uno::Reference;
+//IAccessibility2 Implementation 2009-----
+using ::com::sun::star::uno::Any;
 using ::com::sun::star::accessibility::XAccessible;
-
+using namespace ::com::sun::star::accessibility;
+//-----IAccessibility2 Implementation 2009
 // ============================================================================
 // global functions from framebordertype.hxx
 
@@ -696,10 +705,24 @@
 void FrameSelectorImpl::SetBorderState( FrameBorder& rBorder, FrameBorderState eState )
 {
     DBG_ASSERT( rBorder.IsEnabled(), "svx::FrameSelectorImpl::SetBorderState - access to disabled border" );
+	//IAccessibility2 Implementation 2009-----
+	Any aOld;
+	Any aNew;
+	Any& rMod = eState == FRAMESTATE_SHOW ? aNew : aOld;
+	rMod <<= AccessibleStateType::CHECKED;
+	Reference< XAccessible > xRet;
+    size_t nVecIdx = static_cast< size_t >( rBorder.GetType() );
+    if( GetBorder(rBorder.GetType()).IsEnabled() && (1 <= nVecIdx) && (nVecIdx <= maChildVec.size()) )
+        xRet = mxChildVec[ --nVecIdx ];
+	a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get());
+
     if( eState == FRAMESTATE_SHOW )
         SetBorderCoreStyle( rBorder, &maCurrStyle );
     else
         rBorder.SetState( eState );
+	if (pFrameSelector)
+			pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOld, aNew );
+	//-----IAccessibility2 Implementation 2009
     DoInvalidate( true );
 }
 
@@ -914,9 +937,23 @@
     return mxImpl->GetBorder( eBorder ).IsSelected();
 }
 
-void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect )
+void FrameSelector::SelectBorder( FrameBorderType eBorder, bool bSelect /*, bool bFocus */ )
 {
     mxImpl->SelectBorder( mxImpl->GetBorderAccess( eBorder ), bSelect );
+	//IAccessibility2 Implementation 2009-----
+	// MT: bFireFox as API parameter is ugly...
+	// if (bFocus)
+	{
+		Reference< XAccessible > xRet = GetChildAccessible(eBorder);
+		a11y::AccFrameSelector* pFrameSelector = static_cast<a11y::AccFrameSelector*>(xRet.get());
+		if (pFrameSelector)
+		{
+			Any aOldValue, aNewValue;
+			aNewValue <<= AccessibleStateType::FOCUSED;
+			pFrameSelector->NotifyAccessibleEvent( AccessibleEventId::STATE_CHANGED, aOldValue, aNewValue );
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 bool FrameSelector::IsAnyBorderSelected() const
@@ -1063,7 +1100,10 @@
                 if( !(*aIt)->IsSelected() )
                 {
                     bNewSelected = true;
-                    mxImpl->SelectBorder( **aIt, true );
+			//IAccessibility2 Implementation 2009-----
+                    //mxImpl->SelectBorder( **aIt, true );
+			SelectBorder((**aIt).GetType(), true);
+			//-----IAccessibility2 Implementation 2009
                 }
             }
             else
@@ -1160,6 +1200,31 @@
     mxImpl->DoInvalidate( false );
     if( mxImpl->mxAccess.is() )
         mxImpl->mpAccess->NotifyFocusListeners( sal_True );
+	//IAccessibility2 Implementation 2009-----
+	if (IsAnyBorderSelected())
+	{
+		FrameBorderType borderType = FRAMEBORDER_NONE;
+		if (mxImpl->maLeft.IsSelected())
+			borderType = FRAMEBORDER_LEFT;
+		else if (mxImpl->maRight.IsSelected())
+			borderType = FRAMEBORDER_RIGHT;
+		else if (mxImpl->maTop.IsSelected())
+			borderType = FRAMEBORDER_TOP;
+		else if (mxImpl->maBottom.IsSelected())
+			borderType = FRAMEBORDER_BOTTOM;
+		else if (mxImpl->maHor.IsSelected())
+			borderType = FRAMEBORDER_HOR;
+		else if (mxImpl->maVer.IsSelected())
+			borderType = FRAMEBORDER_VER;
+		else if (mxImpl->maTLBR.IsSelected())
+			borderType = FRAMEBORDER_TLBR;
+		else if (mxImpl->maBLTR.IsSelected())
+			borderType = FRAMEBORDER_BLTR;
+		SelectBorder(borderType);
+	}
+	for( SelFrameBorderIter aIt( mxImpl->maEnabBorders ); aIt.Is(); ++aIt )
+			mxImpl->SetBorderState( **aIt, FRAMESTATE_SHOW );
+	//-----IAccessibility2 Implementation 2009
     Control::GetFocus();
 }
 
diff --git a/main/svx/source/dialog/srchdlg.cxx b/main/svx/source/dialog/srchdlg.cxx
index d728e54..7ab33e7 100644
--- a/main/svx/source/dialog/srchdlg.cxx
+++ b/main/svx/source/dialog/srchdlg.cxx
@@ -70,6 +70,14 @@
 #include <tools/resary.hxx>
 #include <svx/svxdlg.hxx> //CHINA001
 
+//IAccessibility2 Impplementaton 2009-----
+#ifndef _ACCESSIBLESVXFINDREPLACEDIALOG_HXX_
+#include <svx/AccessibleSvxFindReplaceDialog.hxx>
+#endif
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+//-----IAccessibility2 Impplementaton 2009
+
 #include <sfx2/layout-pre.hxx>
 
 using namespace com::sun::star::i18n;
@@ -293,6 +301,8 @@
 
 #undef INI_LIST
 #define INI_LIST() \
+	mpDocWin		(NULL),										\
+	mbSuccess		(sal_False),									\
 	aSearchText 	( this, SVX_RES( FT_SEARCH ) ),							\
 	aSearchLB		( this, SVX_RES( ED_SEARCH ) ),							\
 	aSearchTmplLB	( this, SVX_RES( LB_SEARCH ) ),							\
@@ -2506,6 +2516,23 @@
     rBindings.GetDispatcher()->Execute( SID_SEARCH_ITEM, SFX_CALLMODE_SLOT, ppArgs );
 }
 
+//IAccessible2 Implementation 2009-----
+::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > 
+		SvxSearchDialog::GetComponentInterface( sal_Bool bCreate )
+{
+    ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > xPeer 
+		(Window::GetComponentInterface(false));
+	if ( !xPeer.is() && bCreate )
+    {
+		::com::sun::star::awt::XWindowPeer* mxPeer = new VCLXSvxFindReplaceDialog(this);		
+		SetComponentInterface(mxPeer);
+		return mxPeer;
+    }
+	else
+		return xPeer;
+}
+//-----IAccessible2 Implementation 2009
+
 // class SvxSearchDialogWrapper ------------------------------------------
 
 SFX_IMPL_CHILDWINDOW(SvxSearchDialogWrapper, SID_SEARCH_DLG);
diff --git a/main/svx/source/inc/AccessibleFrameSelector.hxx b/main/svx/source/inc/AccessibleFrameSelector.hxx
index 9a7d712..cc5361b 100644
--- a/main/svx/source/inc/AccessibleFrameSelector.hxx
+++ b/main/svx/source/inc/AccessibleFrameSelector.hxx
@@ -108,16 +108,13 @@
 
     void    Invalidate();
     void    NotifyFocusListeners(sal_Bool bGetFocus);
+	void    NotifyAccessibleEvent( const sal_Int16 _nEventId, const ::com::sun::star::uno::Any& _rOldValue, const ::com::sun::star::uno::Any& _rNewValue );
 
 protected:
     DECL_LINK( WindowEventListener, VclSimpleEvent* );
 
     virtual void    ProcessWindowEvent( const VclWindowEvent& rVclWindowEvent );
 
-    void    NotifyAccessibleEvent( const sal_Int16 _nEventId,
-                                   const ::com::sun::star::uno::Any& _rOldValue,
-                                   const ::com::sun::star::uno::Any& _rNewValue );
-
 private:
     void                IsValid() throw (::com::sun::star::uno::RuntimeException);
 
diff --git a/main/svx/source/inc/svxpixelctlaccessiblecontext.hxx b/main/svx/source/inc/svxpixelctlaccessiblecontext.hxx
new file mode 100644
index 0000000..32e6d5f
--- /dev/null
+++ b/main/svx/source/inc/svxpixelctlaccessiblecontext.hxx
@@ -0,0 +1,431 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _SVXPIXELACCESSIBLECONTEXT_HXX
+#define _SVXPIXELACCESSIBLECONTEXT_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HPP_
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLESELECTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_XPROPERTYCHANGELISTENER_HPP_
+#include <com/sun/star/beans/XPropertyChangeListener.hpp>
+#endif
+#ifndef	_COM_SUN_STAR_UNO_REFERENCE_HXX_
+#include <com/sun/star/uno/Reference.hxx>
+#endif
+#ifndef	_CPPUHELPER_WEAK_HXX_
+#include <cppuhelper/weak.hxx>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XTYPEPROVIDER_HPP_
+#include <com/sun/star/lang/XTypeProvider.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICENAME_HPP_
+#include <com/sun/star/lang/XServiceName.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _VOS_MUTEX_HXX_
+#include <vos/mutex.hxx>
+#endif
+#ifndef _CPPUHELPER_INTERFACECONTAINER_H_
+#include <cppuhelper/interfacecontainer.h>
+#endif
+#ifndef _CPPUHELPER_COMPBASE6_HXX_
+#include <cppuhelper/compbase6.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE7_HXX_
+#include <cppuhelper/compbase7.hxx>
+#endif
+#ifndef _CPPUHELPER_COMPBASE5_HXX_
+#include <cppuhelper/compbase5.hxx>
+#endif
+#ifndef _COMPHELPER_BROADCASTHELPER_HXX_
+#include <comphelper/broadcasthelper.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE6_HXX_
+#include <cppuhelper/implbase6.hxx>
+#endif
+#include <comphelper/servicehelper.hxx>
+
+//#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETABLE_HPP_
+//#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+//#endif
+
+#ifndef _SVX_RECTENUM_HXX //autogen
+#include <rectenum.hxx>
+#endif
+
+
+#include <tools/gen.hxx>
+
+
+namespace com { namespace sun { namespace star { namespace awt {
+	struct Point;
+	struct Rectangle;
+	struct Size;
+	class XFocusListener;
+} } } };
+class SvxPixelCtl;
+
+
+typedef ::cppu::WeakAggComponentImplHelper5<
+			::com::sun::star::accessibility::XAccessible,
+			::com::sun::star::accessibility::XAccessibleComponent,
+			::com::sun::star::accessibility::XAccessibleContext,
+			::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+			::com::sun::star::lang::XServiceInfo >
+			SvxPixelCtlAccessibleChild_BASE;
+
+class SvxPixelCtlAccessibleChild :
+	public ::comphelper::OBaseMutex, 
+	public SvxPixelCtlAccessibleChild_BASE
+{
+	SvxPixelCtl* mrParentWindow;
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > mxParent;
+       void IsValid() throw (::com::sun::star::uno::RuntimeException);	
+	sal_Bool m_bPixelColorOrBG;//Pixel Color Or BackGround Color 
+	Point maPoint;
+	Rectangle*	mpBoundingBox;
+	/// index of child in parent
+	long								mnIndexInParent;	
+	///	Mutex guarding this object.
+    ::osl::Mutex						m_aMutex;	
+public:
+    SvxPixelCtlAccessibleChild(
+				SvxPixelCtl* rWindow, 
+				sal_Bool bPixelColorOrBG,
+				const Point& aPoint,
+				const Rectangle& rBounds,
+				const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >& xParent, 
+				long nIndexInParent );
+    ~SvxPixelCtlAccessibleChild();
+
+    //XAccessible
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    //XAccessibleContext
+    virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+	
+    //XAccessibleComponent
+    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);	
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
+    
+    //XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+    
+    //Methods for XAccessibleEventBroadcaster
+	sal_uInt32 mnClientId;
+
+	virtual void SAL_CALL
+		addEventListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+			throw( com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL
+		removeEventListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+			throw( com::sun::star::uno::RuntimeException );
+	void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
+	
+	//Solution: Add the event handling method
+	void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
+	virtual void SAL_CALL disposing();
+	
+	virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
+
+	virtual Rectangle GetBoundingBox( void ) throw( ::com::sun::star::uno::RuntimeException );
+	
+	/// @returns true if it's disposed or in disposing
+	inline sal_Bool IsAlive( void ) const;
+	/// @returns true if it's not disposed and no in disposing
+	inline sal_Bool IsNotAlive( void ) const;
+	/// throws the exception DisposedException if it's not alive
+	void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
+
+
+	void CheckChild();
+	void SelectChild( sal_Bool bSelect);
+	void ChangePixelColorOrBG(sal_Bool bPixelColorOrBG){ m_bPixelColorOrBG = bPixelColorOrBG ;}
+	::rtl::OUString GetName();
+};
+
+
+typedef ::cppu::WeakAggComponentImplHelper6<
+			::com::sun::star::accessibility::XAccessible,
+			::com::sun::star::accessibility::XAccessibleComponent,
+			::com::sun::star::accessibility::XAccessibleContext,
+			::com::sun::star::accessibility::XAccessibleEventBroadcaster,
+			::com::sun::star::accessibility::XAccessibleSelection,
+//			::com::sun::star::accessibility::XAccessibleTable,
+			::com::sun::star::lang::XServiceInfo >
+			SvxPixelCtlAccessible_BASE;
+
+class SvxPixelCtlAccessible :
+	public ::comphelper::OBaseMutex, 
+	public SvxPixelCtlAccessible_BASE
+{
+	SvxPixelCtl* pPixelCtl;
+    void IsValid() throw (::com::sun::star::uno::RuntimeException);	
+
+public:
+    SvxPixelCtlAccessible(SvxPixelCtl& rWindow);
+    ~SvxPixelCtlAccessible();
+
+	void ensureIsAlive() const throw ( ::com::sun::star::lang::DisposedException );
+
+    //XAccessible
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > SAL_CALL getAccessibleContext(  ) throw (::com::sun::star::uno::RuntimeException);
+
+    //XAccessibleContext
+    virtual sal_Int32 SAL_CALL getAccessibleChildCount(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleChild( sal_Int32 i ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getAccessibleIndexInParent(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int16 SAL_CALL getAccessibleRole(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleDescription(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet > SAL_CALL getAccessibleStateSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > SAL_CALL getAccessibleRelationSet(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::lang::Locale SAL_CALL getLocale(  ) throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+	
+    //XAccessibleComponent
+    virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);	
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocation(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Size SAL_CALL getSize(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getForeground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getBackground(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL grabFocus(  ) throw (::com::sun::star::uno::RuntimeException);
+    //XServiceInfo
+    virtual ::rtl::OUString SAL_CALL getImplementationName(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException);
+	// XAccessibleSelection
+	void SAL_CALL selectAccessibleChild( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	sal_Bool SAL_CALL isAccessibleChildSelected( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	void SAL_CALL clearAccessibleSelection(  ) throw (::com::sun::star::uno::RuntimeException);
+	void SAL_CALL selectAllAccessibleChildren(  ) throw (::com::sun::star::uno::RuntimeException);
+	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);
+
+/*
+	// XAccessibleTable -------------------------------------------------------
+    /-** @return  The number of used rows in the table (0 = empty table). *-/
+    virtual sal_Int32 SAL_CALL getAccessibleRowCount() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  The number of used columns in the table (0 = empty table). *-/
+    virtual sal_Int32 SAL_CALL getAccessibleColumnCount() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  The row extent of the specified cell (always 1). *-/
+    virtual sal_Int32 SAL_CALL getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+                ::com::sun::star::uno::RuntimeException );
+    /-** @return  The column extent of the specified cell (always 1). *-/
+    virtual sal_Int32 SAL_CALL getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+                ::com::sun::star::uno::RuntimeException );
+    /-** @return  The caption cell of the table (not supported). *-/
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+    	getAccessibleCaption() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  The summary object of the table (not supported). *-/
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+    	getAccessibleSummary() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  The child index of the specified cell. *-/
+    virtual sal_Int32 SAL_CALL getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  The row index of the specified child cell. *-/
+    virtual sal_Int32 SAL_CALL getAccessibleRow( sal_Int32 nChildIndex )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  The column index of the specified child cell. *-/
+    virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  The description text of the specified row. *-/
+    virtual ::rtl::OUString SAL_CALL getAccessibleRowDescription( sal_Int32 nRow )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  The description text of the specified column. *-/
+    virtual ::rtl::OUString SAL_CALL getAccessibleColumnDescription( sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  The XAccessibleTable interface of the row header bar. *-/
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+    	getAccessibleRowHeaders() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  The XAccessibleTable interface of the column header bar. *-/
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleTable > SAL_CALL
+    	getAccessibleColumnHeaders() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  An index list of completely selected rows. *-/
+    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+    	getSelectedAccessibleRows() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  An index list of completely selected columns. *-/
+    virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL
+    	getSelectedAccessibleColumns() throw ( ::com::sun::star::uno::RuntimeException );
+    /-** @return  <TRUE/>, if the specified row is completely selected. *-/
+    virtual sal_Bool SAL_CALL isAccessibleRowSelected( sal_Int32 nRow )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return  <TRUE/>, if the specified column is completely selected. *-/
+    virtual sal_Bool SAL_CALL isAccessibleColumnSelected( sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+    /-** @return The XAccessible interface of the cell object at the specified cell position. *-/
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL
+    	getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
+                ::com::sun::star::uno::RuntimeException );
+    /-** @return  <TRUE/>, if the specified cell is selected. *-/
+    virtual sal_Bool SAL_CALL isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException,::com::sun::star::uno::RuntimeException );
+                
+*/
+    //Methods for XAccessibleEventBroadcaster
+	sal_uInt32 mnClientId;
+
+	virtual void SAL_CALL
+		addEventListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+			throw( com::sun::star::uno::RuntimeException );
+
+	virtual void SAL_CALL
+		removeEventListener(
+			const ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+			throw( com::sun::star::uno::RuntimeException );
+	void CommitChange( const com::sun::star::accessibility::AccessibleEventObject& rEvent );
+	//Solution: Add the event handling method
+	void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
+	virtual void SAL_CALL disposing();
+
+	/// select child
+	void SelectChild( Point pos );
+	void SelectChild( long nIndex);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
+		 CreateChild (long nIndex, Point mPoint);
+
+
+	void LoseFocus();
+
+    void Invalidate();
+	/// @returns true if it's disposed or in disposing
+	inline sal_Bool IsAlive( void ) const;
+	/// @returns true if it's not disposed and no in disposing
+	inline sal_Bool IsNotAlive( void ) const;
+	/// throws the exception DisposedException if it's not alive
+	void ThrowExceptionIfNotAlive( void ) throw( ::com::sun::star::lang::DisposedException );
+
+protected:	
+	/** @attention  This method requires locked mutex's and a living object.
+        @throws <type>IndexOutOfBoundsException</type>
+        If the specified row index is invalid. */
+    void ensureIsValidRow( sal_Int32 nRow )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+    /** @attention  This method requires locked mutex's and a living object.
+        @throws <type>IndexOutOfBoundsException</type>
+        If the specified column index is invalid. */
+    void ensureIsValidColumn( sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+    /** @attention  This method requires locked mutex's and a living object.
+        @throws <type>IndexOutOfBoundsException</type>
+        If the specified cell address is invalid. */
+    void ensureIsValidAddress( sal_Int32 nRow, sal_Int32 nColumn )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+    /** @attention  This method requires locked mutex's and a living object.
+        @throws <type>IndexOutOfBoundsException</type>
+        If the specified child index is invalid. */
+    void ensureIsValidIndex( sal_Int32 nChildIndex )
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException );
+
+
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> m_xCurChild;
+public:
+	void NotifyChild(long nIndex,sal_Bool bSelect ,sal_Bool bCheck);
+};
+
+inline sal_Bool SvxPixelCtlAccessible::IsAlive( void ) const
+{
+	return !rBHelper.bDisposed && !rBHelper.bInDispose;
+}
+
+inline sal_Bool SvxPixelCtlAccessible::IsNotAlive( void ) const
+{
+	return rBHelper.bDisposed || rBHelper.bInDispose;
+}
+
+inline sal_Bool SvxPixelCtlAccessibleChild::IsAlive( void ) const
+{
+	return !rBHelper.bDisposed && !rBHelper.bInDispose;
+}
+
+inline sal_Bool SvxPixelCtlAccessibleChild::IsNotAlive( void ) const
+{
+	return rBHelper.bDisposed || rBHelper.bInDispose;
+}
+
+
+#endif
diff --git a/main/svx/source/inc/svxrectctaccessiblecontext.hxx b/main/svx/source/inc/svxrectctaccessiblecontext.hxx
index 89135cc..73cd0cb 100644
--- a/main/svx/source/inc/svxrectctaccessiblecontext.hxx
+++ b/main/svx/source/inc/svxrectctaccessiblecontext.hxx
@@ -43,9 +43,14 @@
 #include <vos/mutex.hxx>
 #include <cppuhelper/interfacecontainer.h>
 #include <cppuhelper/compbase6.hxx>
-//#ifndef _CPPUHELPER_COMPBASE7_HXX_
-//#include <cppuhelper/compbase7.hxx>
-//#endif
+//IAccessibility2 Implementation 2009-----
+#ifndef _CPPUHELPER_COMPBASE7_HXX_
+#include <cppuhelper/compbase7.hxx>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_ACTION_HPP_
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
 #include <comphelper/broadcasthelper.hxx>
 #include <cppuhelper/implbase6.hxx>
 #include <comphelper/servicehelper.hxx>
@@ -250,7 +255,10 @@
         @param nIndexOfChild
             Index of the new child which should be selected.
     */
-	void selectChild( long nIndexOfChild );
+	// IAccessibility2 implementation 2009. ------
+	//void selectChild( long nIndexOfChild );
+	void selectChild( long nIndexOfChild, sal_Bool bFireFocus = sal_True);
+	// ------ IAccessibility2 implementation 2009.
 
 public:
     /** Selects a new child by point.
@@ -261,8 +269,13 @@
         @param eButton
             Button which belongs to the child which should be selected.
     */
-	void selectChild( RECT_POINT ePoint );
-
+	//void selectChild( RECT_POINT ePoint );
+	// IAccessibility2 implementation 2009. ------
+	void selectChild( RECT_POINT ePoint, sal_Bool bFireFocus = sal_True );
+	void FireChildFocus( RECT_POINT eButton );
+	//Solution: Add the event handling method
+	void FireAccessibleEvent (short nEventId, const ::com::sun::star::uno::Any& rOld, const ::com::sun::star::uno::Any& rNew);
+	// ------ IAccessibility2 implementation 2009.
 	/// Sets the name
 	void setName( const ::rtl::OUString& rName );
 
@@ -332,15 +345,17 @@
 	return rBHelper.bDisposed || rBHelper.bInDispose;
 }
 
-
-typedef ::cppu::WeakAggComponentImplHelper6<
+//IAccessibility2 Implementation 2009-----
+typedef ::cppu::WeakAggComponentImplHelper7<
 			::com::sun::star::accessibility::XAccessible,
 			::com::sun::star::accessibility::XAccessibleComponent,
 			::com::sun::star::accessibility::XAccessibleContext,
 			::com::sun::star::accessibility::XAccessibleEventBroadcaster,
 			::com::sun::star::accessibility::XAccessibleValue,
+			::com::sun::star::accessibility::XAccessibleAction,
 			::com::sun::star::lang::XServiceInfo >
 			SvxRectCtlChildAccessibleContext_Base;
+//-----IAccessibility2 Implementation 2009
 
 
 class SvxRectCtlChildAccessibleContext : public SvxRectCtlChildAccessibleContext_Base
@@ -472,6 +487,13 @@
     virtual ::com::sun::star::uno::Any SAL_CALL
 		getMinimumValue() throw( ::com::sun::star::uno::RuntimeException );
 
+//IAccessibility2 Implementation 2009-----
+	// XAccessibleAction
+	virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 	//=====  XServiceInfo  ====================================================
 
 	virtual ::rtl::OUString SAL_CALL
@@ -492,8 +514,11 @@
 	//===== internal ==========================================================
 
 	/// Sets the checked status
-	void setStateChecked( sal_Bool bChecked );
-
+	//void setStateChecked( sal_Bool bChecked );
+	// IAccessibility2 implementation 2009. ------
+	void setStateChecked( sal_Bool bChecked, sal_Bool bFireFocus = sal_True);
+	void FireFocusEvent();
+	// ------ IAccessibility2 implementation 2009.
 protected:
 	virtual Rectangle GetBoundingBoxOnScreen( void ) throw( ::com::sun::star::uno::RuntimeException );
 
diff --git a/main/svx/source/sidebar/nbdtmg.cxx b/main/svx/source/sidebar/nbdtmg.cxx
index 5b7799c..5779003 100755
--- a/main/svx/source/sidebar/nbdtmg.cxx
+++ b/main/svx/source/sidebar/nbdtmg.cxx
@@ -301,7 +301,7 @@
 		{

 			eCoreUnit = pSet->GetPool()->GetMetric(pSet->GetPool()->GetWhich(SID_ATTR_NUMBERING_RULE));

 		} else {

-			//Sym3_2508 sd use different sid for numbering rule

+			//sd use different sid for numbering rule

 			eState = pSet->GetItemState(EE_PARA_NUMBULLET, sal_False, &pItem);

 			if(eState == SFX_ITEM_SET)

 			{

diff --git a/main/svx/source/svdraw/svdoashp.cxx b/main/svx/source/svdraw/svdoashp.cxx
index b6dbe65..6ee5632 100644
--- a/main/svx/source/svdraw/svdoashp.cxx
+++ b/main/svx/source/svdraw/svdoashp.cxx
@@ -3538,4 +3538,21 @@
 	mpLastShadowGeometry = 0L;
 }
 
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString SdrObjCustomShape::GetCustomShapeName()
+{
+	rtl::OUString sShapeName;
+	rtl::OUString aEngine( ( (SdrCustomShapeEngineItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_ENGINE ) ).GetValue() );
+	if ( !aEngine.getLength() || aEngine.equalsAscii( "com.sun.star.drawing.EnhancedCustomShapeEngine" ) )
+	{
+		rtl::OUString sShapeType;
+		const rtl::OUString	sType( RTL_CONSTASCII_USTRINGPARAM ( "Type" ) );
+		SdrCustomShapeGeometryItem& rGeometryItem( (SdrCustomShapeGeometryItem&)( *this ).GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) );
+		Any* pAny = rGeometryItem.GetPropertyValueByName( sType );
+		if ( pAny && ( *pAny >>= sShapeType ) )
+			sShapeName = EnhancedCustomShapeTypeNames::GetAccName( sShapeType );
+	}
+	return sShapeName;
+}
+//-----IAccessibility2 Implementation 2009
 // eof
diff --git a/main/svx/source/svdraw/svdobj.cxx b/main/svx/source/svdraw/svdobj.cxx
index 0f27fb6..81116c0 100644
--- a/main/svx/source/svdraw/svdobj.cxx
+++ b/main/svx/source/svdraw/svdobj.cxx
@@ -3185,6 +3185,12 @@
     return false;
 }
 
+//IAccessibility2 Implementation 2009-----
+const SdrObject* SdrObject::GetCaptionObj() const
+{
+	return pCaptionObj;
+}
+//-----IAccessibility2 Implementation 2009
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 //
 //   @@@@  @@@@@  @@@@@@  @@@@@  @@@@   @@@@  @@@@@@  @@@@  @@@@@  @@  @@
diff --git a/main/svx/source/svdraw/svdoole2.cxx b/main/svx/source/svdraw/svdoole2.cxx
index 0b22a17..ee7c834 100644
--- a/main/svx/source/svdraw/svdoole2.cxx
+++ b/main/svx/source/svdraw/svdoole2.cxx
@@ -844,7 +844,19 @@
 }
 
 // -----------------------------------------------------------------------------
+//IAccessibility2 Implementation 2009-----
+String SdrOle2Obj::GetStyleString()
+{
+	String strStyle;
+	if( xObjRef.is() && xObjRef.IsChart() )
+	{
+		strStyle = xObjRef.GetChartType();
+	}
+	return strStyle;
+}
 
+// -----------------------------------------------------------------------------
+//-----IAccessibility2 Implementation 2009
 SdrOle2Obj::~SdrOle2Obj()
 {
     DBG_DTOR( SdrOle2Obj,NULL);
diff --git a/main/svx/source/table/accessiblecell.cxx b/main/svx/source/table/accessiblecell.cxx
index 0015c5a..cad08e4 100644
--- a/main/svx/source/table/accessiblecell.cxx
+++ b/main/svx/source/table/accessiblecell.cxx
@@ -60,6 +60,8 @@
 , mpText( NULL )
 , mxCell( rCell )
 {
+	//Init the pAccTable var
+	pAccTable = dynamic_cast <AccessibleTableShape *> (rxParent.get());
 }
 
 // --------------------------------------------------------------------
@@ -242,7 +244,41 @@
                 else
                     pStateSet->RemoveState (AccessibleStateType::FOCUSED);
 			}
+			// Set the invisible state for merged cell 
+			if (mxCell.is() && mxCell->isMerged())
+				pStateSet->RemoveState(AccessibleStateType::VISIBLE);
+			else
+				pStateSet->AddState(AccessibleStateType::VISIBLE);
 
+
+			//IAccessibility2 Implementation 2009-----
+			//Solution:Just when the parent table is not read-only,set states EDITABLE,RESIZABLE,MOVEABLE
+		    ::com::sun::star::uno::Reference<XAccessible> xTempAcc = getAccessibleParent();
+		    if( xTempAcc.is() )
+		    {
+		    	::com::sun::star::uno::Reference<XAccessibleContext> 
+		    							xTempAccContext = xTempAcc->getAccessibleContext();
+		    	if( xTempAccContext.is() )
+		    	{
+		    		::com::sun::star::uno::Reference<XAccessibleStateSet> rState = 
+		    			xTempAccContext->getAccessibleStateSet();
+		    		if( rState.is() )    		{
+						com::sun::star::uno::Sequence<short> pStates = rState->getStates();
+						int count = pStates.getLength();
+						for( int iIndex = 0;iIndex < count;iIndex++ )
+						{
+							if( pStates[iIndex] == AccessibleStateType::EDITABLE )
+							{
+								pStateSet->AddState (AccessibleStateType::EDITABLE);
+							    pStateSet->AddState (AccessibleStateType::RESIZABLE);
+							    pStateSet->AddState (AccessibleStateType::MOVEABLE);
+								break;	
+							}
+						}
+					}
+				}
+		    }
+			//-----IAccessibility2 Implementation 2009
             // Create a copy of the state set that may be modified by the
             // caller without affecting the current state set.
             xStateSet = Reference<XAccessibleStateSet>(new ::utl::AccessibleStateSetHelper (*pStateSet));
@@ -566,6 +602,75 @@
     return mnIndexInParent;
 }
 
+//IAccessibility2 Implementation 2009-----
+sdr::table::CellRef AccessibleCell::getCellRef()
+{
+	return mxCell;
+}
+::rtl::OUString AccessibleCell::getCellName( sal_Int32 nCol, sal_Int32 nRow )
+{
+    rtl::OUStringBuffer aBuf;
+
+    if (nCol < 26*26)
+    {
+        if (nCol < 26)
+            aBuf.append( static_cast<sal_Unicode>( 'A' +
+                        static_cast<sal_uInt16>(nCol)));
+        else
+        {
+            aBuf.append( static_cast<sal_Unicode>( 'A' +
+                        (static_cast<sal_uInt16>(nCol) / 26) - 1));
+            aBuf.append( static_cast<sal_Unicode>( 'A' +
+                        (static_cast<sal_uInt16>(nCol) % 26)));
+        }
+    }
+    else
+    {
+        String aStr;
+        while (nCol >= 26)
+        {
+            sal_Int32 nC = nCol % 26;
+            aStr += static_cast<sal_Unicode>( 'A' +
+                    static_cast<sal_uInt16>(nC));
+            nCol = nCol - nC;
+            nCol = nCol / 26 - 1;
+        }
+        aStr += static_cast<sal_Unicode>( 'A' +
+                static_cast<sal_uInt16>(nCol));
+        aStr.Reverse();
+        aBuf.append( aStr);
+    }
+    aBuf.append( OUString::valueOf(nRow+1) );
+    return aBuf.makeStringAndClear();
+}
+::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
+{
+    ThrowIfDisposed ();
+    ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+
+    if( pAccTable ) 
+	try
+    {
+        sal_Int32 nRow = 0, nCol = 0;
+        pAccTable->getColumnAndRow(mnIndexInParent, nCol, nRow);
+        return getCellName( nCol, nRow );
+    }
+    catch( Exception& )
+    {
+    }
+
+    return AccessibleCellBase::getAccessibleName();
+}
+void AccessibleCell::UpdateChildren()
+{
+	if (mpText)						
+		mpText->UpdateChildren();
+}
+//-----IAccessibility2 Implementation 2009
+
+/* MT: Above getAccessibleName was introduced with IA2 CWS, while below was introduce in 3.3 meanwhile. Check which one is correct
+If this is correct, we also don't need 	sdr::table::CellRef getCellRef(), UpdateChildren(), getCellName( sal_Int32 nCol, sal_Int32 nRow ) above
+
 ::rtl::OUString SAL_CALL AccessibleCell::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
 {
     ThrowIfDisposed ();
@@ -576,5 +681,6 @@
 
     return AccessibleCellBase::getAccessibleName();
 }
+*/
 
 } // end of namespace accessibility
diff --git a/main/svx/source/table/accessiblecell.hxx b/main/svx/source/table/accessiblecell.hxx
index c4f49bc..5ced20b 100644
--- a/main/svx/source/table/accessiblecell.hxx
+++ b/main/svx/source/table/accessiblecell.hxx
@@ -43,6 +43,8 @@
 
 #include <boost/noncopyable.hpp>
 
+#include <svx/AccessibleTableShape.hxx>
+
 class SdrObject;
 
 
@@ -80,6 +82,9 @@
 	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL getAccessibleStateSet(void) throw(::com::sun::star::uno::RuntimeException);
 	virtual	sal_Int32 SAL_CALL getAccessibleIndexInParent(void) throw(::com::sun::star::uno::RuntimeException);
 	virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+	sdr::table::CellRef getCellRef();
+	void UpdateChildren();
+	::rtl::OUString getCellName( sal_Int32 nCol, sal_Int32 nRow );
 
 	// XAccessibleComponent
     virtual sal_Bool SAL_CALL containsPoint( const ::com::sun::star::awt::Point& aPoint) throw (::com::sun::star::uno::RuntimeException);
@@ -119,6 +124,8 @@
 	*/
 	inline void setIndexInParent(sal_Int32 _nIndex) { mnIndexInParent = _nIndex; }
 
+	//Get the parent table
+	AccessibleTableShape* GetParentTable() { return pAccTable; }
 protected:
     /// Bundle of information passed to all shapes in a document tree.
     AccessibleShapeTreeInfo maShapeTreeInfo;
@@ -134,6 +141,8 @@
     /// This method is called from the component helper base class while disposing.
     virtual void SAL_CALL disposing (void);
 
+	AccessibleTableShape *pAccTable;
+
 private:
     explicit AccessibleCell(void);	// not implemented
     explicit AccessibleCell(const AccessibleCell&); // not implemented 
diff --git a/main/svx/source/table/accessibletableshape.cxx b/main/svx/source/table/accessibletableshape.cxx
index 96548e9..423ec70 100644
--- a/main/svx/source/table/accessibletableshape.cxx
+++ b/main/svx/source/table/accessibletableshape.cxx
@@ -40,6 +40,11 @@
 #include <algorithm>
 
 #include <cppuhelper/implbase1.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <svx/svdotable.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/view/XSelectionSupplier.hpp>
+//-----IAccessibility2 Implementation 2009
 
 using ::rtl::OUString;
 
@@ -94,12 +99,21 @@
 	Reference< XTable > mxTable;
 	AccessibleCellMap maChildMap;
 	Reference< XAccessible> mxAccessible;
+	//IAccessibility2 Implementation 2009-----
+	sal_Int32 mRowCount, mColCount;
+	//get the cached AccessibleCell from XCell
+	Reference< AccessibleCell > getAccessibleCell (Reference< XCell > xCell);
+	//-----IAccessibility2 Implementation 2009
 };
 
 //-----------------------------------------------------------------------------
 
 AccessibleTableShapeImpl::AccessibleTableShapeImpl( AccessibleShapeTreeInfo& rShapeTreeInfo )
 : mrShapeTreeInfo( rShapeTreeInfo )
+//IAccessibility2 Implementation 2009-----
+, mRowCount(0)
+, mColCount(0)
+//-----IAccessibility2 Implementation 2009
 {
 }
 
@@ -114,6 +128,14 @@
 	{
 		Reference< XModifyListener > xListener( this );
 		mxTable->addModifyListener( xListener );
+		//IAccessibility2 Implementation 2009-----
+		//register the listener with table model
+		Reference< ::com::sun::star::view::XSelectionSupplier > xSelSupplier(xTable, UNO_QUERY);
+		Reference< ::com::sun::star::view::XSelectionChangeListener > xSelListener( xAccessible, UNO_QUERY );
+		if (xSelSupplier.is())
+			xSelSupplier->addSelectionChangeListener(xSelListener);
+		mRowCount = mxTable->getRowCount();
+		mColCount = mxTable->getColumnCount();
 	}
 }
 
@@ -123,6 +145,12 @@
 {
 	if( mxTable.is() )
 	{
+		//IAccessibility2 Implementation 2009-----, remove all the cell's acc object in table's dispose. 
+		for( AccessibleCellMap::iterator iter( maChildMap.begin() ); iter != maChildMap.end(); iter++ )
+		{
+			(*iter).second->dispose();
+		}
+		//-----IAccessibility2 Implementation 2009
 		Reference< XModifyListener > xListener( this );
 		mxTable->removeModifyListener( xListener );
 		mxTable.clear();
@@ -131,7 +159,21 @@
 }
 
 //-----------------------------------------------------------------------------
+//IAccessibility2 Implementation 2009-----, get the cached AccessibleCell from XCell
+Reference< AccessibleCell > AccessibleTableShapeImpl::getAccessibleCell (Reference< XCell > xCell)
+{
+	AccessibleCellMap::iterator iter( maChildMap.find( xCell ) );
 
+	if( iter != maChildMap.end() )
+	{
+		Reference< AccessibleCell > xChild( (*iter).second.get() );
+		return xChild;
+	}
+	return Reference< AccessibleCell >(); 
+}
+
+//-----------------------------------------------------------------------------
+//-----IAccessibility2 Implementation 2009
 Reference< XAccessible > AccessibleTableShapeImpl::getAccessibleChild( sal_Int32 nChildIndex ) throw(IndexOutOfBoundsException)
 {
 	sal_Int32 nColumn = 0, nRow = 0;
@@ -151,6 +193,9 @@
 		
 		rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );
 
+		//IAccessibility2 Implementation 2009-----
+		xAccessibleCell->Init();
+		//-----IAccessibility2 Implementation 2009
 		maChildMap[xCell] = xAccessibleCell;
 
         xAccessibleCell->Init();
@@ -197,6 +242,15 @@
 		const sal_Int32 nRowCount = mxTable->getRowCount();
 		const sal_Int32 nColCount = mxTable->getColumnCount();
 
+		//IAccessibility2 Implementation 2009-----
+		sal_Bool bRowOrColumnChanged = sal_False;
+		if (mRowCount != nRowCount || mColCount != nColCount )
+		{
+			bRowOrColumnChanged = sal_True;
+			mRowCount = nRowCount;
+			mColCount = nColCount;
+		}
+		//-----IAccessibility2 Implementation 2009
 		sal_Int32 nChildIndex = 0;
 
 		for( sal_Int32 nRow = 0; nRow < nRowCount; ++nRow )
@@ -210,12 +264,49 @@
 				{
 					rtl::Reference< AccessibleCell > xAccessibleCell( (*iter).second );
 					xAccessibleCell->setIndexInParent( nChildIndex );
-					xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
+					//IAccessibility2 Implementation 2009-----, the children may need to updated
+					//xAccessibleCell->CommitChange(AccessibleEventId::VISIBLE_DATA_CHANGED, Any(), Any());
+					xAccessibleCell->UpdateChildren();
+					// If row or column count is changed, there is split or merge, so all cell's acc name should be updated
+					if (bRowOrColumnChanged)
+					{
+						xAccessibleCell->SetAccessibleName(xAccessibleCell->getAccessibleName(), AccessibleContextBase::ManuallySet);
+					}
+					// For merged cell, add invisible & disabled state. 
+					Reference< XMergeableCell > xMergedCell( mxTable->getCellByPosition( nCol, nRow ),  UNO_QUERY );
+					if (xMergedCell.is() && xMergedCell->isMerged())
+					{
+						xAccessibleCell->ResetState(AccessibleStateType::VISIBLE);
+						xAccessibleCell->ResetState(AccessibleStateType::ENABLED);
+						// IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
+						// xAccessibleCell->SetState(AccessibleStateType::OFFSCREEN);
+						xAccessibleCell->ResetState(AccessibleStateType::SHOWING);
+					}
+					else
+					{
+						xAccessibleCell->SetState(AccessibleStateType::VISIBLE);
+						xAccessibleCell->SetState(AccessibleStateType::ENABLED);
+						// IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
+						// xAccessibleCell->ResetState(AccessibleStateType::OFFSCREEN);
+						xAccessibleCell->SetState(AccessibleStateType::SHOWING);
+					}
+					//-----IAccessibility2 Implementation 2009
 
 					// move still existing cell from temporary child map to our child map
 					maChildMap[xCell] = xAccessibleCell;
 					aTempChildMap.erase( iter );
 				}
+				//IAccessibility2 Implementation 2009-----, need to add the new added cell on demand
+				else
+				{
+					CellRef xCellRef( dynamic_cast< Cell* >( xCell.get() ) );
+		
+					rtl::Reference< AccessibleCell > xAccessibleCell( new AccessibleCell( mxAccessible, xCellRef, nChildIndex, mrShapeTreeInfo ) );
+
+					xAccessibleCell->Init();
+					maChildMap[xCell] = xAccessibleCell;
+				}
+				//-----IAccessibility2 Implementation 2009
 
 				++nChildIndex;
 			}
@@ -228,6 +319,10 @@
 		{
 			(*iter).second->dispose();
 		}
+		//IAccessibility2 Implementation 2009-----, notify bridge to update the acc cache. 
+		AccessibleTableShape *pAccTable = dynamic_cast <AccessibleTableShape *> (mxAccessible.get());
+		pAccTable->CommitChange(AccessibleEventId::INVALIDATE_ALL_CHILDREN, Any(), Any());
+		//-----IAccessibility2 Implementation 2009
 	}
 	catch( Exception& )
 	{
@@ -264,7 +359,7 @@
 {
 	try
 	{
-
+		mnPreviousSelectionCount = 0;
 		Reference< XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
 		Reference< XTable > xTable( xSet->getPropertyValue(C2U("Model")), UNO_QUERY_THROW );
 
@@ -295,6 +390,16 @@
 
 Any SAL_CALL AccessibleTableShape::queryInterface( const Type& aType ) throw (RuntimeException)
 {
+	//IAccessibility2 Implementation 2009-----
+	if ( aType == ::getCppuType((Reference<XAccessibleTableSelection> *)0) )
+    {
+		Reference<XAccessibleTableSelection> xThis( this );
+		Any aRet;
+       	aRet <<= xThis;
+		return aRet;
+	}
+	else
+	//-----IAccessibility2 Implementation 2009
 	return AccessibleTableShape_Base::queryInterface( aType );
 }
 
@@ -331,7 +436,7 @@
 
 OUString AccessibleTableShape::CreateAccessibleBaseName(void) throw (RuntimeException)
 {
-    return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape"));;
+    return OUString (RTL_CONSTASCII_USTRINGPARAM("TableShape"));
 }
 
 //--------------------------------------------------------------------
@@ -443,7 +548,19 @@
 
 Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleRowHeaders(  ) throw (RuntimeException)
 {
-	Reference< XAccessibleTable > xRet( this ); // todo
+	//IAccessibility2 Implementation 2009-----
+	//Reference< XAccessibleTable > xRet( this ); // todo
+	Reference< XAccessibleTable > xRet;
+	SvxTableController* pController = getTableController();
+	if( pController )
+	{
+		if( pController->isRowHeader() )
+		{
+			AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_True );
+			xRet.set( pTableHeader );
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	return xRet;
 }
 
@@ -451,7 +568,19 @@
 
 Reference< XAccessibleTable > SAL_CALL AccessibleTableShape::getAccessibleColumnHeaders(  ) throw (RuntimeException)
 {
-	Reference< XAccessibleTable > xRet( this ); // todo
+	//IAccessibility2 Implementation 2009-----
+	//Reference< XAccessibleTable > xRet( this ); // todo
+	Reference< XAccessibleTable > xRet;
+	SvxTableController* pController = getTableController();
+	if( pController )
+	{
+		if( pController->isColumnHeader() )
+		{
+			AccessibleTableHeaderShape* pTableHeader = new AccessibleTableHeaderShape( this, sal_False );
+			xRet.set( pTableHeader );
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	return xRet;
 }
 
@@ -459,16 +588,80 @@
 
 Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleRows(  ) throw (RuntimeException)
 {
-	Sequence< sal_Int32 > aRet;
+	//IAccessibility2 Implementation 2009-----
+	/*Sequence< sal_Int32 > aRet;*/
+	sal_Int32 nRow = getAccessibleRowCount();
+	::std::vector< sal_Bool > aSelected( nRow, sal_True );
+	sal_Int32 nCount = nRow;
+	for( sal_Int32 i = 0; i < nRow; i++ )
+	{
+		try
+		{
+			aSelected[i] = isAccessibleRowSelected( i );
+		}
+		catch( ... )
+		{			
+			return Sequence< sal_Int32 >();
+		}
+
+		if( !aSelected[i] ) 
+			nCount--;
+	}	
+	Sequence < sal_Int32 > aRet( nCount );
+	sal_Int32 *pRet = aRet.getArray();
+	sal_Int32 nPos = 0;
+	size_t nSize = aSelected.size();
+	for( size_t i=0; i < nSize && nPos < nCount; i++ )
+	{
+		if( aSelected[i] )
+		{
+			*pRet++ = i;
+			nPos++;
+		}
+	}
+
 	return aRet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
 
 Sequence< sal_Int32 > SAL_CALL AccessibleTableShape::getSelectedAccessibleColumns(  ) throw (RuntimeException)
 {
-	Sequence< sal_Int32 > aRet;
+	//IAccessibility2 Implementation 2009-----
+	/*Sequence< sal_Int32 > aRet;*/
+	sal_Int32 nColumn = getAccessibleColumnCount();
+	::std::vector< sal_Bool > aSelected( nColumn, sal_True );
+	sal_Int32 nCount = nColumn;
+	for( sal_Int32 i = 0; i < nColumn; i++ )
+	{
+		try
+		{
+			aSelected[i] = isAccessibleColumnSelected( i );
+		}
+		catch( ... )
+		{			
+			return Sequence< sal_Int32 >();
+		}
+
+		if( !aSelected[i] ) 
+			nCount--;
+	}	
+	Sequence < sal_Int32 > aRet( nCount );
+	sal_Int32 *pRet = aRet.getArray();
+	sal_Int32 nPos = 0;
+	size_t nSize = aSelected.size();
+	for( size_t i=0; i < nSize && nPos < nCount; i++ )
+	{
+		if( aSelected[i] )
+		{
+			*pRet++ = i;
+			nPos++;
+		}
+	}
+
 	return aRet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
@@ -477,6 +670,13 @@
 {
     ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
 	checkCellPosition( 0, nRow );
+	//IAccessibility2 Implementation 2009-----
+	SvxTableController* pController = getTableController();
+	if( pController )
+	{
+		return pController->isRowSelected( nRow );
+	}
+	//-----IAccessibility2 Implementation 2009
 	return sal_False;
 }
 
@@ -486,6 +686,13 @@
 {
     ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
 	checkCellPosition( nColumn, 0 );
+	//IAccessibility2 Implementation 2009-----
+	SvxTableController* pController = getTableController();
+	if( pController )
+	{
+		return pController->isColumnSelected( nColumn );
+	}
+	//-----IAccessibility2 Implementation 2009
 	return sal_False;
 }
 
@@ -564,7 +771,10 @@
     ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
 	sal_Int32 nColumn = 0, nRow = 0;
 	mxImpl->getColumnAndRow( nChildIndex, nColumn, nRow );
-	return nChildIndex;
+	//IAccessibility2 Implementation 2009-----
+	//return nChildIndex;
+	return nColumn;
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
@@ -603,7 +813,11 @@
 	CellPos aPos;
 	mxImpl->getColumnAndRow( nChildIndex, aPos.mnCol, aPos.mnRow );
 
-	return isAccessibleSelected(aPos.mnCol, aPos.mnRow);
+	//IAccessibility2 Implementation 2009-----
+	// Para order is not correct
+	//return isAccessibleSelected(aPos.mnCol, aPos.mnRow);
+	return isAccessibleSelected(aPos.mnRow, aPos.mnCol);
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
@@ -654,7 +868,8 @@
 {
     ::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
 
-	SvxTableController* pController = getTableController();
+	//IAccessibility2 Implementation 2009-----
+	/*SvxTableController* pController = getTableController();
 	if( pController && pController->hasSelectedCells() )
 	{
 		CellPos aFirstPos, aLastPos;
@@ -675,6 +890,22 @@
 	}
 
 	throw IndexOutOfBoundsException();
+	*/
+	if( nSelectedChildIndex < 0 )
+        throw IndexOutOfBoundsException();
+
+	sal_Int32 nChildIndex = GetIndexOfSelectedChild( nSelectedChildIndex );
+
+	if( nChildIndex < 0 )
+        throw IndexOutOfBoundsException();
+
+	if ( nChildIndex >= getAccessibleChildCount() )
+    {
+        throw IndexOutOfBoundsException();
+    }
+
+	return getAccessibleChild( nChildIndex );
+	//-----IAccessibility2 Implementation 2009
 }
 
 //--------------------------------------------------------------------
@@ -705,9 +936,180 @@
 			pController->setSelectedCells( aFirstPos, aLastPos );
 	}
 }
-
 //--------------------------------------------------------------------
 
+//IAccessibility2 Implementation 2009-----
+//=====  XAccessibleTableSelection  ============================================
+sal_Bool SAL_CALL AccessibleTableShape::selectRow( sal_Int32 row ) 
+throw (IndexOutOfBoundsException, RuntimeException) 
+{
+	::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+	SvxTableController* pController = getTableController();
+	if( !pController )
+		return sal_False;
+	return pController->selectRow( row );
+}
+sal_Bool SAL_CALL AccessibleTableShape::selectColumn( sal_Int32 column ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+	SvxTableController* pController = getTableController();
+	if( !pController )
+		return sal_False;
+	return pController->selectColumn( column );
+}
+sal_Bool SAL_CALL AccessibleTableShape::unselectRow( sal_Int32 row ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+	SvxTableController* pController = getTableController();
+	if( !pController )
+		return sal_False;
+	return pController->deselectRow( row );
+}
+sal_Bool SAL_CALL AccessibleTableShape::unselectColumn( sal_Int32 column ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	::vos::OGuard aSolarGuard (::Application::GetSolarMutex());
+	SvxTableController* pController = getTableController();
+	if( !pController )
+		return sal_False;
+	return pController->deselectColumn( column );
+}
+sal_Int32 AccessibleTableShape::GetIndexOfSelectedChild(
+				sal_Int32 nSelectedChildIndex ) const
+{    
+    sal_Int32 nChildren = const_cast<AccessibleTableShape*>(this)->getAccessibleChildCount();
+
+	if( nSelectedChildIndex >= nChildren )
+		return -1L;
+
+    sal_Int32 n = 0;
+    while( n < nChildren )
+    {
+        if( const_cast<AccessibleTableShape*>(this)->isAccessibleChildSelected( n ) )
+		{
+			if( 0 == nSelectedChildIndex )
+				break;
+			else
+				--nSelectedChildIndex;
+		}
+        ++n;
+    }
+
+	return n < nChildren ? n : -1L;
+}
+void AccessibleTableShape::getColumnAndRow( sal_Int32 nChildIndex, sal_Int32& rnColumn, sal_Int32& rnRow ) throw (IndexOutOfBoundsException )
+{
+	mxImpl->getColumnAndRow(nChildIndex, rnColumn, rnRow);
+}
+//--------------------------------------------------------------------
+// XSelectionChangeListener
+void SAL_CALL
+    AccessibleTableShape::disposing (const EventObject& aEvent)
+    throw (RuntimeException)
+{
+	AccessibleShape::disposing(aEvent);
+}
+void  SAL_CALL AccessibleTableShape::selectionChanged (const EventObject& rEvent)
+        throw (RuntimeException)
+{
+	//::sdr::table::CellRef xCellRef = static_cast< ::sdr::table::CellRef > (rEvent.Source);
+	Reference< XCell > xCell(rEvent.Source, UNO_QUERY);
+	if (xCell.is())
+	{
+		Reference< AccessibleCell > xAccCell = mxImpl->getAccessibleCell( xCell );
+		if (xAccCell.is())
+		{
+			sal_Int32 nIndex = xAccCell->getAccessibleIndexInParent(), 
+				nCount = getSelectedAccessibleChildCount();
+			sal_Bool bSelected = isAccessibleChildSelected(nIndex);
+			if (mnPreviousSelectionCount == 0 && nCount > 0 && bSelected)
+			{
+				xAccCell->SetState(AccessibleStateType::SELECTED);
+				xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED, Any(), Any());
+			}
+			else if (bSelected)
+			{
+				xAccCell->SetState(AccessibleStateType::SELECTED);
+				xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_ADD, Any(), Any());
+			}
+			else
+			{
+				xAccCell->ResetState(AccessibleStateType::SELECTED);
+				xAccCell->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, Any(), Any());
+			}
+			mnPreviousSelectionCount = nCount;
+		}
+	}
+}
+// Get the currently active cell which is text editing
+AccessibleCell* AccessibleTableShape::GetActiveAccessibleCell()
+{
+	sal_Bool bCellEditing = sal_False;
+	Reference< AccessibleCell > xAccCell;
+	AccessibleCell* pAccCell = NULL;
+	SvxTableController* pController = getTableController();
+	if (pController)
+	{
+		::sdr::table::SdrTableObj* pTableObj = pController->GetTableObj();
+		if ( pTableObj )
+		{
+			::sdr::table::CellRef xCellRef (pTableObj->getActiveCell());
+			if ( xCellRef.is() )
+			{
+				bCellEditing = xCellRef->IsTextEditActive();
+				if (bCellEditing)
+				{
+					//Reference< XCell > xCell(xCellRef.get(), UNO_QUERY);
+					xAccCell = mxImpl->getAccessibleCell(Reference< XCell >( xCellRef.get() ));
+					if (xAccCell.is())
+						pAccCell = xAccCell.get();
+				}
+			}
+		}
+	}
+	return pAccCell;
+}
+//--------------------------------------------------------------------
+//If current active cell is in editing, the focus state should be set to internal text
+sal_Bool AccessibleTableShape::SetState (sal_Int16 aState)
+{
+    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
+    sal_Bool bStateHasChanged = sal_False;
+    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
+    {
+		return pActiveAccessibleCell->SetState(aState);
+    }
+    else
+        bStateHasChanged = AccessibleShape::SetState (aState);
+    return bStateHasChanged;
+}
+//--------------------------------------------------------------------
+//If current active cell is in editing, the focus state should be reset to internal text
+sal_Bool AccessibleTableShape::ResetState (sal_Int16 aState)
+{
+    AccessibleCell* pActiveAccessibleCell = GetActiveAccessibleCell();
+    sal_Bool bStateHasChanged = sal_False;
+    if (aState == AccessibleStateType::FOCUSED && pActiveAccessibleCell != NULL)
+    {
+		return pActiveAccessibleCell->ResetState(aState);
+    }
+    else
+        bStateHasChanged = AccessibleShape::ResetState (aState);
+    return bStateHasChanged;
+}
+//--------------------------------------------------------------------
+sal_Bool AccessibleTableShape::SetStateDirectly (sal_Int16 aState)
+{
+	return AccessibleContextBase::SetState (aState);
+}
+//--------------------------------------------------------------------
+sal_Bool AccessibleTableShape::ResetStateDirectly (sal_Int16 aState)
+{
+	return AccessibleContextBase::ResetState (aState);
+}
+//-----IAccessibility2 Implementation 2009
 void AccessibleTableShape::checkCellPosition( sal_Int32 nCol, sal_Int32 nRow ) throw ( IndexOutOfBoundsException )
 {
 	if( (nCol >= 0) && (nRow >= 0) && mxImpl->mxTable.is() && (nCol < mxImpl->mxTable->getColumnCount()) && (nRow < mxImpl->mxTable->getRowCount()) )
@@ -716,4 +1118,333 @@
 	throw IndexOutOfBoundsException();
 }
 
+//IAccessibility2 Implementation 2009-----
+AccessibleTableHeaderShape::AccessibleTableHeaderShape( AccessibleTableShape* pTable, sal_Bool bRow )
+{
+	mpTable = pTable;
+	mbRow = bRow;
+}
+
+AccessibleTableHeaderShape::~AccessibleTableHeaderShape (void)
+{
+	mpTable = NULL;
+}
+
+// XAccessible
+Reference< XAccessibleContext > SAL_CALL AccessibleTableHeaderShape::getAccessibleContext(void) throw (RuntimeException)
+{
+	return this;
+}
+
+// XAccessibleContext
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleChildCount( ) throw(RuntimeException)
+{
+	return getAccessibleRowCount() * getAccessibleColumnCount();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleChild( sal_Int32 i ) throw(IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleChild( i );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleParent (void) throw (RuntimeException)
+{
+	Reference< XAccessible > XParent;
+    return XParent;
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndexInParent (void) throw (RuntimeException)
+{
+	return -1;
+}
+
+sal_Int16 SAL_CALL AccessibleTableHeaderShape::getAccessibleRole (void) throw (RuntimeException)
+{
+	return mpTable->getAccessibleRole();
+}
+
+OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleDescription (void) throw (RuntimeException)
+{
+    return mpTable->getAccessibleDescription();
+}
+
+OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleName (void) throw (RuntimeException)
+{
+	return mpTable->getAccessibleName();
+}
+
+Reference< XAccessibleStateSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleStateSet (void) throw (RuntimeException)
+{
+	return mpTable->getAccessibleStateSet();
+}
+
+Reference< XAccessibleRelationSet > SAL_CALL AccessibleTableHeaderShape::getAccessibleRelationSet (void) throw (RuntimeException)
+{
+	return mpTable->getAccessibleRelationSet();
+}
+
+Locale SAL_CALL AccessibleTableHeaderShape::getLocale (void) throw (IllegalAccessibleComponentStateException, RuntimeException)
+{
+	return mpTable->getLocale();
+}
+
+//XAccessibleComponent
+sal_Bool SAL_CALL AccessibleTableHeaderShape::containsPoint ( const ::com::sun::star::awt::Point& aPoint ) throw (RuntimeException)
+{
+	return mpTable->containsPoint( aPoint );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleAtPoint ( const ::com::sun::star::awt::Point& aPoint) throw (RuntimeException)
+{
+	return mpTable->getAccessibleAtPoint( aPoint );
+}
+
+::com::sun::star::awt::Rectangle SAL_CALL AccessibleTableHeaderShape::getBounds (void) throw (RuntimeException)
+{
+	return mpTable->getBounds();
+}
+
+::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocation (void) throw (RuntimeException)
+{
+	return mpTable->getLocation();
+}
+
+::com::sun::star::awt::Point SAL_CALL AccessibleTableHeaderShape::getLocationOnScreen (void) throw (RuntimeException)
+{
+	return mpTable->getLocationOnScreen();
+}
+
+::com::sun::star::awt::Size SAL_CALL AccessibleTableHeaderShape::getSize (void) throw (RuntimeException)
+{
+	return mpTable->getSize();
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getForeground (void) throw (RuntimeException)
+{
+    return mpTable->getForeground();
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getBackground (void) throw (RuntimeException)
+{
+    return mpTable->getBackground();
+}
+
+void SAL_CALL AccessibleTableHeaderShape::grabFocus (void) throw (RuntimeException)
+{
+	mpTable->grabFocus();
+}
+//=====  XAccessibleTable  ============================================
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowCount() throw (RuntimeException)
+{
+	return mbRow ? 1 : mpTable->getAccessibleRowCount();
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnCount() throw (RuntimeException)
+{
+    return !mbRow ? 1 : mpTable->getAccessibleColumnCount();
+}
+
+OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleRowDescription( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleRowDescription( nRow );
+}
+
+OUString SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnDescription( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+    return mpTable->getAccessibleColumnDescription( nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRowExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleRowExtentAt( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnExtentAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleColumnExtentAt( nRow, nColumn );
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleRowHeaders(  ) throw (RuntimeException)
+{
+	Reference< XAccessibleTable > xRet;
+	return xRet;
+}
+
+Reference< XAccessibleTable > SAL_CALL AccessibleTableHeaderShape::getAccessibleColumnHeaders(  ) throw (RuntimeException)
+{
+	Reference< XAccessibleTable > xRet;
+	return xRet;
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleRows(  ) throw (RuntimeException)
+{
+	sal_Int32 nRow = getAccessibleRowCount();
+	::std::vector< sal_Bool > aSelected( nRow, sal_True );
+	sal_Int32 nCount = nRow;
+	for( sal_Int32 i = 0; i < nRow; i++ )
+	{
+		try
+		{
+			aSelected[i] = isAccessibleRowSelected( i );
+		}
+		catch( ... )
+		{			
+			return Sequence< sal_Int32 >();
+		}
+
+		if( !aSelected[i] ) 
+			nCount--;
+	}	
+	Sequence < sal_Int32 > aRet( nCount );
+	sal_Int32 *pRet = aRet.getArray();
+	sal_Int32 nPos = 0;
+	size_t nSize = aSelected.size();
+	for( size_t i=0; i < nSize && nPos < nCount; i++ )
+	{
+		if( aSelected[i] )
+		{
+			*pRet++ = i;
+			nPos++;
+		}
+	}
+
+	return aRet;
+}
+
+Sequence< sal_Int32 > SAL_CALL AccessibleTableHeaderShape::getSelectedAccessibleColumns(  ) throw (RuntimeException)
+{
+	sal_Int32 nColumn = getAccessibleColumnCount();
+	::std::vector< sal_Bool > aSelected( nColumn, sal_True );
+	sal_Int32 nCount = nColumn;
+	for( sal_Int32 i = 0; i < nColumn; i++ )
+	{
+		try
+		{
+			aSelected[i] = isAccessibleColumnSelected( i );
+		}
+		catch( ... )
+		{			
+			return Sequence< sal_Int32 >();
+		}
+
+		if( !aSelected[i] ) 
+			nCount--;
+	}	
+	Sequence < sal_Int32 > aRet( nCount );
+	sal_Int32 *pRet = aRet.getArray();
+	sal_Int32 nPos = 0;
+	size_t nSize = aSelected.size();
+	for( size_t i=0; i < nSize && nPos < nCount; i++ )
+	{
+		if( aSelected[i] )
+		{
+			*pRet++ = i;
+			nPos++;
+		}
+	}
+
+	return aRet;
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleRowSelected( sal_Int32 nRow ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->isAccessibleRowSelected( nRow );
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleColumnSelected( sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->isAccessibleColumnSelected( nColumn );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCellAt( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleCellAt( nRow, nColumn );
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleCaption(  ) throw (RuntimeException) 
+{
+	return mpTable->getAccessibleCaption();
+}
+
+Reference< XAccessible > SAL_CALL AccessibleTableHeaderShape::getAccessibleSummary(  ) throw (RuntimeException)
+{
+	return mpTable->getAccessibleSummary();
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::isAccessibleSelected( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->isAccessibleSelected( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleIndex( sal_Int32 nRow, sal_Int32 nColumn ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleIndex( nRow, nColumn );
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleRow( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleRow( nChildIndex );
+}
+
+sal_Int32 SAL_CALL AccessibleTableHeaderShape::getAccessibleColumn( sal_Int32 nChildIndex ) throw (IndexOutOfBoundsException, RuntimeException)
+{
+	return mpTable->getAccessibleColumn( nChildIndex );
+}
+
+//=====  XAccessibleTableSelection  ============================================
+sal_Bool SAL_CALL AccessibleTableHeaderShape::selectRow( sal_Int32 row ) 
+throw (IndexOutOfBoundsException, RuntimeException) 
+{
+	if( mbRow )
+		return mpTable->selectRow( row );
+	else
+	{
+		mpTable->clearAccessibleSelection();
+		sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
+		mpTable->selectAccessibleChild( nIndex );
+		return sal_True;
+	}
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::selectColumn( sal_Int32 column ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	if( !mbRow )
+		return mpTable->selectColumn( column );
+	else
+	{
+		mpTable->clearAccessibleSelection();
+		sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
+		mpTable->selectAccessibleChild( nIndex );
+		return sal_True;
+	}
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectRow( sal_Int32 row ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	if( mbRow )
+		return mpTable->unselectRow( row );
+	else
+	{
+		sal_Int32 nIndex = mpTable->getAccessibleIndex( row, 0 );
+		mpTable->deselectAccessibleChild( nIndex );
+		return sal_True;
+	}
+}
+
+sal_Bool SAL_CALL AccessibleTableHeaderShape::unselectColumn( sal_Int32 column ) 
+throw (IndexOutOfBoundsException, RuntimeException)
+{
+	if( !mbRow )
+		return mpTable->unselectColumn( column );
+	else
+	{
+		sal_Int32 nIndex = mpTable->getAccessibleIndex( 0, column );
+		mpTable->deselectAccessibleChild( nIndex );
+		return sal_True;
+	}
+}
+//-----IAccessibility2 Implementation 2009
 }
diff --git a/main/svx/source/table/tablecontroller.cxx b/main/svx/source/table/tablecontroller.cxx
index 2579cff..158070f 100644
--- a/main/svx/source/table/tablecontroller.cxx
+++ b/main/svx/source/table/tablecontroller.cxx
@@ -2612,4 +2612,90 @@
 	return 0;
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool SvxTableController::selectRow( sal_Int32 row )
+{
+	if( !mxTable.is() )
+		return sal_False;
+	CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row );
+	StartSelection( aEnd );
+	gotoCell( aStart, true, 0 );
+	return sal_True;
+}
+sal_Bool SvxTableController::selectColumn( sal_Int32 column )
+{
+	if( !mxTable.is() )
+		return sal_False;
+	CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 );
+	StartSelection( aEnd );
+	gotoCell( aStart, true, 0 );
+	return sal_True;
+}
+sal_Bool SvxTableController::deselectRow( sal_Int32 row )
+{
+	if( !mxTable.is() )
+		return sal_False;
+	CellPos aStart( 0, row ), aEnd( mxTable->getColumnCount() - 1, row );
+	StartSelection( aEnd );
+	gotoCell( aStart, false, 0 );
+	return sal_True;
+}
+sal_Bool SvxTableController::deselectColumn( sal_Int32 column )
+{
+	if( !mxTable.is() )
+		return sal_False;
+	CellPos aStart( column, 0 ), aEnd( column, mxTable->getRowCount() - 1 );
+	StartSelection( aEnd );
+	gotoCell( aStart, false, 0 );
+	return sal_True;
+}
+sal_Bool SvxTableController::isRowSelected( sal_Int32 nRow )
+{
+	if( hasSelectedCells() )
+	{
+		CellPos aFirstPos, aLastPos;
+		getSelectedCells( aFirstPos, aLastPos );
+		if( (aFirstPos.mnCol == 0) && (nRow >= aFirstPos.mnRow && nRow <= aLastPos.mnRow) && (mxTable->getColumnCount() - 1 == aLastPos.mnCol) )
+			return sal_True;
+	}
+	return sal_False;
+}
+sal_Bool SvxTableController::isColumnSelected( sal_Int32 nColumn )
+{
+	if( hasSelectedCells() )
+	{
+		CellPos aFirstPos, aLastPos;
+		getSelectedCells( aFirstPos, aLastPos );
+		if( (aFirstPos.mnRow == 0) && (nColumn >= aFirstPos.mnCol && nColumn <= aLastPos.mnCol) && (mxTable->getRowCount() - 1 == aLastPos.mnRow) )
+			return sal_True;
+	}
+	return sal_False;
+}
+
+sal_Bool SvxTableController::isRowHeader()
+{
+	SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+	SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;
+
+	if( !pTableObj || !pModel )
+		return sal_False;
+
+	TableStyleSettings aSettings( pTableObj->getTableStyleSettings() );
+
+	return aSettings.mbUseFirstRow;
+}
+
+sal_Bool SvxTableController::isColumnHeader()
+{
+	SdrTableObj* pTableObj = dynamic_cast< ::sdr::table::SdrTableObj* >( mxTableObj.get() );
+	SdrModel* pModel = pTableObj ? pTableObj->GetModel() : 0;
+
+	if( !pTableObj || !pModel )
+		return sal_False;
+
+	TableStyleSettings aSettings( pTableObj->getTableStyleSettings() );
+
+	return aSettings.mbUseFirstColumn;
+}
+//-----IAccessibility2 Implementation 2009
 } }
diff --git a/main/svx/source/unodraw/unoprov.cxx b/main/svx/source/unodraw/unoprov.cxx
index 5e18e79..61a56d7 100644
--- a/main/svx/source/unodraw/unoprov.cxx
+++ b/main/svx/source/unodraw/unoprov.cxx
@@ -776,6 +776,9 @@
 		{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_MOVEPROTECT),	SDRATTR_OBJMOVEPROTECT, &::getBooleanCppuType(),0, 0},
 		{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_SIZEPROTECT),	SDRATTR_OBJSIZEPROTECT, &::getBooleanCppuType(),0, 0},
 	    { MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_BOUNDRECT),	OWN_ATTR_BOUNDRECT, &::getCppuType((const ::com::sun::star::awt::Rectangle*)0), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
+	    	//IAccessibility2 Implementation 2009-----, the name property of table should also be exported. 
+		{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_NAME), 		SDRATTR_OBJECTNAME				, &::getCppuType((const ::rtl::OUString*)0),	0,	0},
+		//-----IAccessibility2 Implementation 2009
 		{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_TITLE),		OWN_ATTR_MISC_OBJ_TITLE			, &::getCppuType((const ::rtl::OUString*)0),	0,	0},
 		{ MAP_CHAR_LEN(UNO_NAME_MISC_OBJ_DESCRIPTION),	OWN_ATTR_MISC_OBJ_DESCRIPTION	, &::getCppuType((const ::rtl::OUString*)0),	0,	0},
 		{ MAP_CHAR_LEN("Model"),						OWN_ATTR_OLEMODEL				, &::com::sun::star::table::XTable::static_type(), ::com::sun::star::beans::PropertyAttribute::READONLY, 0},
diff --git a/main/svx/source/unodraw/unoshtxt.cxx b/main/svx/source/unodraw/unoshtxt.cxx
index 588b822..e00cb2a 100644
--- a/main/svx/source/unodraw/unoshtxt.cxx
+++ b/main/svx/source/unodraw/unoshtxt.cxx
@@ -51,6 +51,12 @@
 #include <com/sun/star/linguistic2/XLinguServiceManager.hpp>
 #include <comphelper/processfactory.hxx>
 #include <vos/mutex.hxx>
+
+//IAccessibility2 Implementation 2009-----
+#include <svx/svdotable.hxx>
+#include <../table/cell.hxx>
+//-----IAccessibility2 Implementation 2009
+
 #include <svx/sdrpaintwindow.hxx>
 
 using namespace ::osl;
@@ -385,6 +391,29 @@
             case HINT_BEGEDIT:
                 if( mpObject == pSdrHint->GetObject() )
                 {
+					//IAccessibility2 Implementation 2009-----, one EditSource object is created for each AccessibleCell, and it will monitor the hint. 
+					// Once HINT_BEGEDIT is broadcast, each EditSource of AccessibleCell will handle it here and
+					// call below: mpView->GetTextEditOutliner()->SetNotifyHdl(), which will replace the Notifer for current 
+					// editable cell. It is totally wrong. So add check here to avoid the incorrect replacement of notifer. 
+					// To be safe, add accessibility check here because currently it only happen on the editsource of AccessibleCell
+					if (Application::IsAccessibilityEnabled())
+					{
+						if (mpObject && mpText)
+						{
+							sdr::table::SdrTableObj* pTableObj = PTR_CAST( sdr::table::SdrTableObj, mpObject );
+							if(pTableObj)
+							{
+								sdr::table::CellRef xCell = pTableObj->getActiveCell();
+								if (xCell.is())
+								{
+									sdr::table::Cell* pCellObj = dynamic_cast< sdr::table::Cell* >( mpText );								
+									if (pCellObj && xCell.get() != pCellObj)
+											break;
+								}
+							}
+						}
+					}
+					//-----IAccessibility2 Implementation 2009				
                     // invalidate old forwarder
                     if( !mbForwarderIsEditMode )
                     {
diff --git a/main/sw/Library_sw.mk b/main/sw/Library_sw.mk
index 588a019..bddaccb 100644
--- a/main/sw/Library_sw.mk
+++ b/main/sw/Library_sw.mk
@@ -88,6 +88,7 @@
 	sw/source/core/access/accdoc \
 	sw/source/core/access/accembedded \
 	sw/source/core/access/accfootnote \
+	sw/source/core/access/accfield \
 	sw/source/core/access/accframe \
 	sw/source/core/access/accframebase\
 	sw/source/core/access/accfrmobj \
@@ -99,6 +100,7 @@
 	sw/source/core/access/acchypertextdata \
 	sw/source/core/access/accmap \
 	sw/source/core/access/accnotextframe \
+	sw/source/core/access/accnotexthyperlink \
 	sw/source/core/access/accpage \
 	sw/source/core/access/accpara \
 	sw/source/core/access/accportions \
diff --git a/main/sw/inc/PostItMgr.hxx b/main/sw/inc/PostItMgr.hxx
index 09b5844..3ad69ca 100644
--- a/main/sw/inc/PostItMgr.hxx
+++ b/main/sw/inc/PostItMgr.hxx
@@ -282,6 +282,10 @@
 			sal_uInt16 SearchReplace(const SwFmtFld &pFld, const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
 			sal_uInt16 FinishSearchReplace(const ::com::sun::star::util::SearchOptions& rSearchOptions,bool bSrchForward);
 
+			//IAccessibility2 Implementation 2009-----
+			// get the PostIt window by index
+			sal_Int32 GetPostItCount() {return mvPostItFlds.size();};
+			//-----IAccessibility2 Implementation 2009
             void AssureStdModeAtShell();
 
             void ConnectSidebarWinToFrm( const SwFrm& rFrm,
diff --git a/main/sw/inc/access.hrc b/main/sw/inc/access.hrc
index dda45fb..c4f20b5 100644
--- a/main/sw/inc/access.hrc
+++ b/main/sw/inc/access.hrc
@@ -59,9 +59,12 @@
 #define STR_ACCESS_SW_CATEGORY 					(RC_ACCESS_BEGIN + 29)
 #define STR_ACCESS_TL_GLOBAL					(RC_ACCESS_BEGIN + 30)
 #define STR_ACCESS_TL_CONTENT					(RC_ACCESS_BEGIN + 31)
+#define STR_ACCESS_FORMULA_TYPE					(RC_ACCESS_BEGIN + 32)
+#define STR_ACCESS_FORMULA_TEXT					(RC_ACCESS_BEGIN + 33)
+#define STR_ACCESS_FORMULA_TOOLBAR				(RC_ACCESS_BEGIN + 34)
 //-----IAccessibility2 Implementation 2009
 
-#define ACCESS_ACT_END STR_ACCESS_TL_CONTENT
+#define ACCESS_ACT_END STR_ACCESS_FORMULA_TOOLBAR
 
 #if ACCESS_ACT_END > RC_ACCESS_END
 #error Resource-Id Ueberlauf in #file, #line
diff --git a/main/sw/inc/accmap.hxx b/main/sw/inc/accmap.hxx
index 59ee70c..896e534 100644
--- a/main/sw/inc/accmap.hxx
+++ b/main/sw/inc/accmap.hxx
@@ -32,7 +32,14 @@
 #include <tools/debug.hxx>
 #include <tools/fract.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShape.hxx>
+#include "fesh.hxx"
 #include <vector>
+#include <set>
+class SwAccessibleParagraph;
+//-----IAccessibility2 Implementation 2009
 
 class ViewShell;
 class Rectangle;
@@ -80,8 +87,8 @@
 typedef sal_uInt16 tAccessibleStates;
 // <--
 
-class SwAccessibleMap : public accessibility::IAccessibleViewForwarder,
-						public accessibility::IAccessibleParent
+class SwAccessibleMap : public ::accessibility::IAccessibleViewForwarder,
+						public ::accessibility::IAccessibleParent
 {
     mutable ::vos::OMutex maMutex;
 	::vos::OMutex maEventMutex;
@@ -115,10 +122,19 @@
 	void InvalidateCursorPosition(
 		const ::com::sun::star::uno::Reference<
 			::com::sun::star::accessibility::XAccessible>& rAcc );
-	void DoInvalidateShapeSelection();
-	void DoInvalidateShapeFocus();
+	//IAccessibility2 Implementation 2009-----
+	void DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode = sal_False);
+	
+	//Replace by DoInvalidateShapeSelection
+	//void DoInvalidateShapeFocus();
 	void InvalidateShapeSelection();
 
+	//mpSelectedFrmMap contains the old selected objects.
+	SwAccessibleContextMap_Impl *mpSeletedFrmMap;
+	//IvalidateShapeInParaSelection() method is reponsible for the updating the selected states of the objects.
+	void InvalidateShapeInParaSelection();
+	//-----IAccessibility2 Implementation 2009
+
     void _InvalidateRelationSet( const SwFrm* pFrm, sal_Bool bFrom );
 
 	::com::sun::star::uno::Reference<
@@ -174,6 +190,15 @@
     {
         return mpVSh;
     }
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh);
+	void AddShapeContext(const SdrObject *pObj,
+							 ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccShape);
+	
+	void AddGroupContext(const SdrObject *pParentObj,
+					::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
+	void RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent);
+	//-----IAccessibility2 Implementation 2009
 
     const SwRect& GetVisArea() const;
 
@@ -214,7 +239,11 @@
 
 	void InvalidateCursorPosition( const SwFrm *pFrm );
 	void InvalidateFocus();
-
+	//IAccessibility2 Implementation 2009-----
+	void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+	void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+	void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
+	//-----IAccessibility2 Implementation 2009
 	void SetCursorContext(
 		const ::vos::ORef < SwAccessibleContext >& rCursorContext );
 
@@ -292,6 +321,14 @@
 		const long _nIndex,
 		const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
 	)	throw (::com::sun::star::uno::RuntimeException);
+	//IAccessibility2 Implementation 2009-----
+	virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel
+		(::com::sun::star::beans::XPropertySet* pSet) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >   GetAccessibleCaption (
+		const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > & xShape)
+    throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 
     // additional Core/Pixel conversions for internal use; also works
     // for preview
@@ -321,5 +358,17 @@
     */
     void GetMapMode( const Point& _rPoint,
                      MapMode&     _orMapMode ) const;
+//IAccessibility2 Implementation 2009-----
+public:
+	virtual sal_Bool IsDocumentSelAll();
+
+	::com::sun::star::uno::WeakReference < ::com::sun::star::accessibility::XAccessible > 
+		GetCursorContext() const { return mxCursorContext; }
+
+    //Para Container for InvalidateCursorPosition
+    typedef std::set< SwAccessibleParagraph* >  SET_PARA;
+    SET_PARA m_setParaAdd;
+    SET_PARA m_setParaRemove;
+    //-----IAccessibility2 Implementation 2009
 };
 #endif
diff --git a/main/sw/inc/crsrsh.hxx b/main/sw/inc/crsrsh.hxx
index 83a2007..262c682 100644
--- a/main/sw/inc/crsrsh.hxx
+++ b/main/sw/inc/crsrsh.hxx
@@ -857,6 +857,13 @@
     // is cursor or the point in/over a right to left formatted text?
     sal_Bool IsInRightToLeftText( const Point* pPt = 0 ) const;
 
+    //IAccessibility2 Implementation 2009-----
+    void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+	SwFrm* oldColFrm;
+	bool   bColumnChange();
+    void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+    void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
+    //-----IAccessibility2 Implementation 2009
     // If the current cursor position is inside a hidden range, the hidden range
     // is selected and true is returned:
     bool SelectHiddenRange();
diff --git a/main/sw/inc/doc.hxx b/main/sw/inc/doc.hxx
index ef0b784..76a1a04 100644
--- a/main/sw/inc/doc.hxx
+++ b/main/sw/inc/doc.hxx
@@ -481,6 +481,9 @@
     bool mbClipBoard             : 1;    // true: this document represents the clipboard
     bool mbColumnSelection       : 1;    // true: this content has bee created by a column selection
                                          //       (clipboard docs only)
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool	bIsPrepareSelAll		:1;
+	//-----IAccessibility2 Implementation 2009
 
 #ifdef DBG_UTIL
     bool mbXMLExport : 1;                // sal_True: during XML export
@@ -701,6 +704,11 @@
      SwFmt *_MakeFrmFmt(const String &, SwFmt *, sal_Bool, sal_Bool );
      SwFmt *_MakeTxtFmtColl(const String &, SwFmt *, sal_Bool, sal_Bool );
 
+//IAccessibility2 Implementation 2009-----
+private:
+	sal_Bool bReadOnly;
+	String msDocAccTitle;
+
      void InitTOXTypes();
      void   Paste( const SwDoc& );
      bool DeleteAndJoinImpl(SwPaM&, const bool);
@@ -710,6 +718,12 @@
      bool ReplaceRangeImpl(SwPaM&, String const&, const bool);
 
 public:
+	virtual void setDocReadOnly( sal_Bool b) { bReadOnly = b; }
+	virtual sal_Bool getDocReadOnly() const { return bReadOnly; }
+	virtual void setDocAccTitle( const String& rTitle ) { msDocAccTitle = rTitle; }
+	virtual const String getDocAccTitle() const { return msDocAccTitle; }
+	//-----IAccessibility2 Implementation 2009
+
 	enum DocumentType {
 		DOCTYPE_NATIVE,
 		DOCTYPE_MSWORD				//This doc medul is come from Ms Word
@@ -1049,6 +1063,14 @@
     bool InXMLExport() const            { return mbXMLExport; }
     void SetXMLExport( bool bFlag )     { mbXMLExport = bFlag; }
 #endif
+	//-----IAccessibility2 Implementation 2009
+	void SetSelAll( sal_Bool bSel ) 
+	{
+		bIsPrepareSelAll = bSel;
+	}
+	sal_Bool IsPrepareSelAll()  { return bIsPrepareSelAll; }
+	void SetPrepareSelAll() { bIsPrepareSelAll = sal_True; }
+	//IAccessibility2 Implementation 2009-----
 
     void SetContainsAtPageObjWithContentAnchor( const bool bFlag )
     {
diff --git a/main/sw/inc/docsh.hxx b/main/sw/inc/docsh.hxx
index 7a0cd41..fcd6bda 100644
--- a/main/sw/inc/docsh.hxx
+++ b/main/sw/inc/docsh.hxx
@@ -304,7 +304,13 @@
     // read by the binary filter:
     virtual void UpdateLinks();
     // <--
+	//IAccessibility2 Implementation 2009-----
+	virtual void setDocAccTitle( const String& rTitle );
+	virtual const String getDocAccTitle() const;
 
+	void setDocReadOnly( sal_Bool bReadOnly);
+	sal_Bool getDocReadOnly() const;
+	//-----IAccessibility2 Implementation 2009
     ::com::sun::star::uno::Reference< ::com::sun::star::frame::XController >
                                 GetController();
 
diff --git a/main/sw/inc/fesh.hxx b/main/sw/inc/fesh.hxx
index 02cfbff..b2839e1 100644
--- a/main/sw/inc/fesh.hxx
+++ b/main/sw/inc/fesh.hxx
@@ -482,6 +482,10 @@
 	sal_uInt16 IsObjSelected() const;	//Liefert gleich die Anzahl der Objekte,
 									//zaehlt aber nicht die Objekte in Gruppen.
 	sal_Bool IsObjSelected( const SdrObject& rObj ) const;
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool IsObjSameLevelWithMarked(const SdrObject* pObj) const;
+    const SdrMarkList* GetMarkList() const{ return _GetMarkList(); };
+    //-----IAccessibility2 Implementation 2009
 
 	void EndTextEdit();				//Loescht ggf. das Objekt.
 
diff --git a/main/sw/inc/fldbas.hxx b/main/sw/inc/fldbas.hxx
index 805dad8..bf5a262 100644
--- a/main/sw/inc/fldbas.hxx
+++ b/main/sw/inc/fldbas.hxx
@@ -138,8 +138,18 @@
     TYP_DROPDOWN,
 	TYP_END
 };
-
-
+//IAccessibility2 Implementation 2009-----
+enum SwAttrFieldTYpe
+{
+	ATTR_NONE,
+	ATTR_DATEFLD,
+	ATTR_TIMEFLD,
+	ATTR_PAGENUMBERFLD,
+	ATTR_PAGECOOUNTFLD,
+	ATTR_BOOKMARKFLD,
+	ATTR_SETREFATTRFLD
+};
+//-----IAccessibility2 Implementation 2009
 enum SwFileNameFormat
 {
 	FF_BEGIN,
diff --git a/main/sw/inc/frmfmt.hxx b/main/sw/inc/frmfmt.hxx
index 875d55c..74a0890 100644
--- a/main/sw/inc/frmfmt.hxx
+++ b/main/sw/inc/frmfmt.hxx
@@ -48,11 +48,17 @@
         ::com::sun::star::uno::XInterface> m_wXObject;
 
 protected:
+	//IAccessibility2 Implementation 2009-----
+	SwFrmFmt* pCaptionFmt;
+	//-----IAccessibility2 Implementation 2009
 	SwFrmFmt( SwAttrPool& rPool, const sal_Char* pFmtNm,
 				SwFrmFmt *pDrvdFrm, sal_uInt16 nFmtWhich = RES_FRMFMT,
 				const sal_uInt16* pWhichRange = 0 )
 	  	: SwFmt( rPool, pFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
 				pDrvdFrm, nFmtWhich )
+				//IAccessibility2 Implementation 2009-----
+				,pCaptionFmt( NULL )
+				//-----IAccessibility2 Implementation 2009
 	{}
 
 	SwFrmFmt( SwAttrPool& rPool, const String &rFmtNm,
@@ -60,6 +66,9 @@
 				const sal_uInt16* pWhichRange = 0 )
 	  	: SwFmt( rPool, rFmtNm, (pWhichRange ? pWhichRange : aFrmFmtSetRange),
 				pDrvdFrm, nFmtWhich )
+				//IAccessibility2 Implementation 2009-----
+				,pCaptionFmt( NULL )
+				//-----IAccessibility2 Implementation 2009
 	{}
 
    virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNewValue );
@@ -128,6 +137,11 @@
     // <--
 
     virtual String GetDescription() const;
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool HasCaption() const;
+	void SetCaptionFmt(SwFrmFmt* pFmt);
+	SwFrmFmt* GetCaptionFmt() const;
+	//-----IAccessibility2 Implementation 2009	
 
     SW_DLLPRIVATE ::com::sun::star::uno::WeakReference<
         ::com::sun::star::uno::XInterface> const& GetXObject() const
@@ -145,6 +159,10 @@
 class SW_DLLPUBLIC SwFlyFrmFmt: public SwFrmFmt
 {
 	friend class SwDoc;
+	//IAccessibility2 Implementation 2009-----
+	String msTitle;
+	String msDesc;
+	//-----IAccessibility2 Implementation 2009
 
     // #i972:
     // it stores the previous position of Prt rectangle from RequestObjectResize
diff --git a/main/sw/inc/mdiexp.hxx b/main/sw/inc/mdiexp.hxx
index f069c76..376535a 100644
--- a/main/sw/inc/mdiexp.hxx
+++ b/main/sw/inc/mdiexp.hxx
@@ -70,5 +70,7 @@
 
 sal_Bool JumpToSwMark( ViewShell* pVwSh, const UniString& rMark );
 
+// IAccessible2 Implementation
+extern void AccessibilityScrollMDI(ViewShell* pVwSh, const SwRect &, sal_uInt16 nRangeX, sal_uInt16 nRangeY, sal_Bool isLeftTop);
 
 #endif
diff --git a/main/sw/inc/ndole.hxx b/main/sw/inc/ndole.hxx
index 14bbf09..d184762 100644
--- a/main/sw/inc/ndole.hxx
+++ b/main/sw/inc/ndole.hxx
@@ -66,6 +66,9 @@
     const com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject > GetOleRef();
     svt::EmbeddedObjectRef& GetObject();
     const String& GetCurrentPersistName() const { return aName; }
+	//IAccessibility2 Implementation 2009-----
+	String GetStyleString();
+	//-----IAccessibility2 Implementation 2009
 	sal_Bool IsOleRef() const;	//Damit das Objekt nicht unnoetig geladen werden muss.
 #endif
 };
diff --git a/main/sw/inc/node.hxx b/main/sw/inc/node.hxx
index 7ffd592..23540fb 100644
--- a/main/sw/inc/node.hxx
+++ b/main/sw/inc/node.hxx
@@ -442,7 +442,12 @@
 	 * Dokument. Die Contentframes werden aus dem entsprechenden
 	 * Layout ausgehaengt.
 	 */
-	void DelFrms();
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add an input param to identify if acc table should be disposed
+	//void DelFrms();
+	void DelFrms( sal_Bool bNeedDel = sal_False, sal_Bool bIsAccTableDispose = sal_True );
+	//void DelFrms(sal_Bool bNeedDel = sal_False);//added by zlcdl for al
+	//-----IAccessibility2 Implementation 2009
 
 	/*
 	 * liefert die Anzahl der Elemente des Inhalts des Nodes;
diff --git a/main/sw/inc/tblsel.hxx b/main/sw/inc/tblsel.hxx
index 4b12cae..8bc23b0 100644
--- a/main/sw/inc/tblsel.hxx
+++ b/main/sw/inc/tblsel.hxx
@@ -177,7 +177,11 @@
 
 	void SetTableLines( const SwSelBoxes &rBoxes, const SwTable &rTable );
 	void SetTableLines( const SwTable &rTable );
-	void DelFrms ( SwTable &rTable );
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add an input param to identify if acc table should be disposed
+	//void DelFrms ( SwTable &rTable );
+	void DelFrms ( SwTable &rTable,sal_Bool bAccTableDispose = sal_False );
+	//-----IAccessibility2 Implementation 2009
 	void MakeFrms( SwTable &rTable );
 	void MakeNewFrms( SwTable &rTable, const sal_uInt16 nNumber,
 									   const sal_Bool bBehind );
diff --git a/main/sw/inc/viewsh.hxx b/main/sw/inc/viewsh.hxx
index 5f91df6..78f7df1 100644
--- a/main/sw/inc/viewsh.hxx
+++ b/main/sw/inc/viewsh.hxx
@@ -353,7 +353,9 @@
     OutputDevice& GetRefDev() const;
     inline Window* GetWin()    const { return pWin; }
     inline OutputDevice* GetOut()     const { return pOut; }
-
+    //IAccessibility2 Implementation 2009-----
+    void SetWin(Window* win) { pWin = win; }
+   //-----IAccessibility2 Implementation 2009
 	static inline sal_Bool IsLstEndAction() { return ViewShell::bLstAct; }
 
     //Andern alle PageDescriptoren
diff --git a/main/sw/source/core/access/acccell.cxx b/main/sw/source/core/access/acccell.cxx
index b098ed7..30ea2ff 100644
--- a/main/sw/source/core/access/acccell.cxx
+++ b/main/sw/source/core/access/acccell.cxx
@@ -50,6 +50,14 @@
 
 #include <limits.h>
 
+//IAccessibility2 Implementation 2009-----
+#include <ndtxt.hxx>
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include "acctable.hxx"
+//-----IAccessibility2 Implementation 2009
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
@@ -90,6 +98,10 @@
     DBG_ASSERT( pVSh, "no shell?" );
 	if( pVSh->ISA( SwCrsrShell ) )
 		rStateSet.AddState( AccessibleStateType::SELECTABLE );
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add resizable state to table cell.
+	rStateSet.AddState( AccessibleStateType::RESIZABLE );
+	//-----IAccessibility2 Implementation 2009
 
 	// SELECTED
 	if( IsSelected() )
@@ -104,6 +116,7 @@
 SwAccessibleCell::SwAccessibleCell( SwAccessibleMap *pInitMap,
                                     const SwCellFrm *pCellFrm )
     : SwAccessibleContext( pInitMap, AccessibleRole::TABLE_CELL, pCellFrm )
+    , aSelectionHelper( *this )
     , bIsSelected( sal_False )
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
@@ -111,6 +124,13 @@
     SetName( sBoxName );
 
 	bIsSelected = IsSelected();
+
+	//IAccessibility2 Implementation 2009-----
+	//Need not assign the pointer of accessible table object to m_pAccTable, 
+	//for it already done in SwAccessibleCell::GetTable(); Former codes:
+	//m_pAccTable= GetTable();
+	GetTable();
+	//-----IAccessibility2 Implementation 2009
 }
 
 sal_Bool SwAccessibleCell::_InvalidateMyCursorPos()
@@ -131,9 +151,16 @@
 	}
 
 	sal_Bool bChanged = bOld != bNew;
+	//IAccessibility2 Implementation 2009-----
 	if( bChanged )
+	{
 		FireStateChangedEvent( AccessibleStateType::SELECTED, bNew );
-
+		if (m_pAccTable)
+		{
+			m_pAccTable->AddSelectionCell(this,bNew);
+		}
+	}	
+	//-----IAccessibility2 Implementation 2009
 	return bChanged;
 }
 
@@ -157,8 +184,10 @@
 				{
 					ASSERT( xAccImpl->GetFrm()->IsCellFrm(),
 						 	"table child is not a cell frame" )
-					bChanged |= static_cast< SwAccessibleCell *>(
+					//IAccessibility2 Implementation 2009-----
+					bChanged = static_cast< SwAccessibleCell *>( 
 							xAccImpl.getBodyPtr() )->_InvalidateMyCursorPos();
+					//-----IAccessibility2 Implementation 2009 
 				}
 				else
 					bChanged = sal_True; // If the context is not know we
@@ -179,6 +208,22 @@
 
 void SwAccessibleCell::_InvalidateCursorPos()
 {
+	//IAccessibility2 Implementation 2009-----
+	if (IsSelected())
+	{
+		const SwAccessibleChild aChild( GetChild( *(GetMap()), 0 ) );
+		if( aChild.IsValid()  && aChild.GetSwFrm() )
+		{
+			::vos::ORef < SwAccessibleContext > xChildImpl(	GetMap()->GetContextImpl( aChild.GetSwFrm())  );
+			if(xChildImpl.isValid())
+			{
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::STATE_CHANGED;
+				aEvent.NewValue<<=AccessibleStateType::FOCUSED;
+				xChildImpl->FireAccessibleEvent( aEvent );
+			}
+		}
+	}
 
     const SwFrm *pParent = GetParent( SwAccessibleChild(GetFrm()), IsInPagePreview() );
 	ASSERT( pParent->IsTabFrm(), "parent is not a tab frame" );
@@ -188,6 +233,8 @@
 
 	while( pTabFrm )
 	{
+                _InvalidateChildrenCursorPos( pTabFrm );
+/*
 		sal_Bool bChanged = _InvalidateChildrenCursorPos( pTabFrm );
 		if( bChanged )
 		{
@@ -200,9 +247,14 @@
 				xAccImpl->FireAccessibleEvent( aEvent );
 			}
 		}
-
+*/
 		pTabFrm = pTabFrm->GetFollow();
 	}
+	if (m_pAccTable)
+	{
+		m_pAccTable->FireSelectionEvent();
+	}		
+	//-----IAccessibility2 Implementation 2009
 }
 
 sal_Bool SwAccessibleCell::HasCursor()
@@ -273,6 +325,21 @@
 uno::Any SwAccessibleCell::queryInterface( const uno::Type& rType )
     throw( uno::RuntimeException )
 {
+	//IAccessibility2 Implementation 2009-----
+	if (rType == ::getCppuType((const uno::Reference<XAccessibleExtendedAttributes>*)0))
+	{
+		uno::Any aR; 
+		aR <<= uno::Reference<XAccessibleExtendedAttributes>(this); 
+		return aR;
+	}
+
+	if (rType == ::getCppuType((const uno::Reference<XAccessibleSelection>*)0))
+	{
+		uno::Any aR; 
+		aR <<= uno::Reference<XAccessibleSelection>(this); 
+		return aR;
+	}
+	//-----IAccessibility2 Implementation 2009
     if ( rType == ::getCppuType( static_cast< uno::Reference< XAccessibleValue > * >( 0 ) ) )
     {
         uno::Reference<XAccessibleValue> xValue = this;
@@ -326,7 +393,8 @@
     return pCellFrm->GetTabBox()->GetFrmFmt();
 }
 
-
+//IAccessibility2 Implementation 2009-----
+//Implement TableCell currentValue
 uno::Any SwAccessibleCell::getCurrentValue( )
     throw( uno::RuntimeException )
 {
@@ -334,9 +402,33 @@
 	CHECK_FOR_DEFUNC( XAccessibleValue );
 
     uno::Any aAny;
-    aAny <<= GetTblBoxFormat()->GetTblBoxValue().GetValue();
+
+    const SwCellFrm* pCellFrm = static_cast<const SwCellFrm*>( GetFrm() );
+    const SwStartNode *pSttNd = pCellFrm->GetTabBox()->GetSttNd();	
+	if( pSttNd )
+	{
+		::rtl::OUString strRet;	
+		SwNodeIndex aCntntIdx( *pSttNd, 0 );
+		SwCntntNode* pCNd=NULL;
+		for(int nIndex = 0 ; 
+			0 != ( pCNd = pSttNd->GetNodes().GoNext( &aCntntIdx ) ) &&
+			aCntntIdx.GetIndex() < pSttNd->EndOfSectionIndex(); 
+			++nIndex )
+		{
+			if(pCNd && pCNd->IsTxtNode())
+			{
+				if (0 != nIndex)
+				{
+					strRet += ::rtl::OUString::createFromAscii(" ");					
+				}
+				strRet +=((SwTxtNode*)pCNd)->GetTxt();				
+			}
+		}
+		aAny <<= strRet;
+	}
     return aAny;
 }
+//-----IAccessibility2 Implementation 2009
 
 sal_Bool SwAccessibleCell::setCurrentValue( const uno::Any& aNumber )
     throw( uno::RuntimeException )
@@ -369,3 +461,133 @@
     aAny <<= -DBL_MAX;
     return aAny;
 }
+
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString ReplaceOneChar(::rtl::OUString oldOUString, ::rtl::OUString replacedChar, ::rtl::OUString replaceStr)
+{
+	int iReplace = -1;
+	iReplace = oldOUString.lastIndexOf(replacedChar);
+	if (iReplace > -1)
+	{
+		for(;iReplace>-1;)
+		{
+			oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+			iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+		}
+	}
+	return oldOUString;
+}
+::rtl::OUString ReplaceFourChar(::rtl::OUString oldOUString)
+{
+	oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("\\"),OUString::createFromAscii("\\\\"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(";"),::rtl::OUString::createFromAscii("\\;"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("="),::rtl::OUString::createFromAscii("\\="));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(","),::rtl::OUString::createFromAscii("\\,"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(":"),::rtl::OUString::createFromAscii("\\:"));
+	return oldOUString;
+}
+
+::com::sun::star::uno::Any SAL_CALL SwAccessibleCell::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	::com::sun::star::uno::Any strRet;
+    SwFrmFmt *pFrmFmt = GetTblBoxFormat();
+	DBG_ASSERT(pFrmFmt,"Must be Valid");
+	
+	const SwTblBoxFormula& tbl_formula = pFrmFmt->GetTblBoxFormula();
+
+	::rtl::OUString strFormula = ReplaceFourChar(tbl_formula.GetFormula());
+	::rtl::OUString strFor = ::rtl::OUString::createFromAscii("Formula:");
+	strFor += strFormula;
+	strFor += ::rtl::OUString::createFromAscii(";") ; 
+	strRet <<= strFor;
+
+	return strRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleCell::getBackground() 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+	sal_uInt32 crBack = rBack.GetColor().GetColor();
+	
+	if (COL_AUTO == crBack)
+	{
+		uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
+		if (xAccDoc.is())
+		{
+			uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc, uno::UNO_QUERY);
+			if (xCompoentDoc.is())
+			{
+				crBack = (sal_uInt32)xCompoentDoc->getBackground();
+			}
+		}
+	}
+	return crBack;
+}
+
+//=====  XAccessibleSelection  ============================================
+void SwAccessibleCell::selectAccessibleChild( 
+    sal_Int32 nChildIndex ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    aSelectionHelper.selectAccessibleChild(nChildIndex);
+}
+
+sal_Bool SwAccessibleCell::isAccessibleChildSelected( 
+    sal_Int32 nChildIndex ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    return aSelectionHelper.isAccessibleChildSelected(nChildIndex);
+}
+
+void SwAccessibleCell::clearAccessibleSelection(  ) 
+	throw ( uno::RuntimeException )
+{
+    aSelectionHelper.clearAccessibleSelection();
+}
+
+void SwAccessibleCell::selectAllAccessibleChildren(  ) 
+    throw ( uno::RuntimeException )
+{
+    aSelectionHelper.selectAllAccessibleChildren();
+}
+
+sal_Int32 SwAccessibleCell::getSelectedAccessibleChildCount(  ) 
+    throw ( uno::RuntimeException )
+{
+    return aSelectionHelper.getSelectedAccessibleChildCount();
+}
+
+uno::Reference<XAccessible> SwAccessibleCell::getSelectedAccessibleChild( 
+    sal_Int32 nSelectedChildIndex ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+    return aSelectionHelper.getSelectedAccessibleChild(nSelectedChildIndex);
+}
+
+void SwAccessibleCell::deselectAccessibleChild( 
+    sal_Int32 nSelectedChildIndex ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    aSelectionHelper.deselectAccessibleChild(nSelectedChildIndex);
+}
+
+SwAccessibleTable *SwAccessibleCell::GetTable()
+{
+	if (!m_pAccTable)
+	{
+		if (!xTableReference.is())
+		{
+			xTableReference = getAccessibleParent();
+		#ifdef OSL_DEBUG_LEVEL
+			uno::Reference<XAccessibleContext> xContextTable(xTableReference, uno::UNO_QUERY);
+			OSL_ASSERT(xContextTable.is() && xContextTable->getAccessibleRole() == AccessibleRole::TABLE);
+		#endif
+			//SwAccessibleTable aTable = *(static_cast<SwAccessibleTable *>(xTable.get()));
+		}
+		m_pAccTable = static_cast<SwAccessibleTable *>(xTableReference.get());
+	}
+	return m_pAccTable;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/acccell.hxx b/main/sw/source/core/access/acccell.hxx
index 5553d25..c88b219 100644
--- a/main/sw/source/core/access/acccell.hxx
+++ b/main/sw/source/core/access/acccell.hxx
@@ -26,13 +26,27 @@
 #include "acccontext.hxx"
 #include <com/sun/star/accessibility/XAccessibleValue.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+
+#ifndef _ACCSELECTIONHELPER_HXX_
+#include <accselectionhelper.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
+
 class SwCellFrm;
+class SwAccessibleTable;
 class SwFrmFmt;
 
 class SwAccessibleCell : public	SwAccessibleContext,
-                  ::com::sun::star::accessibility::XAccessibleValue
-
+                  ::com::sun::star::accessibility::XAccessibleValue,
+                  ::com::sun::star::accessibility::XAccessibleSelection, 
+					public  ::com::sun::star::accessibility::XAccessibleExtendedAttributes
 {
+    // Implementation for XAccessibleSelection interface
+    SwAccessibleSelectionHelper aSelectionHelper;
 	sal_Bool	bIsSelected;	// protected by base class mutex
 
 	sal_Bool	IsSelected();
@@ -110,6 +124,11 @@
 
 	//=====  XAccessibleValue  ================================================
 
+	//=====  XAccessibleExtendedAttributes ================================================	
+	//IAccessibility2 Implementation 2009-----
+	::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	//-----IAccessibility2 Implementation 2009
 private:
     SwFrmFmt* GetTblBoxFormat() const;
 
@@ -126,6 +145,41 @@
 
     virtual ::com::sun::star::uno::Any SAL_CALL getMinimumValue(  )
         throw (::com::sun::star::uno::RuntimeException);
+	//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleComponent  ============================================
+	sal_Int32 SAL_CALL getBackground() 
+		throw (::com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleSelection  ============================================
+	virtual void SAL_CALL selectAccessibleChild( 
+        sal_Int32 nChildIndex ) 
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+                ::com::sun::star::uno::RuntimeException );
+
+    virtual sal_Bool SAL_CALL isAccessibleChildSelected( 
+        sal_Int32 nChildIndex ) 
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+                ::com::sun::star::uno::RuntimeException );
+    virtual void SAL_CALL clearAccessibleSelection(  ) 
+        throw ( ::com::sun::star::uno::RuntimeException );
+    virtual void SAL_CALL selectAllAccessibleChildren(  ) 
+        throw ( ::com::sun::star::uno::RuntimeException );
+    virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) 
+        throw ( ::com::sun::star::uno::RuntimeException );
+    virtual ::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);
+
+    virtual void SAL_CALL deselectAccessibleChild( 
+        sal_Int32 nSelectedChildIndex ) 
+        throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+                ::com::sun::star::uno::RuntimeException );
+
+	SwAccessibleTable *GetTable();
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xTableReference;
+	SwAccessibleTable *m_pAccTable;
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/acccontext.cxx b/main/sw/source/core/access/acccontext.cxx
index 0adca2d..1599436 100644
--- a/main/sw/source/core/access/acccontext.cxx
+++ b/main/sw/source/core/access/acccontext.cxx
@@ -60,6 +60,11 @@
 #include <acccontext.hxx>
 #include <svx/AccessibleShape.hxx>
 #include <comphelper/accessibleeventnotifier.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _ACCPARA_HXX
+#include "accpara.hxx"
+#endif
+//-----IAccessibility2 Implementation 2009
 #include <PostItMgr.hxx>
 
 using namespace sw::access;
@@ -225,8 +230,11 @@
                             "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
                     const SwFrm* pLower( rLower.GetSwFrm() );
 					::vos::ORef< SwAccessibleContext > xAccImpl =
-						GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
-												SCROLLED_IN == eAction );
+						//IAccessibility2 Implementation 2009-----
+						//O is: GetMap()->GetContextImpl( pLower, SCROLLED_OUT == eAction ||
+						//						SCROLLED_IN == eAction );
+						GetMap()->GetContextImpl( pLower, sal_True );
+						//-----IAccessibility2 Implementation 2009
 					if( xAccImpl.isValid() )
 					{
 						switch( eAction )
@@ -257,10 +265,15 @@
                     ASSERT( !rLower.AlwaysIncludeAsChild(),
                             "<SwAccessibleContext::ChildrenScrolled(..)> - always included child not considered!" );
 					::vos::ORef< ::accessibility::AccessibleShape > xAccImpl =
+						//IAccessibility2 Implementation 2009-----
+						//O is:	GetMap()->GetContextImpl( rLower.GetSdrObject(),
+						//						  this,
+						//						  SCROLLED_OUT == eAction ||
+						//						  SCROLLED_IN == eAction ); 
                         GetMap()->GetContextImpl( rLower.GetDrawObject(),
 												  this,
-												  SCROLLED_OUT == eAction ||
-												  SCROLLED_IN == eAction );
+												  sal_True );
+						//-----IAccessibility2 Implementation 2009
 					if( xAccImpl.isValid() )
 					{
 						switch( eAction )
@@ -280,8 +293,11 @@
 								xAccImpl->ViewForwarderChanged(
 									::accessibility::IAccessibleViewForwarderListener::VISIBLE_AREA,
 									GetMap() );
-                                DisposeShape( rLower.GetDrawObject(),
-											  xAccImpl.getBodyPtr() );
+								//IAccessibility2 Implementation 2009-----
+								//Remove
+								//DisposeShape( rLower.GetDrawObject(),
+								//			  xAccImpl.getBodyPtr() );
+								//-----IAccessibility2 Implementation 2009
 							}
 							break;
 						case NONE:
@@ -390,8 +406,11 @@
 	// the child event. In this case no listener will exist.
 	FireStateChangedEvent( AccessibleStateType::SHOWING, sal_False );
 
+	//IAccessibility2 Implementation 2009-----
+	//Remove Dispose When scrolledout
 	// We now dispose the frame
-	Dispose( sal_True );
+	//	Dispose( sal_True );
+	//-----IAccessibility2 Implementation 2009
 }
 
 // --> OD 2005-12-12 #i27301# - use new type definition for <_nStates>
@@ -527,8 +546,14 @@
 
 	// EDITABLE
 	if( bIsEditableState )
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Set editable state to graphic and other object when the document is editable
+	{
 		rStateSet.AddState( AccessibleStateType::EDITABLE );
-
+		rStateSet.AddState( AccessibleStateType::RESIZABLE );
+		rStateSet.AddState( AccessibleStateType::MOVEABLE );
+	}
+	//-----IAccessibility2 Implementation 2009
 	// ENABLED
 	rStateSet.AddState( AccessibleStateType::ENABLED );
 
@@ -564,6 +589,12 @@
     , nRole( nR )
     , bDisposing( sal_False )
     , bRegisteredAtAccessibleMap( true )
+    //IAccessibility2 Implementation 2009-----
+    //Solution:Initialize the begin document load and IfAsynLoad to true
+    , bBeginDocumentLoad( sal_True )
+	, isIfAsynLoad( sal_True )
+	, bIsSeletedInDoc( sal_False)
+	//-----IAccessibility2 Implementation 2009
 {
 	InitStates();
 	DBG_MSG_CD( "constructed" )
@@ -591,6 +622,11 @@
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
 	CHECK_FOR_DEFUNC( XAccessibleContext )
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Notify the frame is a document
+	if( nRole == AccessibleRole::DOCUMENT )		
+		bIsAccDocUse = sal_True;
+	//-----IAccessibility2 Implementation 2009
 
     return bDisposing ? 0 : GetChildCount( *(GetMap()) );
 }
@@ -603,6 +639,12 @@
 
 	CHECK_FOR_DEFUNC( XAccessibleContext )
 
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Notify the frame is a document
+	if( nRole == AccessibleRole::DOCUMENT )		
+		bIsAccDocUse = sal_True;
+	//-----IAccessibility2 Implementation 2009
+
     const SwAccessibleChild aChild( GetChild( *(GetMap()), nIndex ) );
 	if( !aChild.IsValid() )
 	{
@@ -618,6 +660,26 @@
 	{
 		::vos::ORef < SwAccessibleContext > xChildImpl(
 				GetMap()->GetContextImpl( aChild.GetSwFrm(), !bDisposing )  );
+		//IAccessibility2 Implementation 2009-----
+		//Solution:Send out accessible event when begin load.
+		if( bBeginDocumentLoad && nRole == AccessibleRole::DOCUMENT )
+		{
+			
+			FireStateChangedEvent( AccessibleStateType::FOCUSABLE,sal_True );
+			FireStateChangedEvent( AccessibleStateType::BUSY,sal_True );
+			if( !isIfAsynLoad )
+			{
+				FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True );
+				// IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
+				// FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True );
+				FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True );
+			    FireStateChangedEvent( AccessibleStateType::BUSY,sal_False );
+				// MT: OFFSCREEN again?
+			    // FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False );	
+			}
+			bBeginDocumentLoad = sal_False;
+		}
+		//-----IAccessibility2 Implementation 2009
 		if( xChildImpl.isValid() )
 		{
 			xChildImpl->SetParent( this );
@@ -727,6 +789,11 @@
 	::utl::AccessibleStateSetHelper *pStateSet =
 		new ::utl::AccessibleStateSetHelper;
 
+	//IAccessibility2 Implementation 2009-----
+	if( bIsSeletedInDoc )
+		pStateSet->AddState( AccessibleStateType::SELECTED );
+	//-----IAccessibility2 Implementation 2009
+
 	uno::Reference<XAccessibleStateSet> xStateSet( pStateSet );
 	GetStates( *pStateSet );
 
@@ -998,13 +1065,15 @@
 sal_Int32 SAL_CALL SwAccessibleContext::getForeground()
 		throw (uno::RuntimeException)
 {
-	return 0;
+	//IAccessibility2 Implementation 2009-----
+	return COL_BLACK;
+	//-----IAccessibility2 Implementation 2009
 }
 
 sal_Int32 SAL_CALL SwAccessibleContext::getBackground()
 		throw (uno::RuntimeException)
 {
-	return 0xffffff;
+	return COL_WHITE;
 }
 
 
@@ -1051,6 +1120,12 @@
 void SwAccessibleContext::ScrolledInShape( const SdrObject* ,
 								::accessibility::AccessibleShape *pAccImpl )
 {
+	//IAccessibility2 Implementation 2009-----
+	if(NULL == pAccImpl)
+	{
+		return ; 
+	}
+	//-----IAccessibility2 Implementation 2009
 	AccessibleEventObject aEvent;
 	aEvent.EventId = AccessibleEventId::CHILD;
 	uno::Reference< XAccessible > xAcc( pAccImpl );
@@ -1194,7 +1269,10 @@
         SwAccessibleChild( GetParent() ).IsVisibleChildrenOnly() )
 	{
 		// The frame is now invisible -> dispose it
-		Dispose( sal_True );
+		//IAccessibility2 Implementation 2009-----
+		//Remove
+		//Dispose( sal_True );
+		//-----IAccessibility2 Implementation 2009
 	}
 	else
 	{
@@ -1598,3 +1676,15 @@
 	aStrm.Flush();
 }
 #endif
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleContext::SetSelectedState(sal_Bool bSeleted)
+{
+	if(bIsSeletedInDoc != bSeleted)
+	{
+		bIsSeletedInDoc = bSeleted;
+		FireStateChangedEvent( AccessibleStateType::SELECTED, bSeleted );
+		return sal_True;
+	}
+	return sal_False;
+};
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/acccontext.hxx b/main/sw/source/core/access/acccontext.hxx
index 668510c..74f6150 100644
--- a/main/sw/source/core/access/acccontext.hxx
+++ b/main/sw/source/core/access/acccontext.hxx
@@ -98,6 +98,10 @@
     // <--
 
 	void InitStates();
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add a member to identify the firt time that document load
+	sal_Bool bBeginDocumentLoad;
+	//-----IAccessibility2 Implementation 2009
 
 protected:
 	void SetName( const ::rtl::OUString& rName ) { sName = rName; }
@@ -105,7 +109,12 @@
     {
         return nRole;
     }
-
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add a member to identify if the document is Asyn load.
+    sal_Bool isIfAsynLoad;
+	//This flag is used to mark the object's selected state.
+	sal_Bool   bIsSeletedInDoc;
+	//-----IAccessibility2 Implementation 2009
 	void SetParent( SwAccessibleContext *pParent );
 	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> GetWeakParent() const;
 
@@ -172,6 +181,9 @@
 
 public:
 
+	//IAccessibility2 Implementation 2009-----
+	void SetMap(SwAccessibleMap *pM){pMap = pM;}
+	//-----IAccessibility2 Implementation 2009
 	void FireAccessibleEvent( ::com::sun::star::accessibility::AccessibleEventObject& rEvent );
 
 protected:
@@ -415,12 +427,15 @@
     {
         return Select( 0, pObj, bAdd );
     }
+	//IAccessibility2 Implementation 2009-----
+	//This method is used to updated the selected state and fire the selected state changed event.
+	virtual sal_Bool SetSelectedState(sal_Bool bSeleted);
+	sal_Bool  IsSeletedInDoc(){  return bIsSeletedInDoc; }
+	//-----IAccessibility2 Implementation 2009
 
     static ::rtl::OUString GetResource( sal_uInt16 nResId,
                                         const ::rtl::OUString *pArg1 = 0,
                                         const ::rtl::OUString *pArg2 = 0 );
-
-
 };
 
 // some heaviliy used exception support
diff --git a/main/sw/source/core/access/accdoc.cxx b/main/sw/source/core/access/accdoc.cxx
index 8e1fa55..b82e797 100644
--- a/main/sw/source/core/access/accdoc.cxx
+++ b/main/sw/source/core/access/accdoc.cxx
@@ -45,6 +45,31 @@
 #endif
 #include <pagefrm.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include "unostyle.hxx"
+#include "viewsh.hxx"
+#include "docsh.hxx"
+#include <crsrsh.hxx>
+#include "fesh.hxx"
+#include <fmtclds.hxx>
+#include <flyfrm.hxx>
+#include <colfrm.hxx>
+#include <txtfrm.hxx>
+#include <sectfrm.hxx>
+#include <section.hxx>
+#include <svx/unoapi.hxx>
+#include <swmodule.hxx>
+#include <svtools/colorcfg.hxx>
+
+#include <fmtanchr.hxx>
+#include <viewimp.hxx>
+#include <dview.hxx>
+#include <dcontact.hxx>
+#include <svx/svdmark.hxx>
+//-----IAccessibility2 Implementation 2009
 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentView";
 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentView";
 
@@ -178,8 +203,17 @@
 
 	for( sal_Int32 i=0; i < nCount; i++ )
 	{
-		if( xAcc->getAccessibleChild( i ) == xThis )
-			return i;
+		//IAccessibility2 Implementation 2009-----
+		try
+		{
+			if( xAcc->getAccessibleChild( i ) == xThis )
+				return i;
+		}
+		catch(::com::sun::star::lang::IndexOutOfBoundsException e)
+		{
+			return -1L;
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 	return -1L;
 }
@@ -190,20 +224,62 @@
 	return GetResource( STR_ACCESS_DOC_DESC );
 }
 
+//IAccessibility2 Implementation 2009-----
+OUString SAL_CALL SwAccessibleDocumentBase::getAccessibleName (void)
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	OUString sAccName = GetResource( STR_ACCESS_DOC_WORDPROCESSING );
+	SwDoc *pDoc = GetShell()->GetDoc();
+	if ( pDoc )
+	{
+		OUString sFileName = pDoc->getDocAccTitle();
+		if ( !sFileName.getLength() )
+		{
+			SwDocShell* pDocSh = pDoc->GetDocShell();
+			if ( pDocSh )
+			{
+				sFileName = pDocSh->GetTitle( SFX_TITLE_APINAME );
+			}
+		}
+		OUString sReadOnly;
+		if(pDoc->getDocReadOnly())
+		{
+			sReadOnly = GetResource( STR_ACCESS_DOC_WORDPROCESSING_READONLY );
+		}
+
+		if ( sFileName.getLength() )
+		{
+			sAccName = sFileName + sReadOnly + OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sAccName;			
+		}
+	}
+
+	return sAccName;
+}
+//-----IAccessibility2 Implementation 2009
+
 awt::Rectangle SAL_CALL SwAccessibleDocumentBase::getBounds()
 		throw (uno::RuntimeException)
 {
-	vos::OGuard aGuard(Application::GetSolarMutex());
-
-	Window *pWin = GetWindow();
-
-	CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
-
-	Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
-	awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
-						 aPixBounds.GetWidth(), aPixBounds.GetHeight() );
-
-	return aBox;
+	//IAccessibility2 Implementation 2009-----
+	try
+	{
+		vos::OGuard aGuard(Application::GetSolarMutex());
+		
+		Window *pWin = GetWindow();
+		
+		CHECK_FOR_WINDOW( XAccessibleComponent, pWin )
+			
+			Rectangle aPixBounds( pWin->GetWindowExtentsRelative( pWin->GetAccessibleParentWindow() ) );
+		awt::Rectangle aBox( aPixBounds.Left(), aPixBounds.Top(),
+			aPixBounds.GetWidth(), aPixBounds.GetHeight() );
+		
+		return aBox;
+	}
+	catch(::com::sun::star::lang::IndexOutOfBoundsException e)
+	{
+		return awt::Rectangle();
+	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -303,6 +379,9 @@
 
 	// MULTISELECTABLE
 	rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+	//IAccessibility2 Implementation 2009-----
+	rStateSet.AddState( AccessibleStateType::MANAGES_DESCENDANTS );
+	//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -423,6 +502,24 @@
         uno::Reference<XAccessibleSelection> aSelect = this;
         aRet <<= aSelect;
     }
+    //IAccessibility2 Implementation 2009-----
+    //Solution:Add XEventListener interface support.
+	else if ( (rType == ::getCppuType((uno::Reference<com::sun::star::document::XEventListener> *)NULL)) )
+    {
+        uno::Reference<com::sun::star::document::XEventListener> aSelect = this;
+        aRet <<= aSelect;
+    }
+    else  if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+    {
+        uno::Reference<XAccessibleExtendedAttributes> aAttribute = this;
+        aRet <<= aAttribute;
+    }
+    else if(rType == ::getCppuType((uno::Reference<XAccessibleGetAccFlowTo> *)NULL) )
+    {
+		uno::Reference<XAccessibleGetAccFlowTo> AccFlowTo = this;
+        aRet <<= AccFlowTo;
+    }
+    //-----IAccessibility2 Implementation 2009
     else
         aRet = SwAccessibleContext::queryInterface( rType );
     return aRet;
@@ -435,11 +532,16 @@
 	uno::Sequence< uno::Type > aTypes( SwAccessibleDocumentBase::getTypes() );
 
 	sal_Int32 nIndex = aTypes.getLength();
-	aTypes.realloc( nIndex + 1 );
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Reset types memory alloc
+	//aTypes.realloc( nIndex + 1 );
+	aTypes.realloc( nIndex + 2 );
 
 	uno::Type* pTypes = aTypes.getArray();
 	pTypes[nIndex] = ::getCppuType( static_cast< uno::Reference< XAccessibleSelection > * >( 0 ) );
-
+	//Solution:Add XEventListener interface support.
+	pTypes[nIndex + 1 ] = ::getCppuType( static_cast< uno::Reference< com::sun::star::document::XEventListener > * >( 0 ) );
+	//-----IAccessibility2 Implementation 2009
 	return aTypes;
 }
 
@@ -509,3 +611,415 @@
 {
     maSelectionHelper.deselectAccessibleChild( nChildIndex );
 }
+//IAccessibility2 Implementation 2009-----
+//Solution:Implement XEventListener interfaces
+void SAL_CALL SwAccessibleDocument::notifyEvent( const ::com::sun::star::document::EventObject& Event ) 
+			throw (::com::sun::star::uno::RuntimeException)
+{
+	if ( Event.EventName.equalsAscii( "FirstPageShows" ) )
+	{
+		FireStateChangedEvent( AccessibleStateType::FOCUSED,sal_True );
+	}
+	else if ( Event.EventName.equalsAscii( "LoadFinished" ) )
+	{
+		// IA2 CWS. MT: OFFSCREEN == !SHOWING, should stay consistent
+		// FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_True );		
+		// MT: LoadFinished => Why not SHOWING == TRUE?
+		FireStateChangedEvent( AccessibleStateType::SHOWING,sal_False );		
+	}	
+	else if ( Event.EventName.equalsAscii( "FormatFinished" ) )
+	{
+		FireStateChangedEvent( AccessibleStateType::BUSY,sal_False );
+		// FireStateChangedEvent( AccessibleStateType::OFFSCREEN,sal_False );
+		FireStateChangedEvent( AccessibleStateType::SHOWING,sal_True );
+	}
+	else
+	{
+		isIfAsynLoad = sal_False;
+	}
+}
+
+void SAL_CALL SwAccessibleDocument::disposing( const ::com::sun::star::lang::EventObject& ) 
+			throw (::com::sun::star::uno::RuntimeException)
+{
+}
+
+uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any anyAtrribute;
+	SwDoc *pDoc = GetShell()->GetDoc();
+	
+	if (!pDoc)
+		return anyAtrribute;
+	SwCrsrShell* pCrsrShell = GetCrsrShell();
+	if( !pCrsrShell )
+		return anyAtrribute;
+
+    SwFEShell* pFEShell = pCrsrShell->ISA( SwFEShell )
+								? static_cast<SwFEShell*>( pCrsrShell )
+							: 0;
+	rtl::OUString sAttrName;
+	rtl::OUString sValue;
+	sal_uInt16 nPage, nLogPage;
+	String sDisplay;
+
+	if( pFEShell )
+	{
+		pFEShell->GetPageNumber(-1,sal_True,nPage,nLogPage,sDisplay);
+		sAttrName = rtl::OUString::createFromAscii("page-name:");
+
+
+		sValue = sAttrName + sDisplay ;
+		sAttrName = rtl::OUString::createFromAscii(";page-number:");
+		sValue += sAttrName;
+		sValue += String::CreateFromInt32( nPage ) ;
+		sAttrName = rtl::OUString::createFromAscii(";total-pages:");
+		sValue += sAttrName;
+		sValue += String::CreateFromInt32( pCrsrShell->GetPageCnt() ) ;
+		sValue +=  rtl::OUString::createFromAscii(";");
+
+		
+		sAttrName=rtl::OUString::createFromAscii("line-number:");
+
+
+		
+		SwCntntFrm* pCurrFrm = pCrsrShell->GetCurrFrm();
+		SwPageFrm* pCurrPage=((SwFrm*)pCurrFrm)->FindPageFrm();
+		sal_uLong nLineNum = 0;
+		//IAccessibility2 Implementation 2009-----
+		SwTxtFrm* pTxtFrm = NULL;
+		SwTxtFrm* pCurrTxtFrm = NULL;
+		pTxtFrm = static_cast< SwTxtFrm* >(static_cast< SwPageFrm* > (pCurrPage)->ContainsCntnt());
+		if (pCurrFrm->IsInFly())//such as, graphic,chart
+		{
+			SwFlyFrm *pFlyFrm = pCurrFrm->FindFlyFrm();
+			const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
+			RndStdIds eAnchorId = rAnchor.GetAnchorId();
+			if(eAnchorId == FLY_AS_CHAR)
+			{
+				const SwFrm *pSwFrm = pFlyFrm->GetAnchorFrm();
+				if(pSwFrm->IsTxtFrm())
+					pCurrTxtFrm = ((SwTxtFrm*)(pSwFrm));
+			}
+		}
+		else
+			pCurrTxtFrm = static_cast< SwTxtFrm* >(pCurrFrm);
+		//check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer
+		SwFrm* pFrm = pCurrTxtFrm;
+		while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+			pFrm = pFrm->GetUpper();
+		if ( pFrm )
+			pCurrTxtFrm = NULL;
+		//check shape
+		if(pCrsrShell->Imp()->GetDrawView())
+		{
+			const SdrMarkList &rMrkList = pCrsrShell->Imp()->GetDrawView()->GetMarkedObjectList();
+			for ( sal_uInt16 i = 0; i < rMrkList.GetMarkCount(); ++i )
+			{
+				SdrObject *pObj = rMrkList.GetMark(i)->GetMarkedSdrObj();		
+				SwFrmFmt* pFmt = ((SwDrawContact*)pObj->GetUserCall())->GetFmt();
+				const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
+				if( FLY_AS_CHAR != rAnchor.GetAnchorId() ) 
+					pCurrTxtFrm = NULL;
+			}
+		}
+		//calculate line number
+		if (pCurrTxtFrm && pTxtFrm)
+		{
+			if (!(pCurrTxtFrm->IsInTab() || pCurrTxtFrm->IsInFtn()))
+			{
+				while( pTxtFrm != pCurrTxtFrm )
+				{
+					//check header/footer
+					pFrm = pTxtFrm;
+					while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() )
+						pFrm = pFrm->GetUpper();
+					if ( pFrm )
+					{
+						pTxtFrm = static_cast< SwTxtFrm*>(pTxtFrm->GetNextCntntFrm());
+						continue;
+					}
+					if (!(pTxtFrm->IsInTab() || pTxtFrm->IsInFtn() || pTxtFrm->IsInFly()))
+						nLineNum += pTxtFrm->GetThisLines();
+					pTxtFrm = static_cast< SwTxtFrm* >(pTxtFrm ->GetNextCntntFrm());
+				}
+				SwPaM* pCaret = pCrsrShell->GetCrsr();
+				if (!pCurrTxtFrm->IsEmpty() && pCaret)
+				{
+					sal_uInt16 nActPos = 0;
+					if (pCurrTxtFrm->IsTxtFrm())
+					{
+						const SwPosition* pPoint = NULL;
+						if(pCurrTxtFrm->IsInFly())
+						{
+							SwFlyFrm *pFlyFrm = pCurrTxtFrm->FindFlyFrm();
+							const SwFmtAnchor& rAnchor = pFlyFrm->GetFmt()->GetAnchor();
+							pPoint= rAnchor.GetCntntAnchor();
+						}
+						else
+							pPoint = pCaret->GetPoint();
+						nActPos = pPoint->nContent.GetIndex();
+						nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
+					}
+					else//graphic, form, shape, etc.
+					{
+						SwPosition* pPoint =  pCaret->GetPoint();
+						Point aPt = pCrsrShell->_GetCrsr()->GetPtPos();
+						if( pCrsrShell->GetLayout()->GetCrsrOfst( pPoint, aPt/*,* &eTmpState*/ ) )
+						{
+							nActPos = pPoint->nContent.GetIndex();
+							nLineNum += pCurrTxtFrm->GetLineCount( nActPos );
+						}
+					}
+				}
+				else
+					++nLineNum;
+			}
+		}
+		//-----IAccessibility2 Implementation 2009
+		
+		sValue += sAttrName;
+		sValue += String::CreateFromInt32( nLineNum ) ;
+
+		sValue +=  rtl::OUString::createFromAscii(";");
+
+		
+		SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm();
+
+		sAttrName=rtl::OUString::createFromAscii("column-number:");
+		sValue += sAttrName;		
+
+		sal_uInt16 nCurrCol = 1;
+		if(pCurrCol!=NULL)
+		{
+			//SwLayoutFrm* pParent = pCurrCol->GetUpper();
+			SwFrm* pCurrPageCol=((SwFrm*)pCurrFrm)->FindColFrm();
+			while(pCurrPageCol && pCurrPageCol->GetUpper() && pCurrPageCol->GetUpper()->IsPageFrm())
+			{
+				pCurrPageCol = pCurrPageCol->GetUpper();
+			}
+			
+			SwLayoutFrm* pParent = (SwLayoutFrm*)(pCurrPageCol->GetUpper());
+
+			if(pParent!=NULL)
+			{
+				SwFrm* pCol = pParent->Lower();
+				while(pCol&&(pCol!=pCurrPageCol))
+				{
+					pCol = pCol->GetNext();
+					nCurrCol +=1;
+				}
+			}
+		}
+		sValue += String::CreateFromInt32( nCurrCol ) ;
+		sValue +=  rtl::OUString::createFromAscii(";");
+
+		sAttrName=rtl::OUString::createFromAscii("total-columns:");
+		
+		const SwFmtCol &rFmtCol=pCurrPage->GetAttrSet()->GetCol();
+		sal_uInt16 nColCount=rFmtCol.GetNumCols();
+		nColCount = nColCount>0?nColCount:1;
+		sValue += sAttrName;
+		sValue += String::CreateFromInt32( nColCount ) ;
+		
+		sValue +=  rtl::OUString::createFromAscii(";");
+
+		if(pCurrFrm!=NULL)
+		{
+			SwSectionFrm* pCurrSctFrm=((SwFrm*)pCurrFrm)->FindSctFrm();
+			if(pCurrSctFrm!=NULL && pCurrSctFrm->GetSection()!=NULL )
+			{
+				sAttrName = rtl::OUString::createFromAscii("section-name:");
+		
+				sValue += sAttrName;
+				String sectionName = pCurrSctFrm->GetSection()->GetSectionName();
+
+				sectionName.SearchAndReplace( String::CreateFromAscii( "\\" ), String::CreateFromAscii("\\\\" ));
+				sectionName.SearchAndReplace( String::CreateFromAscii( "=" ), String::CreateFromAscii("\\=" ) );
+				sectionName.SearchAndReplace( String::CreateFromAscii( ";" ), String::CreateFromAscii("\\;" ) );
+				sectionName.SearchAndReplace( String::CreateFromAscii( "," ), String::CreateFromAscii("\\," ) );
+				sectionName.SearchAndReplace( String::CreateFromAscii( ":" ), String::CreateFromAscii("\\:" ) );
+				
+				sValue += sectionName;
+				//sValue += pCurrSctFrm->GetSection()->GetName();
+				
+				sValue += rtl::OUString::createFromAscii(";");
+
+				//section-columns-number
+				{
+				sAttrName=rtl::OUString::createFromAscii("section-columns-number:");
+
+				nCurrCol = 1;
+				
+				if(pCurrCol!=NULL)
+				{
+					SwLayoutFrm* pParent = pCurrCol->GetUpper();
+					if(pParent!=NULL)
+					{
+						SwFrm* pCol = pParent->Lower();
+						while(pCol&&(pCol!=pCurrCol))
+						{
+							pCol = pCol->GetNext();
+							nCurrCol +=1;
+						}
+					}
+				}
+				sValue += sAttrName;
+				sValue += String::CreateFromInt32( nCurrCol ) ;
+				sValue +=  rtl::OUString::createFromAscii(";");
+				}
+
+				//section-total-columns
+				{
+				sAttrName=rtl::OUString::createFromAscii("section-total-columns:");
+				const SwFmtCol &rFmtSctCol=pCurrSctFrm->GetAttrSet()->GetCol();
+				sal_uInt16 nSctColCount=rFmtSctCol.GetNumCols();
+				nSctColCount = nSctColCount>0?nSctColCount:1;
+				sValue += sAttrName;
+				sValue += String::CreateFromInt32( nSctColCount ) ;
+				
+				sValue +=  rtl::OUString::createFromAscii(";");
+				}
+			}
+		}
+		anyAtrribute <<= sValue;
+	}
+	return anyAtrribute;
+}
+
+sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	//IAccessibility2 Implementation 2009-----
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return SW_MOD()->GetColorConfig().GetColorValue( ::svtools::DOCCOLOR ).nColor;
+	//-----IAccessibility2 Implementation 2009
+}
+
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL SwAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException )
+{
+	const sal_Int32 FORSPELLCHECKFLOWTO = 1;
+	const sal_Int32 FORFINDREPLACEFLOWTO = 2;
+	SwAccessibleMap* pAccMap = GetMap();
+	if ( !pAccMap )
+	{
+		goto Rt;
+	}
+
+	if ( nType == FORSPELLCHECKFLOWTO )
+	{
+		uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+		rAny >>= xShape;
+		if( xShape.is() )
+		{
+			SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+			if( pObj )
+			{
+				uno::Reference<XAccessible> xAcc = pAccMap->GetContext(pObj, this, sal_False);
+				uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
+				if ( xAccSelection.is() )
+				{
+					try
+					{
+						if ( xAccSelection->getSelectedAccessibleChildCount() ) 
+						{
+							uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
+							if ( xSel.is() )
+							{
+								uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+								if ( xSelContext.is() )
+								{
+									//if in sw we find the selected paragraph here
+									if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+									{
+										uno::Sequence<uno::Any> aRet( 1 );
+										aRet[0] = uno::makeAny( xSel );
+										return aRet;							
+									}
+								}
+							}
+						}
+					}
+					catch ( com::sun::star::lang::IndexOutOfBoundsException )
+					{
+						//return empty sequence
+						goto Rt;
+					}
+					//end of try...catch
+				}
+				/*uno::Sequence< uno::Any > aRet(1);
+				aRet[0] = uno::makeAny( xAcc );
+				return aRet;*/
+			}
+		}
+		else
+		{
+			uno::Reference< XAccessible > xAcc = pAccMap->GetCursorContext();
+			SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+			if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+			{
+				uno::Sequence< uno::Any > aRet(1);
+				aRet[0] = uno::makeAny( xAcc );
+				return aRet;
+			}
+		}
+	}
+	else if ( nType == FORFINDREPLACEFLOWTO )
+	{
+		SwCrsrShell* pCrsrShell = GetCrsrShell();
+		if ( pCrsrShell )
+		{
+			SwPaM *_pStartCrsr = pCrsrShell->GetCrsr(), *__pStartCrsr = _pStartCrsr;
+			SwCntntNode* pPrevNode = NULL;
+			std::vector<SwFrm*> vFrmList;
+			do
+			{
+				if ( _pStartCrsr && _pStartCrsr->HasMark() )
+				{
+					SwCntntNode* pCntntNode = _pStartCrsr->GetCntntNode();
+					if ( pCntntNode == pPrevNode )
+					{
+						continue;
+					}
+					SwFrm* pFrm = pCntntNode ? pCntntNode->getLayoutFrm( pCrsrShell->GetLayout() ) : NULL;
+					if ( pFrm )
+					{
+						vFrmList.push_back( pFrm );
+					}
+					
+					pPrevNode = pCntntNode;
+				}
+			}
+
+			while( _pStartCrsr && ( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr) );
+
+			if ( vFrmList.size() )
+			{
+				uno::Sequence< uno::Any > aRet(vFrmList.size());
+				std::vector<SwFrm*>::iterator aIter = vFrmList.begin();
+				for ( sal_Int32 nIndex = 0; aIter != vFrmList.end(); aIter++, nIndex++ )
+				{
+					uno::Reference< XAccessible > xAcc = pAccMap->GetContext(*aIter, sal_False);
+					if ( xAcc.is() )
+					{
+						SwAccessibleContext *pAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+						if ( pAccImpl && pAccImpl->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+						{
+							aRet[nIndex] = uno::makeAny( xAcc );
+						}
+					}					
+				}
+
+				return aRet;
+			}
+		}
+	}
+
+Rt:
+	uno::Sequence< uno::Any > aEmpty;
+	return aEmpty;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accdoc.hxx b/main/sw/source/core/access/accdoc.hxx
index 06b1a69..9d703bc 100644
--- a/main/sw/source/core/access/accdoc.hxx
+++ b/main/sw/source/core/access/accdoc.hxx
@@ -26,8 +26,19 @@
 #include "acccontext.hxx"
 #endif
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/document/XEventListener.hpp>
 #include <accselectionhelper.hxx>
 
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleExtendedAttributes_HPP_
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#endif
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEGETACCFLOWTO_HPP_
+#include <com/sun/star/accessibility/XAccessibleGetAccFlowTo.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
+
 class VclSimpleEvent;
 
 /**
@@ -81,6 +92,9 @@
     ///	Return this object's description.
 	virtual ::rtl::OUString SAL_CALL
     	getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
+	//IAccessibility2 Implementation 2009-----
+	virtual ::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 
 	//=====  XAccessibleComponent  ==============================================
     virtual sal_Bool SAL_CALL containsPoint(
@@ -111,7 +125,12 @@
  * access to an accessible Writer document
  */
 class SwAccessibleDocument : public	SwAccessibleDocumentBase,
-                             public com::sun::star::accessibility::XAccessibleSelection
+                             public com::sun::star::accessibility::XAccessibleSelection,
+							 //IAccessibility2 Implementation 2009-----
+                             public com::sun::star::document::XEventListener,
+							 public com::sun::star::accessibility::XAccessibleExtendedAttributes,
+							 //-----IAccessibility2 Implementation 2009
+							 public com::sun::star::accessibility::XAccessibleGetAccFlowTo
 {
     // Implementation for XAccessibleSelection interface
     SwAccessibleSelectionHelper maSelectionHelper;
@@ -129,6 +148,13 @@
     SwAccessibleDocument( SwAccessibleMap* pInitMap );
 
 	DECL_LINK( WindowChildEventListener, VclSimpleEvent* );
+	//IAccessibility2 Implementation 2009-----
+	//=====  XEventListener====================================================
+	virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) 
+			throw (::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Event ) 
+			throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 
 	//=====  XServiceInfo  ====================================================
 
@@ -199,10 +225,23 @@
         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
                 ::com::sun::star::uno::RuntimeException );
 
+	//IAccessibility2 Implementation 2009-----
+    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
 	//====== thread safe C++ interface ========================================
 
 	// The object is not visible an longer and should be destroyed
 	virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+	//=====  XAccessibleComponent  ============================================
+	sal_Int32 SAL_CALL getBackground() 
+		throw (::com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleGetAccFlowTo  ============================================
+	::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException );
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif
diff --git a/main/sw/source/core/access/accembedded.cxx b/main/sw/source/core/access/accembedded.cxx
index 046d1c0..d4afd4d 100644
--- a/main/sw/source/core/access/accembedded.cxx
+++ b/main/sw/source/core/access/accembedded.cxx
@@ -31,6 +31,14 @@
 #include <rtl/uuid.h>
 #include <flyfrm.hxx>
 #include "accembedded.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "cntfrm.hxx"
+#include "ndole.hxx"
+#include <doc.hxx>
+#include <docsh.hxx>
+#include <../../ui/inc/wrtsh.hxx>
+#include <../../ui/inc/view.hxx>
+//-----IAccessibility2 Implementation 2009
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::lang;
@@ -51,6 +59,34 @@
 {
 }
 
+//IAccessibility2 Implementation 2009-----
+//=====  XInterface  ==========================================================
+com::sun::star::uno::Any SAL_CALL
+    SwAccessibleEmbeddedObject::queryInterface (const com::sun::star::uno::Type & rType)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any aReturn = SwAccessibleNoTextFrame::queryInterface (rType);
+    if ( ! aReturn.hasValue())
+        aReturn = ::cppu::queryInterface (rType,
+	     static_cast< ::com::sun::star::accessibility::XAccessibleExtendedAttributes* >(this) );
+    return aReturn;
+}
+
+void SAL_CALL
+    SwAccessibleEmbeddedObject::acquire (void)
+    throw ()
+{
+    SwAccessibleNoTextFrame::acquire ();
+}
+
+void SAL_CALL
+    SwAccessibleEmbeddedObject::release (void)
+    throw ()
+{
+    SwAccessibleNoTextFrame::release ();
+}
+//-----IAccessibility2 Implementation 2009
+
 OUString SAL_CALL SwAccessibleEmbeddedObject::getImplementationName()
         throw( uno::RuntimeException )
 {
@@ -91,3 +127,31 @@
     }
     return aId;
 }
+//IAccessibility2 Implementation 2009-----
+//=====  XAccessibleExtendedAttributes  ========================================================
+::com::sun::star::uno::Any SAL_CALL SwAccessibleEmbeddedObject::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	::com::sun::star::uno::Any strRet;
+	::rtl::OUString style;
+	SwFlyFrm* pFFrm = getFlyFrm();
+	
+	if( pFFrm )
+	{
+		style = ::rtl::OUString::createFromAscii("style:");	
+		SwCntntFrm* pCFrm;
+		pCFrm = pFFrm->ContainsCntnt();
+		if( pCFrm )
+		{
+			SwCntntNode* pCNode = pCFrm->GetNode();
+			if( pCNode )
+			{
+				style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString();
+			}
+		}
+		style += ::rtl::OUString::createFromAscii(";");	
+	}
+	strRet <<= style;
+	return strRet;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accembedded.hxx b/main/sw/source/core/access/accembedded.hxx
index 82217f2..44b6893 100644
--- a/main/sw/source/core/access/accembedded.hxx
+++ b/main/sw/source/core/access/accembedded.hxx
@@ -24,7 +24,12 @@
 #define _ACCEMBEDDED_HXX
 #include "accnotextframe.hxx"
 
-class SwAccessibleEmbeddedObject : public   SwAccessibleNoTextFrame
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+//-----IAccessibility2 Implementation 2009
+class SwAccessibleEmbeddedObject : public	SwAccessibleNoTextFrame
+	        , public ::com::sun::star::accessibility::XAccessibleExtendedAttributes
+			
 {
 
 protected:
@@ -36,6 +41,21 @@
     SwAccessibleEmbeddedObject( SwAccessibleMap* pInitMap,
                                 const SwFlyFrm* pFlyFrm );
 
+	//IAccessibility2 Implementation 2009-----
+    //=====  XInterface  ======================================================
+    
+    virtual com::sun::star::uno::Any SAL_CALL
+        queryInterface (const com::sun::star::uno::Type & rType)
+        throw (::com::sun::star::uno::RuntimeException);
+        
+    virtual void SAL_CALL
+        acquire (void) 
+        throw ();
+        
+    virtual void SAL_CALL
+        release (void)
+        throw ();
+	//-----IAccessibility2 Implementation 2009
 	//=====  XServiceInfo  ====================================================
 
     /**	Returns an identifier for the implementation of this object.
@@ -59,6 +79,12 @@
 
 	//=====  XTypeProvider  ====================================================
     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
+
+	//IAccessibility2 Implementation 2009-----
+	// ====== XAccessibleExtendedAttributes =====================================
+	    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes() 
+			throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/accfield.cxx b/main/sw/source/core/access/accfield.cxx
new file mode 100644
index 0000000..6a6dd79
--- /dev/null
+++ b/main/sw/source/core/access/accfield.cxx
@@ -0,0 +1,355 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#ifndef COMPHELPER_ACCESSIBLE_KEYBINDING_HELPER_HXX
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#endif
+#ifndef _SWURL_HXX //autogen
+#include <swurl.hxx>
+#endif
+#ifndef _VOS_MUTEX_HXX_ //autogen
+#include <vos/mutex.hxx>
+#endif
+#ifndef _SV_SVAPP_HXX //autogen
+#include <vcl/svapp.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _TXTINET_HXX
+#include <txtinet.hxx>
+#endif
+
+#ifndef _ACCPARA_HXX
+#include <accpara.hxx>
+#endif
+#ifndef _ACCFIELD_HXX
+#include <accfield.hxx>
+#endif
+
+#include <comphelper/processfactory.hxx>
+
+#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
+#include <com/sun/star/frame/XDesktop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XLINKTARGETSUPPLIER_HPP_
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#endif
+#ifndef COMPHELPER_ACCESSIBLE_EVENT_NOTIFIER
+#include <comphelper/accessibleeventnotifier.hxx>
+#endif
+
+//Add end
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+// using namespace ::rtl;
+
+SwAccessibleField::SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16 nRole) :
+	m_xPara( p ),m_pSwField(pSwFld),m_nRole(nRole)
+{
+	m_nClientId=0;
+}
+
+uno::Reference< XAccessibleContext > SAL_CALL
+	SwAccessibleField::getAccessibleContext( void )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	uno::Reference < XAccessibleContext > xRet( this );
+	return xRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleChildCount( void )
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return 0;
+}
+
+uno::Reference< XAccessible> SAL_CALL
+	SwAccessibleField::getAccessibleChild( long )
+        throw (::com::sun::star::uno::RuntimeException,
+				::com::sun::star::lang::IndexOutOfBoundsException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return uno::Reference< XAccessible >();
+}
+
+uno::Reference< XAccessible> SAL_CALL SwAccessibleField::getAccessibleParent (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	uno::Reference< XAccessible > xParent(static_cast<XAccessible*>(m_xPara.getBodyPtr()),UNO_QUERY);
+	return xParent;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getAccessibleIndexInParent (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return 0;
+}
+
+sal_Int16 SAL_CALL SwAccessibleField::getAccessibleRole (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	return m_nRole;
+}
+
+rtl::OUString SAL_CALL SwAccessibleField::getAccessibleDescription (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	ASSERT( !this, "description needs to be overloaded" );
+	//THROW_RUNTIME_EXCEPTION( XAccessibleContext, "internal error (method must be overloaded)" );
+	return rtl::OUString();
+}
+
+rtl::OUString SAL_CALL SwAccessibleField::getAccessibleName (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	return rtl::OUString();
+}
+
+uno::Reference< XAccessibleRelationSet> SAL_CALL
+	SwAccessibleField::getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	return NULL;
+}
+
+uno::Reference<XAccessibleStateSet> SAL_CALL
+	SwAccessibleField::getAccessibleStateSet (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return uno::Reference<XAccessibleStateSet>();
+}
+
+com::sun::star::lang::Locale SAL_CALL SwAccessibleField::getLocale (void)
+		throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	com::sun::star::lang::Locale aLoc( Application::GetSettings().GetLocale() );
+	return aLoc;
+}
+
+static sal_Bool lcl_PointInRectangle(const awt::Point & aPoint,
+                                     const awt::Rectangle & aRect)
+{
+    long nDiffX = aPoint.X - aRect.X;
+    long nDiffY = aPoint.Y - aRect.Y;
+
+    return
+        nDiffX >= 0 && nDiffX < aRect.Width && nDiffY >= 0 &&
+        nDiffY < aRect.Height;
+
+}
+
+sal_Bool SAL_CALL SwAccessibleField::containsPoint(
+			const ::com::sun::star::awt::Point& aPoint )
+		throw (RuntimeException)
+{
+    awt::Rectangle aPixBounds = getBoundsImpl(sal_True);
+    aPixBounds.X = 0;
+    aPixBounds.Y = 0;
+
+    return lcl_PointInRectangle(aPoint, aPixBounds);
+}
+
+uno::Reference< XAccessible > SAL_CALL SwAccessibleField::getAccessibleAtPoint(
+				const awt::Point& aPoint )
+		throw (RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	
+	uno::Reference< XAccessible > xAcc;
+	awt::Rectangle rc = getBounds();
+	if(aPoint.X >= rc.X && aPoint.X <= rc.X + rc.Width &&
+		aPoint.Y >= rc.Y && aPoint.Y <= rc.Y + rc.Height )
+	{
+		xAcc =this;
+	}	
+	return xAcc;
+}
+
+
+/**
+   Get bounding box.
+
+   There are two modes.
+
+   - realative
+
+     Return bounding box relative to parent if parent is no root
+     frame. Otherwise return the absolute bounding box.
+
+   - absolute
+
+     Return the absolute bounding box.
+
+   @param bRelative
+   true: Use relative mode.
+   false: Use absolute mode.
+*/
+awt::Rectangle SAL_CALL SwAccessibleField::getBoundsImpl( sal_Bool )
+		throw (RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return awt::Rectangle();
+}
+
+awt::Rectangle SAL_CALL SwAccessibleField::getBounds()
+		throw (RuntimeException)
+{
+    return getBoundsImpl(sal_True);
+}
+
+awt::Point SAL_CALL SwAccessibleField::getLocation()
+    throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_True);
+    awt::Point aPoint(aRect.X, aRect.Y);
+
+    return aPoint;
+}
+
+
+awt::Point SAL_CALL SwAccessibleField::getLocationOnScreen()
+		throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_False);
+    //Point aPixPos = m_xPara->getLocationOnScreen();
+    return awt::Point( aRect.X,aRect.Y);//aPixPos.X() + aRect.nLeft , aPixPos.Y() + + aRect.nRight );
+}
+
+
+awt::Size SAL_CALL SwAccessibleField::getSize()
+		throw (RuntimeException)
+{
+    awt::Rectangle aRect = getBoundsImpl(sal_False);
+	awt::Size aSize( aRect.Width, aRect.Height );
+
+	return aSize;
+}
+
+void SAL_CALL SwAccessibleField::grabFocus()
+		throw (RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	return;
+}
+
+
+sal_Int32 SAL_CALL SwAccessibleField::getForeground()
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleField::getBackground()
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	return 0xffffff;
+}
+::com::sun::star::uno::Any SAL_CALL SwAccessibleField::queryInterface( 
+        const ::com::sun::star::uno::Type& rType ) 
+        throw (::com::sun::star::uno::RuntimeException)
+{
+	Any aRet;
+    if ( rType == ::getCppuType((uno::Reference<XAccessibleContext> *)0) )
+    {
+        Reference<XAccessibleContext> aAccContext = (XAccessibleContext *) this; // resolve ambiguity
+        aRet <<= aAccContext;
+    }
+    else if ( rType == ::getCppuType((Reference<XAccessibleComponent> *)0) )
+    {
+        Reference<XAccessibleComponent> aAccEditComponent = this;
+        aRet <<= aAccEditComponent;
+    }
+	if (rType == ::getCppuType((Reference<XAccessibleEventBroadcaster> *)0))
+	{
+        Reference<XAccessibleEventBroadcaster> aAccBroadcaster= this;
+        aRet <<= aAccBroadcaster;
+	}
+	return aRet;
+}
+
+void SAL_CALL SwAccessibleField::acquire(  ) throw () 
+{
+}
+void SAL_CALL SwAccessibleField::release(  ) throw () 
+{
+}
+
+void SAL_CALL SwAccessibleField::addEventListener(
+			const Reference< XAccessibleEventListener >& xListener )
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	//DBG_MSG( "accessible event listener added" )
+
+	if (xListener.is())
+    {
+    	vos::OGuard aGuard(Application::GetSolarMutex());
+		if (!m_nClientId)
+            m_nClientId = comphelper::AccessibleEventNotifier::registerClient( );
+		comphelper::AccessibleEventNotifier::addEventListener( m_nClientId, xListener );
+    }
+}
+
+void SAL_CALL SwAccessibleField::removeEventListener(
+			const Reference< XAccessibleEventListener >& xListener )
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	//DBG_MSG( "accessible event listener removed" )
+
+	if (xListener.is())
+	{
+    	vos::OGuard aGuard(Application::GetSolarMutex());
+		sal_Int32 nListenerCount = comphelper::AccessibleEventNotifier::removeEventListener( m_nClientId, xListener );
+		if ( !nListenerCount )
+		{
+			// no listeners anymore
+			// -> revoke ourself. This may lead to the notifier thread dying (if we were the last client),
+			// and at least to us not firing any events anymore, in case somebody calls
+			// NotifyAccessibleEvent, again
+			comphelper::AccessibleEventNotifier::revokeClient( m_nClientId );
+			m_nClientId = 0;
+		}
+	}
+}
diff --git a/main/sw/source/core/access/accfield.hxx b/main/sw/source/core/access/accfield.hxx
new file mode 100644
index 0000000..49e8ba9
--- /dev/null
+++ b/main/sw/source/core/access/accfield.hxx
@@ -0,0 +1,220 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ACCFIELD_HXX
+#define _ACCFIELD_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECONTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLECOMPONENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEEVENTBROADCASTER_HPP_
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ILLEGALACCESSIBLECOMPONENTSTATEEXCEPTION_HDL_
+#include <com/sun/star/accessibility/IllegalAccessibleComponentStateException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_DISPOSEDEXCEPTION_HPP_
+#include <com/sun/star/lang/DisposedException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#endif
+#ifndef _COM_SUN_STAR_LANG_INDEXOUTOFBOUNDSEXCEPTION_HPP_
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERLINK_HPP_
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEVALUE_HPP_
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_RUNTIMEEXCEPTION_HPP_
+#include <com/sun/star/uno/RuntimeException.hpp>
+#endif
+#ifndef _VOS_REF_HXX_
+#include <vos/ref.hxx>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE4_HXX_
+#include <cppuhelper/implbase4.hxx>
+#endif
+#ifndef _FMTINFMT_HXX //autogen
+#include <fmtinfmt.hxx>
+#endif
+
+class SwAccessibleParagraph;
+class SwField;
+class SwAccessibleField : 
+	public ::cppu::WeakImplHelper4<
+				::com::sun::star::accessibility::XAccessible,
+                ::com::sun::star::accessibility::XAccessibleContext,
+                ::com::sun::star::accessibility::XAccessibleComponent,
+				::com::sun::star::accessibility::XAccessibleEventBroadcaster
+                >
+{
+	friend class SwAccessibleParagraph;
+	friend class SwAccessibleHyperTextData;
+	
+protected:
+//	sal_uInt16 nHintPos;
+	::vos::ORef< SwAccessibleParagraph > m_xPara;
+	SwField *m_pSwField;
+
+    sal_uInt32 m_nClientId;   // client id in the AccessibleEventNotifier queue
+    sal_Int16 m_nRole;		// immutable outside constructor
+//	sal_Int32 nStartIdx;
+//	sal_Int32 nEndIdx;
+public:
+	SwAccessibleField( SwField *pSwFld,SwAccessibleParagraph *p,sal_Int16);
+
+    virtual void SAL_CALL addEventListener(
+			const ::com::sun::star::uno::Reference<
+				::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL removeEventListener(
+			const ::com::sun::star::uno::Reference<
+				::com::sun::star::accessibility::XAccessibleEventListener >& xListener )
+		throw (::com::sun::star::uno::RuntimeException);
+
+//	const SwTxtAttr *GetTxtAttr() const;
+//	void Invalidate();
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 
+        const ::com::sun::star::uno::Type& aType ) 
+        throw (::com::sun::star::uno::RuntimeException);
+
+    virtual void SAL_CALL acquire(  ) throw () ;
+    virtual void SAL_CALL release(  ) throw () ;
+
+public:
+	//=====  XAccessible  =====================================================
+
+    ///	Return the XAccessibleContext.
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext> SAL_CALL
+    	getAccessibleContext (void) throw (com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleContext  ==============================================
+
+    ///	Return the number of currently visible children.
+    virtual long SAL_CALL getAccessibleChildCount (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return the specified child or NULL if index is invalid.
+    virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+    	getAccessibleChild (long nIndex)
+        throw (::com::sun::star::uno::RuntimeException,
+				::com::sun::star::lang::IndexOutOfBoundsException);
+
+    ///	Return a reference to the parent.
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible> SAL_CALL
+    	getAccessibleParent (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return this objects index among the parents children.
+	virtual	sal_Int32 SAL_CALL
+    	getAccessibleIndexInParent (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return this object's role.
+	virtual sal_Int16 SAL_CALL
+    	getAccessibleRole (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return this object's description.
+	virtual ::rtl::OUString SAL_CALL
+    	getAccessibleDescription (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return the object's current name.
+	virtual ::rtl::OUString SAL_CALL
+    	getAccessibleName (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+	///	Return NULL to indicate that an empty relation set.
+	virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+    	getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+    ///	Return the set of current states.
+	virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
+    	getAccessibleStateSet (void)
+        throw (::com::sun::star::uno::RuntimeException);
+
+	/**	Return the parents locale or throw exception if this object has no
+    	parent yet/anymore.
+    */
+	virtual ::com::sun::star::lang::Locale SAL_CALL
+    	getLocale (void)
+		throw (::com::sun::star::accessibility::IllegalAccessibleComponentStateException, ::com::sun::star::uno::RuntimeException);
+
+	//=====  XAccessibleComponent  ============================================
+    virtual sal_Bool SAL_CALL containsPoint(
+			const ::com::sun::star::awt::Point& aPoint )
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::uno::Reference<
+		::com::sun::star::accessibility::XAccessible > SAL_CALL getAccessibleAtPoint(
+				const ::com::sun::star::awt::Point& aPoint )
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL getBounds()
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocation()
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::awt::Point SAL_CALL getLocationOnScreen()
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual void SAL_CALL grabFocus()
+		throw (::com::sun::star::uno::RuntimeException);
+
+    virtual sal_Int32 SAL_CALL getForeground() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getBackground() 
+		throw (::com::sun::star::uno::RuntimeException);
+
+
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL 
+        getBoundsImpl(sal_Bool bRelative)
+		throw (::com::sun::star::uno::RuntimeException) ;
+
+
+};
+
+#endif
+
diff --git a/main/sw/source/core/access/accfootnote.cxx b/main/sw/source/core/access/accfootnote.cxx
index 96e0d21..71dcf6b 100644
--- a/main/sw/source/core/access/accfootnote.cxx
+++ b/main/sw/source/core/access/accfootnote.cxx
@@ -55,7 +55,6 @@
 SwAccessibleFootnote::SwAccessibleFootnote(
         SwAccessibleMap* pInitMap,
 		sal_Bool bIsEndnote,
-		sal_Int32 nFootEndNote,
 		const SwFtnFrm *pFtnFrm	) :
     SwAccessibleContext( pInitMap,
 		bIsEndnote ? AccessibleRole::END_NOTE : AccessibleRole::FOOTNOTE,
@@ -65,7 +64,19 @@
 
 	sal_uInt16 nResId = bIsEndnote ? STR_ACCESS_ENDNOTE_NAME
 								   : STR_ACCESS_FOOTNOTE_NAME;
-	OUString sArg( OUString::valueOf( nFootEndNote ) );
+	//IAccessibility2 Implementation 2009-----
+	//OUString sArg( OUString::valueOf( nFootEndNote ) );
+	//old codes end
+	OUString sArg;
+	const SwTxtFtn *pTxtFtn =
+		static_cast< const SwFtnFrm *>( GetFrm() )->GetAttr();
+	if( pTxtFtn )
+	{
+		const SwDoc *pDoc = GetShell()->GetDoc();
+		sArg = pTxtFtn->GetFtn().GetViewNumStr( *pDoc );
+	}
+	//-----IAccessibility2 Implementation 2009
+
 	SetName( GetResource( nResId, &sArg ) );
 }
 
diff --git a/main/sw/source/core/access/accfootnote.hxx b/main/sw/source/core/access/accfootnote.hxx
index a2f6bdf..b587e3d 100644
--- a/main/sw/source/core/access/accfootnote.hxx
+++ b/main/sw/source/core/access/accfootnote.hxx
@@ -41,7 +41,6 @@
 
     SwAccessibleFootnote( SwAccessibleMap* pInitMap,
 						  sal_Bool bIsEndnote,
-						  sal_Int32 nFootEndNote,
 						  const SwFtnFrm *pFtnFrm );
 
 
diff --git a/main/sw/source/core/access/accframe.cxx b/main/sw/source/core/access/accframe.cxx
index 4c8c018..f881947 100644
--- a/main/sw/source/core/access/accframe.cxx
+++ b/main/sw/source/core/access/accframe.cxx
@@ -61,7 +61,9 @@
 {
 	sal_Int32 nCount = 0;
 
-    const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+    // const SwAccessibleChildSList aVisList( rVisArea, *pFrm, rAccMap );
+    const SwAccessibleChildSList aVisList( pFrm->PaintArea(), *pFrm, rAccMap );
+
     SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
 	while( aIter != aVisList.end() )
 	{
@@ -163,7 +165,10 @@
     if( SwAccessibleChildMap::IsSortingRequired( rFrm ) )
 	{
 		// We need a sorted list here
-        const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+		//IAccessibility2 Implementation 2009-----
+        // const SwAccessibleChildMap aVisMap( rVisArea, rFrm, rAccMap );
+        const SwAccessibleChildMap aVisMap( rFrm.PaintArea(), rFrm, rAccMap );
+		//-----IAccessibility2 Implementation 2009
         SwAccessibleChildMap::const_iterator aIter( aVisMap.begin() );
 		while( aIter != aVisMap.end() && !bFound )
 		{
@@ -189,7 +194,12 @@
 	{
 		// The unsorted list is sorted enough, because it return lower
 		// frames in the correct order.
-        const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+
+		//IAccessibility2 Implementation 2009-----
+        // const SwAccessibleChildSList aVisList( rVisArea, rFrm, rAccMap );
+        const SwAccessibleChildSList aVisList( rFrm.PaintArea(), rFrm, rAccMap );
+		//-----IAccessibility2 Implementation 2009
+
         SwAccessibleChildSList::const_iterator aIter( aVisList.begin() );
 		while( aIter != aVisList.end() && !bFound )
 		{
@@ -425,7 +435,8 @@
                                       sal_Bool bIsPagePreview ) :
 	maVisArea( rVisArea ),
 	mpFrm( pF ),
-    mbIsInPagePreview( bIsPagePreview )
+    mbIsInPagePreview( bIsPagePreview ),
+    bIsAccDocUse( sal_False )
 {
 }
 
diff --git a/main/sw/source/core/access/accframe.hxx b/main/sw/source/core/access/accframe.hxx
index 96e7183..b523cbe 100644
--- a/main/sw/source/core/access/accframe.hxx
+++ b/main/sw/source/core/access/accframe.hxx
@@ -52,8 +52,9 @@
     static sal_Int32 GetChildCount( SwAccessibleMap& rAccMap,
                                     const SwRect& rVisArea,
 									const SwFrm *pFrm,
-                                    sal_Bool bInPagePreview );
-private:
+                                    sal_Bool bInPagePreviewr );
+
+// private:
     static sw::access::SwAccessibleChild GetChild( SwAccessibleMap& rAccMap,
                                                    const SwRect& rVisArea,
                                                    const SwFrm& rFrm,
@@ -104,6 +105,12 @@
 					   const SwFrm *pFrm,
                        sal_Bool bIsPagePreview );
 	virtual ~SwAccessibleFrame();
+	
+	//IAccessibility2 Implementation 2009-----
+	// MT: Move to private area?
+	sal_Bool bIsAccDocUse;
+	//-----IAccessibility2 Implementation 2009
+	
 
 public:
 	// Return the SwFrm this context is attached to.
diff --git a/main/sw/source/core/access/accframebase.cxx b/main/sw/source/core/access/accframebase.cxx
index 66e7d4f..c592f7f 100644
--- a/main/sw/source/core/access/accframebase.cxx
+++ b/main/sw/source/core/access/accframebase.cxx
@@ -42,6 +42,26 @@
 #include "accmap.hxx"
 #include "accframebase.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _CRSRSH_HXX
+#include <crsrsh.hxx>
+#endif
+#ifndef _FESH_HXX
+#include "fesh.hxx"
+#endif
+#ifndef _TXTFRM_HXX
+#include <txtfrm.hxx>
+#endif
+#ifndef _NDTXT_HXX
+#include <ndtxt.hxx>
+#endif
+#ifndef _DCONTACT_HXX
+#include <dcontact.hxx>
+#endif
+#ifndef _FMTANCHR_HXX
+#include <fmtanchr.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
@@ -93,6 +113,10 @@
 		if( pWin && pWin->HasFocus() )
 			rStateSet.AddState( AccessibleStateType::FOCUSED );
 	}
+	//IAccessibility2 Implementation 2009-----
+	if( GetSelectedState() )
+		rStateSet.AddState( AccessibleStateType::SELECTED );
+	//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -166,20 +190,26 @@
 		Window *pWin = GetWindow();
 		if( pWin && pWin->HasFocus() && bNewSelected )
 			FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
-		FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
+		//IAccessibility2 Implementation 2009-----
+		//FireStateChangedEvent( AccessibleStateType::SELECTED, bNewSelected );
 		if( pWin && pWin->HasFocus() && !bNewSelected )
 			FireStateChangedEvent( AccessibleStateType::FOCUSED, bNewSelected );
-
-		uno::Reference< XAccessible > xParent( GetWeakParent() );
-		if( xParent.is() )
+		if(bNewSelected)
 		{
-			SwAccessibleContext *pAcc =
-				static_cast <SwAccessibleContext *>( xParent.get() );
-
-			AccessibleEventObject aEvent;
-			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-			pAcc->FireAccessibleEvent( aEvent );
+			uno::Reference< XAccessible > xParent( GetWeakParent() );
+			if( xParent.is() )
+			{
+				SwAccessibleContext *pAcc =
+					static_cast <SwAccessibleContext *>( xParent.get() );
+				
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+				uno::Reference< XAccessible > xChild(this);
+				aEvent.NewValue <<= xChild;
+				pAcc->FireAccessibleEvent( aEvent );
+			}
 		}
+		//-----IAccessibility2 Implementation 2009
 	}
 }
 
@@ -247,13 +277,13 @@
 		break;
 	case RES_OBJECTDYING:
         // mba: it seems that this class intentionally does not call code in base class SwClient
-		if( GetRegisteredIn() ==
-				static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
+		if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) )
 			GetRegisteredInNonConst()->Remove( this );
 		break;
 
 	case RES_FMT_CHG:
-		if( static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
+		if( pOld && 
+			static_cast< const SwFmtChg * >(pNew)->pChangedFmt == GetRegisteredIn() &&
 			static_cast< const SwFmtChg * >(pOld)->pChangedFmt->IsFmtInDTOR() )
 			GetRegisteredInNonConst()->Remove( this );
 		break;
@@ -273,3 +303,124 @@
 
 	SwAccessibleContext::Dispose( bRecursive );
 }
+//IAccessibility2 Implementation 2009-----
+//Get the selection cursor of the document.
+SwPaM* SwAccessibleFrameBase::GetCrsr()
+{
+    // get the cursor shell; if we don't have any, we don't have a
+    // cursor/selection either
+    SwPaM* pCrsr = NULL;
+    SwCrsrShell* pCrsrShell = GetCrsrShell();
+    if( pCrsrShell != NULL && !pCrsrShell->IsTableMode() )
+    {
+		SwFEShell *pFESh = pCrsrShell->ISA( SwFEShell )
+							? static_cast< SwFEShell * >( pCrsrShell ) : 0;
+		if( !pFESh ||
+			!(pFESh->IsFrmSelected() || pFESh->IsObjSelected() > 0) )
+		{
+			// get the selection, and test whether it affects our text node
+			pCrsr = pCrsrShell->GetCrsr( sal_False /* ??? */ );
+		}
+    }
+
+    return pCrsr;
+}
+//Return the selected state of the object.
+//when the object's anchor are in the selection cursor, we should return true.
+sal_Bool SwAccessibleFrameBase::GetSelectedState( )
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	//IAccessibility2 Implementation 2009-----
+	if(GetMap()->IsDocumentSelAll())
+	{
+		return sal_True;
+	}
+	//-----IAccessibility2 Implementation 2009
+
+	// SELETED.
+	SwFlyFrm* pFlyFrm = getFlyFrm();
+	const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+	const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+	const SwPosition *pPos = pAnchor.GetCntntAnchor();
+	if( !pPos )
+		return sal_False;
+	int pIndex = pPos->nContent.GetIndex();
+	if( pPos->nNode.GetNode().GetTxtNode() )
+	{
+		SwPaM* pCrsr = GetCrsr();
+		if( pCrsr != NULL )
+		{
+			const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
+			sal_uLong nHere = pNode->GetIndex();
+
+			// iterate over ring
+			SwPaM* pRingStart = pCrsr;
+			do
+			{
+				// ignore, if no mark
+				if( pCrsr->HasMark() )
+				{
+					// check whether nHere is 'inside' pCrsr
+					SwPosition* pStart = pCrsr->Start();
+					sal_uLong nStartIndex = pStart->nNode.GetIndex();
+					SwPosition* pEnd = pCrsr->End();
+					sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+					if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex)  )
+					{
+						if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+						{
+                            //IAccessibility2 Implementation 2009-----
+							if( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) )
+								if( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) )
+								return sal_True;
+							//-----IAccessibility2 Implementation 2009
+						}
+						else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
+						{
+							if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
+								&& (nHere < nEndIndex ) )
+								return sal_True;
+						}
+						break;
+					}
+					// else: this PaM doesn't point to this paragraph
+				}
+				// else: this PaM is collapsed and doesn't select anything
+
+				// next PaM in ring
+				pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+			}
+			while( pCrsr != pRingStart );
+		}
+	}
+	return sal_False;
+}
+
+SwFlyFrm* SwAccessibleFrameBase::getFlyFrm() const
+{
+	SwFlyFrm* pFlyFrm = NULL;
+
+	const SwFrm* pFrm = GetFrm();
+	DBG_ASSERT( pFrm != NULL, "frame expected" );
+	if( pFrm->IsFlyFrm() )
+	{
+		pFlyFrm = static_cast<SwFlyFrm*>( const_cast<SwFrm*>( pFrm ) );
+	}
+
+	return pFlyFrm;
+}
+
+sal_Bool SwAccessibleFrameBase::SetSelectedState( sal_Bool )
+{
+	sal_Bool bParaSeleted = GetSelectedState() || IsSelected();
+
+	if(bIsSeletedInDoc != bParaSeleted)
+	{
+		bIsSeletedInDoc = bParaSeleted;
+		FireStateChangedEvent( AccessibleStateType::SELECTED, bParaSeleted );
+		return sal_True;
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accframebase.hxx b/main/sw/source/core/access/accframebase.hxx
index 6588d37..0dd7cb3 100644
--- a/main/sw/source/core/access/accframebase.hxx
+++ b/main/sw/source/core/access/accframebase.hxx
@@ -23,6 +23,12 @@
 #ifndef _ACCFRAMEBASE_HXX
 #define _ACCFRAMEBASE_HXX
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _PAM_HXX
+#include <pam.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
+
 #include <acccontext.hxx>
 
 #include <calbck.hxx>
@@ -42,6 +48,11 @@
 	// This drived class additionaly sets SELECTABLE(1), SELECTED(+),
 	// FOCUSABLE(1) and FOCUSED(+)
 	virtual void GetStates( ::utl::AccessibleStateSetHelper& rStateSet );
+	//IAccessibility2 Implementation 2009-----
+	SwFlyFrm* getFlyFrm() const;
+	sal_Bool GetSelectedState( );
+	SwPaM* GetCrsr();
+	//-----IAccessibility2 Implementation 2009
 
 	virtual void _InvalidateCursorPos();
 	virtual void _InvalidateFocus();
@@ -61,6 +72,8 @@
 
 	// The object is not visible an longer and should be destroyed
 	virtual void Dispose( sal_Bool bRecursive = sal_False );
+	virtual sal_Bool SetSelectedState( sal_Bool bSeleted );
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/accfrmobj.cxx b/main/sw/source/core/access/accfrmobj.cxx
index ff57e70..37feccb 100644
--- a/main/sw/source/core/access/accfrmobj.cxx
+++ b/main/sw/source/core/access/accfrmobj.cxx
@@ -40,6 +40,10 @@
 #include <fmtanchr.hxx>
 #include <dcontact.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <pam.hxx>
+//-----IAccessibility2 Implementation 2009
+
 #include <vcl/window.hxx>
 
 namespace css = ::com::sun::star;
@@ -174,6 +178,25 @@
     return bRet;
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_uInt32 SwAccessibleChild::GetAnchorPosition() const
+{
+	if( mpDrawObj )
+	{
+            const SwFrmFmt *pFrmFmt = ::FindFrmFmt( mpDrawObj );
+            if ( pFrmFmt )
+            {
+		const SwPosition *pPos = pFrmFmt->GetAnchor().GetCntntAnchor();
+                if ( pPos )
+                {
+		    return pPos->nContent.GetIndex();
+                }
+            }
+	}
+	return 0;
+}
+//-----IAccessibility2 Implementation 2009
+
 SwAccessibleChild::SwAccessibleChild( const SwAccessibleChild& r )
     : mpFrm( r.mpFrm )
     , mpDrawObj( r.mpDrawObj )
diff --git a/main/sw/source/core/access/accfrmobj.hxx b/main/sw/source/core/access/accfrmobj.hxx
index 1389d91..d8aa363 100644
--- a/main/sw/source/core/access/accfrmobj.hxx
+++ b/main/sw/source/core/access/accfrmobj.hxx
@@ -63,6 +63,10 @@
 
         bool IsAccessible( sal_Bool bPagePreview ) const;
         bool IsBoundAsChar() const;
+        
+		//IAccessibility2 Implementation 2009-----
+		sal_uInt32 GetAnchorPosition() const; 
+		//-----IAccessibility2 Implementation 2009
 
         bool IsVisibleChildrenOnly() const;
         SwRect GetBox( const SwAccessibleMap& rAccMap ) const;
diff --git a/main/sw/source/core/access/accfrmobjmap.cxx b/main/sw/source/core/access/accfrmobjmap.cxx
index 250f592..daa8906 100644
--- a/main/sw/source/core/access/accfrmobjmap.cxx
+++ b/main/sw/source/core/access/accfrmobjmap.cxx
@@ -162,3 +162,97 @@
            ( rFrm.IsTxtFrm() &&
              rFrm.GetDrawObjs() );
 }
+
+/* MT: The two insert methods had been introduced in the IA2 CWS (OOO310m11), but meanwhile we also have some in DEV300m80 (above)
+       Not sure if they have something which needs to be update in above methods.
+       Also, since there is no SwFrmOrObjMap CTOR anymore, the updated code in DEV300 might need some of the changes flagged with //IAccessibility2 Implementation 2009-----
+
+//IAccessibility2 Implementation 2009-----
+::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert( 
+		sal_uInt32 nOrd,  Point nPos, const SwFrmOrObj& rLower )
+{
+	SwFrmOrObjMapKey aKey( SwFrmOrObjMapKey::TEXT, nOrd, nPos );
+	value_type aEntry( aKey, rLower );
+	return _SwFrmOrObjMap::insert( aEntry );
+}
+
+::std::pair< SwFrmOrObjMap::iterator, bool > SwFrmOrObjMap::insert( 
+		const SdrObject *pObj, const SwFrmOrObj& rLower, const SwDoc *pDoc , Point nPos)
+{
+	if( !bLayerIdsValid )
+	{
+		nHellId = pDoc->GetHellId();
+		nControlsId = pDoc->GetControlsId();
+		bLayerIdsValid = sal_True;
+	}
+
+	SdrLayerID nLayer = pObj->GetLayer();
+	SwFrmOrObjMapKey::LayerId eLayerId = (nHellId == nLayer)
+					? SwFrmOrObjMapKey::HELL	
+					: ((nControlsId == nLayer) ? SwFrmOrObjMapKey::CONTROLS
+											   : SwFrmOrObjMapKey::HEAVEN);
+	SwFrmOrObjMapKey aKey( eLayerId, pObj->GetOrdNum(), nPos );
+	value_type aEntry( aKey, rLower );
+	return _SwFrmOrObjMap::insert( aEntry );
+}
+//-----IAccessibility2 Implementation 2009
+
+SwFrmOrObjMap::SwFrmOrObjMap(
+		const SwRect& rVisArea, const SwFrm *pFrm ) :
+	bLayerIdsValid( sal_False )
+{
+	SwFrmOrObj aFrm( pFrm );
+	sal_Bool bVisibleOnly = aFrm.IsVisibleChildrenOnly();
+
+	sal_uInt32 nPos = 0;
+	SwFrmOrObj aLower( pFrm->GetLower() );
+	while( aLower.GetSwFrm() )
+	{
+		//IAccessibility2 Implementation 2009-----
+		if( !bVisibleOnly || aLower.GetBox().IsOver( rVisArea ) )
+			insert( nPos++, aLower.GetBounds().Pos(), aLower );
+		//-----IAccessibility2 Implementation 2009
+		aLower = aLower.GetSwFrm()->GetNext();
+	}
+
+	if( pFrm->IsPageFrm() )
+	{
+		ASSERT( bVisibleOnly, "page frame within tab frame???" );
+		const SwPageFrm *pPgFrm =
+			static_cast< const SwPageFrm * >( pFrm );
+        const SwSortedObjs *pObjs = pPgFrm->GetSortedObjs();
+		if( pObjs )
+		{
+			const SwDoc *pDoc = pPgFrm->GetFmt()->GetDoc();
+			for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+			{
+                aLower = (*pObjs)[i]->GetDrawObj();
+				//IAccessibility2 Implementation 2009-----
+				if( aLower.GetBox().IsOver( rVisArea ) )
+					insert( aLower.GetSdrObject(), aLower, pDoc , aLower.GetBounds().Pos() ); 
+				//-----IAccessibility2 Implementation 2009
+			}
+		}
+	}
+	else if( pFrm->IsTxtFrm() )
+	{
+		const SwDoc *pDoc = static_cast< const SwTxtFrm * >( pFrm )->GetNode()
+																   ->GetDoc();
+        const SwSortedObjs *pObjs = pFrm->GetDrawObjs();
+		if( pObjs )
+		{
+			for( sal_uInt16 i=0; i<pObjs->Count(); i++ )
+			{
+                aLower = (*pObjs)[i]->GetDrawObj();
+				//IAccessibility2 Implementation 2009-----
+				if( aLower.IsBoundAsChar() &&
+					(!bVisibleOnly || aLower.GetBox().IsOver( rVisArea )) )
+					insert( aLower.GetSdrObject(), aLower, pDoc , Point(aLower.GetAnchorPosition(),0) );
+				//-----IAccessibility2 Implementation 2009
+			}
+		}
+	}
+}
+
+*/ 
+
diff --git a/main/sw/source/core/access/accfrmobjmap.hxx b/main/sw/source/core/access/accfrmobjmap.hxx
index 639976b..ef47295 100644
--- a/main/sw/source/core/access/accfrmobjmap.hxx
+++ b/main/sw/source/core/access/accfrmobjmap.hxx
@@ -26,6 +26,7 @@
 #include <accfrmobj.hxx>
 
 #include <svx/svdtypes.hxx>
+#include <tools/gen.hxx>
 
 #include <map>
 
@@ -43,25 +44,58 @@
     inline SwAccessibleChildMapKey()
         : eLayerId( INVALID )
         , nOrdNum( 0 )
+        , nPosNum( 0, 0 )
     {}
 
     inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd )
         : eLayerId( eId )
         , nOrdNum( nOrd )
+        , nPosNum( 0, 0 )
     {}
 
+//IAccessibility2 Implementation 2009-----
+    inline SwAccessibleChildMapKey( LayerId eId, sal_uInt32 nOrd, Point nPos )
+        : eLayerId( eId )
+        , nOrdNum( nOrd )
+        , nPosNum( nPos )
+    {}
+//-----IAccessibility2 Implementation 2009    
+
     inline bool operator()( const SwAccessibleChildMapKey& r1,
                             const SwAccessibleChildMapKey& r2 ) const
     {
-        return (r1.eLayerId == r2.eLayerId)
-               ? (r1.nOrdNum < r2.nOrdNum)
-               : (r1.eLayerId < r2.eLayerId);
+//IAccessibility2 Implementation 2009-----
+//        return (r1.eLayerId == r2.eLayerId)
+//               ? (r1.nOrdNum < r2.nOrdNum)
+//               : (r1.eLayerId < r2.eLayerId);
+	return (r1.eLayerId == r2.eLayerId) ? 
+		   ( (r1.nPosNum == r2.nPosNum) ?(r1.nOrdNum < r2.nOrdNum) : 
+		   (r1.nPosNum.getY() == r2.nPosNum.getY()? r1.nPosNum.getX() < r2.nPosNum.getX() : 
+		   	r1.nPosNum.getY() < r2.nPosNum.getY()) ) :
+		   (r1.eLayerId < r2.eLayerId);
+//-----IAccessibility2 Implementation 2009    
     }
+    
+    /* MT: Need to get this position parameter stuff in dev300 somehow...
+	//IAccessibility2 Implementation 2009-----
+	//This methods are used to insert an object to the map, adding a position parameter.
+	::std::pair< iterator, bool > insert( sal_uInt32 nOrd, Point nPos, 
+										  const SwFrmOrObj& rLower );	
+	::std::pair< iterator, bool > insert( const SdrObject *pObj,
+								   	 	  const SwFrmOrObj& rLower,
+									   	  const SwDoc *pDoc,
+									   	  Point nPos);	
+	//-----IAccessibility2 Implementation 2009    
+	*/
 
 private:
 
     LayerId eLayerId;
     sal_uInt32 nOrdNum;
+    
+	//IAccessibility2 Implementation 2009-----
+	Point nPosNum; 
+	//-----IAccessibility2 Implementation 2009
 
 };
 
diff --git a/main/sw/source/core/access/accgraphic.cxx b/main/sw/source/core/access/accgraphic.cxx
index ce32030..2743239 100644
--- a/main/sw/source/core/access/accgraphic.cxx
+++ b/main/sw/source/core/access/accgraphic.cxx
@@ -33,6 +33,11 @@
 #include "accgraphic.hxx"
 
 using namespace ::com::sun::star;
+//IAccessibility2 Implementation 2009-----
+#ifndef _FMTURL_HXX //autogen
+#include <fmturl.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star::lang;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::accessibility;
@@ -91,3 +96,15 @@
     }
     return aId;
 }
+//IAccessibility2 Implementation 2009-----
+//	Return this object's role.
+sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void)
+        throw (::com::sun::star::uno::RuntimeException)
+{
+		SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+		if(aURL.GetMap() )
+			return AccessibleRole::IMAGE_MAP ;
+		return AccessibleRole::GRAPHIC ;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accgraphic.hxx b/main/sw/source/core/access/accgraphic.hxx
index 1c62a6b..a59279e 100644
--- a/main/sw/source/core/access/accgraphic.hxx
+++ b/main/sw/source/core/access/accgraphic.hxx
@@ -59,6 +59,10 @@
 
 	//=====  XTypeProvider  ====================================================
     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
+	//IAccessibility2 Implementation 2009-----
+	///	Return this object's role.
+	virtual sal_Int16 SAL_CALL getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/accheaderfooter.cxx b/main/sw/source/core/access/accheaderfooter.cxx
index 72c2eb0..907ee91 100644
--- a/main/sw/source/core/access/accheaderfooter.cxx
+++ b/main/sw/source/core/access/accheaderfooter.cxx
@@ -139,3 +139,20 @@
     }
     return aId;
 }
+
+//IAccessibility2 Implementation 2009-----
+sal_Int32 SAL_CALL SwAccessibleHeaderFooter::getBackground() 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	Reference< XAccessible > xParent =  getAccessibleParent();
+	if (xParent.is())
+	{
+		Reference< XAccessibleComponent > xAccContext (xParent,UNO_QUERY);
+		if(xAccContext.is())
+		{
+			return xAccContext->getBackground();
+		}
+	}
+	return SwAccessibleContext::getBackground();
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accheaderfooter.hxx b/main/sw/source/core/access/accheaderfooter.hxx
index 3157a6d..1dc3ca6 100644
--- a/main/sw/source/core/access/accheaderfooter.hxx
+++ b/main/sw/source/core/access/accheaderfooter.hxx
@@ -74,6 +74,11 @@
 
 	//=====  XTypeProvider  ====================================================
     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
+	//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleComponent  ============================================
+	sal_Int32 SAL_CALL getBackground() 
+		throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/acchyperlink.cxx b/main/sw/source/core/access/acchyperlink.cxx
index 2820cfd..fccc83f 100644
--- a/main/sw/source/core/access/acchyperlink.cxx
+++ b/main/sw/source/core/access/acchyperlink.cxx
@@ -32,9 +32,23 @@
 #include <accpara.hxx>
 #include <acchyperlink.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <comphelper/processfactory.hxx>
+#ifndef _COM_SUN_STAR_FRAME_XDESKTOP_HPP_
+#include <com/sun/star/frame/XDesktop.hpp>
+#endif
+#ifndef _COM_SUN_STAR_FRAME_XCOMPONENTLOADER_HPP_
+#include <com/sun/star/frame/XComponentLoader.hpp>
+#endif
+#ifndef _COM_SUN_STAR_DOCUMENT_XLINKTARGETSUPPLIER_HPP_
+#include <com/sun/star/document/XLinkTargetSupplier.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
+using ::com::sun::star::lang::IndexOutOfBoundsException;
 
 SwAccessibleHyperlink::SwAccessibleHyperlink( sal_uInt16 nHPos,
 	SwAccessibleParagraph *p, sal_Int32 nStt, sal_Int32 nEnd ) :
@@ -78,8 +92,12 @@
 
 	sal_Bool bRet = sal_False;
 
+	//IAccessibility2 Implementation 2009-----
+	if(nIndex != 0)
+		throw new IndexOutOfBoundsException;
 	const SwTxtAttr *pTxtAttr = GetTxtAttr();
-	if( pTxtAttr && 0 == nIndex )
+	if( pTxtAttr /*&& 0 == nIndex*/ ) 
+	//-----IAccessibility2 Implementation 2009
 	{
 		const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
 		if( rINetFmt.GetValue().Len() )
@@ -111,23 +129,28 @@
 {
 	OUString sDesc;
 
+	//IAccessibility2 Implementation 2009-----
+	if(nIndex != 0)
+		throw new IndexOutOfBoundsException;
 	const SwTxtAttr *pTxtAttr = GetTxtAttr();
-	if( pTxtAttr && 0 == nIndex )
+	if( pTxtAttr /*&& 0 == nIndex*/ ) 
 	{
 		const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
 		sDesc = OUString( rINetFmt.GetValue() );
 	}
-
+	//-----IAccessibility2 Implementation 2009
 	return sDesc;
 }
 
 uno::Reference< XAccessibleKeyBinding > SAL_CALL
-	SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) 
+	SwAccessibleHyperlink::getAccessibleActionKeyBinding( sal_Int32 ) 
 	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
 	uno::Reference< XAccessibleKeyBinding > xKeyBinding;
 
-	if( isValid() && 0==nIndex )
+	//IAccessibility2 Implementation 2009-----
+	if( isValid() /*&& 0 == nIndex*/ ) 
+	//-----IAccessibility2 Implementation 2009
 	{
 		::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
 		   	new ::comphelper::OAccessibleKeyBindingHelper();
@@ -146,17 +169,40 @@
 
 // XAccessibleHyperlink
 uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionAnchor(
-        sal_Int32 /*nIndex*/ ) 
+        sal_Int32 nIndex) 
 		throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
-	return uno::Any();
+	uno::Any aRet;
+	//IAccessibility2 Implementation 2009-----
+	if(nIndex != 0)
+		throw new IndexOutOfBoundsException;
+	//End Added.	
+	::rtl::OUString text = OUString( xPara->GetString() );
+	::rtl::OUString retText =  text.copy(nStartIdx, nEndIdx - nStartIdx);
+	aRet <<= retText;
+	//-----IAccessibility2 Implementation 2009
+	return aRet;
 }
 
 uno::Any SAL_CALL SwAccessibleHyperlink::getAccessibleActionObject( 
-            sal_Int32 /*nIndex*/ ) 
+            sal_Int32 nIndex ) 
 	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
 {
-	return uno::Any();
+	//IAccessibility2 Implementation 2009-----
+	if(nIndex != 0)
+		throw new IndexOutOfBoundsException;
+	//End Added.
+	const SwTxtAttr *pTxtAttr = GetTxtAttr();
+	::rtl::OUString retText;
+	if( pTxtAttr /*&& 0 == nIndex*/ ) 
+	{
+		const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+		retText = OUString( rINetFmt.GetValue() );
+	}
+	uno::Any aRet;
+	aRet <<= retText;
+	return aRet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 sal_Int32 SAL_CALL SwAccessibleHyperlink::getStartIndex() 
@@ -175,7 +221,57 @@
 		throw (uno::RuntimeException)
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
-	return xPara.isValid();
+	//IAccessibility2 Implementation 2009-----
+	//	return xPara.isValid();
+	if (xPara.isValid())
+	{
+		const SwTxtAttr *pTxtAttr = GetTxtAttr();
+		::rtl::OUString sText;
+		if( pTxtAttr ) 
+		{
+			const SwFmtINetFmt& rINetFmt = pTxtAttr->GetINetFmt();
+			sText = OUString( rINetFmt.GetValue() );
+			::rtl::OUString sToken = ::rtl::OUString::createFromAscii("#");
+			sal_Int32 nPos = sText.indexOf(sToken);
+			if (nPos==0)//document link
+			{
+				uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
+				if( ! xFactory.is() )
+					return sal_False;
+				uno::Reference< com::sun::star::frame::XDesktop > xDesktop( xFactory->createInstance( OUString::createFromAscii( "com.sun.star.frame.Desktop" ) ),
+					uno::UNO_QUERY );
+				if( !xDesktop.is() )
+					return sal_False;	
+				uno::Reference< lang::XComponent > xComp;
+				xComp = xDesktop->getCurrentComponent();
+				if( !xComp.is() )
+					return sal_False;	
+				uno::Reference< com::sun::star::document::XLinkTargetSupplier >  xLTS(xComp, uno::UNO_QUERY);
+				if ( !xLTS.is())
+					return sal_False;
+			
+				uno::Reference< ::com::sun::star::container::XNameAccess > xLinks = xLTS->getLinks();
+				uno::Reference< ::com::sun::star::container::XNameAccess > xSubLinks;
+				const uno::Sequence< OUString > aNames( xLinks->getElementNames() );
+				const sal_uLong nLinks = aNames.getLength();
+				const OUString* pNames = aNames.getConstArray();
+				
+				for( sal_uLong i = 0; i < nLinks; i++ )
+				{
+					uno::Any aAny;
+					OUString aLink( *pNames++ );
+					aAny = xLinks->getByName( aLink );
+					aAny >>= xSubLinks;
+					if (xSubLinks->hasByName(sText.copy(1)) )
+						return sal_True;
+				}
+			}
+			else//internet
+				return sal_True;
+		}
+	}//xpara valid
+	return sal_False;
+	//-----IAccessibility2 Implementation 2009
 }
 
 void SwAccessibleHyperlink::Invalidate()
diff --git a/main/sw/source/core/access/accmap.cxx b/main/sw/source/core/access/accmap.cxx
index e5de5f8..53c81ce 100644
--- a/main/sw/source/core/access/accmap.cxx
+++ b/main/sw/source/core/access/accmap.cxx
@@ -34,6 +34,7 @@
 
 #include <map>
 #include <list>
+#include <vector>
 #include <accmap.hxx>
 #include <acccontext.hxx>
 #include <accdoc.hxx>
@@ -60,11 +61,26 @@
 #include <IDocumentDrawModelAccess.hxx>
 #include <svx/ShapeTypeHandler.hxx>
 #include <vcl/svapp.hxx>
+//IAccessibility2 Implementation 2009-----
+#ifndef _SVX_ACCESSIBILITY_SHAPE_TYPE_HANDLER_HXX
+#include <svx/ShapeTypeHandler.hxx>
+#endif
+#ifndef _SVX_ACCESSIBILITY_SVX_SHAPE_TYPES_HXX
+#include <svx/SvxShapeTypes.hxx>
+#endif
+#ifndef _SVDPAGE_HXX
+#include <svx/svdpage.hxx>
+#endif
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
 #include <cppuhelper/implbase1.hxx>
 #include <pagepreviewlayout.hxx>
+#include <dcontact.hxx>
+#include <svx/unoapi.hxx>
+#include <svx/svdmark.hxx>
+#include <doc.hxx>
 #include <pam.hxx>
 #include <ndtxt.hxx>
 #include <dflyobj.hxx>
@@ -278,7 +294,9 @@
 		{
 			const SdrObject *pObj = (*aIter).first;
 			uno::Reference < XAccessible > xAcc( (*aIter).second );
-			if( nSelShapes && pFESh->IsObjSelected( *pObj ) )
+			//IAccessibility2 Implementation 2009-----
+			if( nSelShapes && pFESh &&pFESh->IsObjSelected( *pObj ) )
+			//-----IAccessibility2 Implementation 2009
 			{
 				// selected objects are inserted from the back
 				--pSelShape;
@@ -334,20 +352,31 @@
 	SwAccessibleEvent_Impl& operator==( const SwAccessibleEvent_Impl& );
 
 public:
+	//IAccessibility2 Implementation 2009-----
+	const SwFrm* mpParentFrm;	// The object that fires the event
+	sal_Bool IsNoXaccParentFrm() const 
+	{
+		return CHILD_POS_CHANGED == meType && mpParentFrm != 0;
+	}
+	uno::WeakReference < XAccessible > GetxAcc() const { return mxAcc;}
+	//-----IAccessibility2 Implementation 2009
+public:
     SwAccessibleEvent_Impl( EventType eT,
                             SwAccessibleContext *pA,
                             const SwAccessibleChild& rFrmOrObj )
         : mxAcc( pA ),
           maFrmOrObj( rFrmOrObj ),
           meType( eT ),
-          mnStates( 0 )
+          mnStates( 0 ),
+          mpParentFrm( 0 )
 	{}
 
     SwAccessibleEvent_Impl( EventType eT,
                             const SwAccessibleChild& rFrmOrObj )
         : maFrmOrObj( rFrmOrObj ),
           meType( eT ),
-          mnStates( 0 )
+          mnStates( 0 ),
+          mpParentFrm( 0 )
 	{
 		ASSERT( SwAccessibleEvent_Impl::DISPOSE == meType,
 				"wrong event constructor, DISPOSE only" );
@@ -355,7 +384,8 @@
 
     SwAccessibleEvent_Impl( EventType eT )
         : meType( eT ),
-          mnStates( 0 )
+          mnStates( 0 ),
+          mpParentFrm( 0 )
 	{
         ASSERT( SwAccessibleEvent_Impl::SHAPE_SELECTION == meType,
 				"wrong event constructor, SHAPE_SELECTION only" );
@@ -369,7 +399,8 @@
           mxAcc( pA ),
           maFrmOrObj( rFrmOrObj ),
           meType( eT ),
-          mnStates( 0 )
+          mnStates( 0 ),
+          mpParentFrm( 0 )
 	{
 		ASSERT( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType ||
 				SwAccessibleEvent_Impl::POS_CHANGED == meType,
@@ -384,12 +415,28 @@
         : mxAcc( pA ),
           maFrmOrObj( rFrmOrObj ),
           meType( eT ),
-          mnStates( _nStates )
+          mnStates( _nStates ),
+          mpParentFrm( 0 )
 	{
 		ASSERT( SwAccessibleEvent_Impl::CARET_OR_STATES == meType,
 				"wrong event constructor, CARET_OR_STATES only" );
 	}
 
+	//IAccessibility2 Implementation 2009-----
+	SwAccessibleEvent_Impl( EventType eT, 
+                                const SwFrm *pParentFrm,
+				const SwAccessibleChild& rFrmOrObj, 
+                                const SwRect& rR ) :
+		maOldBox( rR ),
+                maFrmOrObj( rFrmOrObj ),
+                meType( eT ),
+		mnStates( 0 ),
+                mpParentFrm( pParentFrm )
+	{
+		OSL_ENSURE( SwAccessibleEvent_Impl::CHILD_POS_CHANGED == meType,
+			"wrong event constructor, CHILD_POS_CHANGED only" );
+	}
+	//-----IAccessibility2 Implementation 2009
     // <SetType(..)> only used in method <SwAccessibleMap::AppendEvent(..)>
     inline void SetType( EventType eT )
     {
@@ -493,8 +540,47 @@
     {
         return mbFiring;
     }
+	//IAccessibility2 Implementation 2009-----
+	struct XAccisNULL
+	{
+		bool operator()(const SwAccessibleEvent_Impl& e)
+		{
+			return e.IsNoXaccParentFrm();
+		}
+	};
+	void MoveInvalidXAccToEnd();
+	//-----IAccessibility2 Implementation 2009
 };
 
+//IAccessibility2 Implementation 2009-----
+void SwAccessibleEventList_Impl::MoveInvalidXAccToEnd()
+{
+	int nSize = size();
+	if (nSize < 2 )
+	{
+		return;
+	}
+	SwAccessibleEventList_Impl lstEvent;
+	iterator li = begin();
+	for ( ;li != end();)
+	{
+		SwAccessibleEvent_Impl e = *li;
+		if (e.IsNoXaccParentFrm())
+		{
+			iterator liNext = li;
+			++liNext;
+			erase(li);
+			li = liNext;
+			lstEvent.insert(lstEvent.end(),e);
+		}
+		else
+			++li;
+	}
+	OSL_ENSURE(size() + lstEvent.size() == nSize ,"");
+	insert(end(),lstEvent.begin(),lstEvent.end());
+	OSL_ENSURE(size() == nSize ,"");
+}
+//-----IAccessibility2 Implementation 2009
 //------------------------------------------------------------------------------
 // The shape list is filled if an accessible shape is destroyed. It
 // simply keeps a reference to the accessible shape's XShape. These
@@ -825,6 +911,25 @@
 void SwAccessibleMap::FireEvent( const SwAccessibleEvent_Impl& rEvent )
 {
 	::vos::ORef < SwAccessibleContext > xAccImpl( rEvent.GetContext() );
+	//IAccessibility2 Implementation 2009-----
+	if (!xAccImpl.isValid() && rEvent.mpParentFrm != 0 )
+	{
+		SwAccessibleContextMap_Impl::iterator aIter =
+			mpFrmMap->find( rEvent.mpParentFrm );
+		if( aIter != mpFrmMap->end() )
+		{
+			uno::Reference < XAccessible > xAcc( (*aIter).second );
+			if (xAcc.is())
+			{
+				uno::Reference < XAccessibleContext >  xContext(xAcc,uno::UNO_QUERY);
+				if (xContext.is() && xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+				{
+					xAccImpl = static_cast< SwAccessibleContext *>( xAcc.get() );
+				}
+			}			
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	if( SwAccessibleEvent_Impl::SHAPE_SELECTION == rEvent.GetType() )
 	{
 		DoInvalidateShapeSelection();
@@ -1042,8 +1147,324 @@
 		DoInvalidateShapeSelection();
 	}
 }
+//IAccessibility2 Implementation 2009-----
+//This method should implement the following functions:
+//1.find the shape objects and set the selected state.
+//2.find the Swframe objects and set the selected state.
+//3.find the paragraph objects and set the selected state.
+void SwAccessibleMap::InvalidateShapeInParaSelection()
+{
+	SwAccessibleObjShape_Impl *pShapes = 0;
+	SwAccessibleObjShape_Impl *pSelShape = 0;
+	size_t nShapes = 0;
 
-void SwAccessibleMap::DoInvalidateShapeSelection()
+	const ViewShell *pVSh = GetShell();
+	const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ?
+							static_cast< const SwFEShell * >( pVSh ) : 0;
+	SwPaM* pCrsr = pFESh ? pFESh->GetCrsr( sal_False /* ??? */ ) : NULL;//IAccessibility2 Implementation 2009
+
+	//sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+
+	{
+		vos::OGuard aGuard( maMutex );
+		if( mpShapeMap )
+			pShapes = mpShapeMap->Copy( nShapes, pFESh, &pSelShape );
+	}
+	
+	sal_Bool bIsSelAll =IsDocumentSelAll();
+	
+	if( mpShapeMap )
+	{
+		//Checked for shapes.
+		_SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+		_SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+		::vos::ORef< SwAccessibleContext > xParentAccImpl;
+
+		if( bIsSelAll)
+		{
+			while( aIter != aEndIter )
+			{
+				uno::Reference < XAccessible > xAcc( (*aIter).second );
+				if( xAcc.is() )
+					(static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+				
+				++aIter;
+			}	
+		}
+		else
+		{
+			while( aIter != aEndIter )
+			{
+				sal_Bool bChanged = sal_False;
+				sal_Bool bMarked = sal_False;
+				SwAccessibleChild pFrm( (*aIter).first );
+				
+				const SwFrmFmt *pFrmFmt = (*aIter).first ? ::FindFrmFmt( (*aIter).first ) : 0;
+				if( !pFrmFmt ) { ++aIter; continue; }
+				const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+				const SwPosition *pPos = pAnchor.GetCntntAnchor();
+				
+				if(pAnchor.GetAnchorId() == FLY_AT_PAGE)
+				{
+					uno::Reference < XAccessible > xAcc( (*aIter).second );
+					if(xAcc.is())
+						(static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+					
+					++aIter; continue;
+				}
+				
+				if( !pPos ) { ++aIter; continue; } 
+				if( pPos->nNode.GetNode().GetTxtNode() )
+				{
+					int pIndex = pPos->nContent.GetIndex();
+					SwPaM* pTmpCrsr = pCrsr;
+					if( pTmpCrsr != NULL )
+					{
+						const SwTxtNode* pNode = pPos->nNode.GetNode().GetTxtNode();
+						sal_uLong nHere = pNode->GetIndex();
+						
+						do
+						{
+							// ignore, if no mark
+							if( pTmpCrsr->HasMark() )
+							{
+								bMarked = sal_True;
+								// check whether nHere is 'inside' pCrsr
+								SwPosition* pStart = pTmpCrsr->Start();
+								sal_uLong nStartIndex = pStart->nNode.GetIndex();
+								SwPosition* pEnd = pTmpCrsr->End();
+								sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+								if( ( nHere >= nStartIndex ) && (nHere <= nEndIndex)  )
+								{
+									if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+									{
+										if( ( (nHere == nStartIndex) && (pIndex >= pStart->nContent.GetIndex()) || (nHere > nStartIndex) )
+											&&( (nHere == nEndIndex) && (pIndex < pEnd->nContent.GetIndex()) || (nHere < nEndIndex) ) )
+										{
+											uno::Reference < XAccessible > xAcc( (*aIter).second );
+											if( xAcc.is() )
+												bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+										}
+										else
+										{
+											uno::Reference < XAccessible > xAcc( (*aIter).second );
+											if( xAcc.is() )
+												bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+										}
+									}
+									else if( pAnchor.GetAnchorId() == FLY_AT_PARA )
+									{
+										if( ((nHere > nStartIndex) || pStart->nContent.GetIndex() ==0 )
+											&& (nHere < nEndIndex ) )
+										{
+											uno::Reference < XAccessible > xAcc( (*aIter).second );
+											if( xAcc.is() )
+												bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->SetState( AccessibleStateType::SELECTED );
+										}
+										else
+										{
+											uno::Reference < XAccessible > xAcc( (*aIter).second );
+											if(xAcc.is()) 
+												bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+										}
+									}
+								}
+							}
+							// next PaM in ring
+							pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+						}
+						while( pTmpCrsr != pCrsr );
+					}
+					if( !bMarked )
+					{
+						SwAccessibleObjShape_Impl  *pShape = pShapes;
+						size_t nNumShapes = nShapes;
+						while( nNumShapes )
+						{
+							if( pShape < pSelShape && (pShape->first==(*aIter).first) )
+							{
+								uno::Reference < XAccessible > xAcc( (*aIter).second );
+								if(xAcc.is())
+									bChanged = (static_cast < ::accessibility::AccessibleShape* >(xAcc.get()))->ResetState( AccessibleStateType::SELECTED );
+							}
+							--nNumShapes;
+							++pShape;
+						}
+					}
+				}
+				++aIter;
+			}//while( aIter != aEndIter )
+		}//else
+	}
+	
+	//Checked for FlyFrm
+	SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+	while( aIter != mpFrmMap->end() )
+	{
+		const SwFrm *pFrm = (*aIter).first;
+		if(pFrm->IsFlyFrm())
+		{
+			sal_Bool bFrmChanged = sal_False;
+			uno::Reference < XAccessible > xAcc = (*aIter).second;
+			
+			if(xAcc.is())
+			{
+				SwAccessibleFrameBase *pAccFrame = (static_cast< SwAccessibleFrameBase * >(xAcc.get()));
+				bFrmChanged = pAccFrame->SetSelectedState( sal_True );
+				if (bFrmChanged)
+				{
+					const SwFlyFrm *pFlyFrm = static_cast< const SwFlyFrm * >( pFrm );
+					const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+					if (pFrmFmt)
+					{
+						const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+						if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+						{
+							uno::Reference< XAccessible > xAccParent = pAccFrame->getAccessibleParent();
+							if (xAccParent.is())
+							{
+								uno::Reference< XAccessibleContext > xAccContext = xAccParent->getAccessibleContext();
+								if(xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+								{
+									SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xAccContext.get());
+									if(pAccFrame->IsSeletedInDoc())
+									{
+										m_setParaAdd.insert(pAccPara);
+									}
+									else if(m_setParaAdd.count(pAccPara) == 0)
+									{
+										m_setParaRemove.insert(pAccPara);
+									}
+								}
+							}
+						}
+					}
+                }
+			}
+		}
+		++aIter;
+	}
+	typedef std::vector< SwAccessibleContext* > VEC_PARA;
+	VEC_PARA vecAdd;
+	VEC_PARA vecRemove;
+	//Checked for Paras.
+	SwPaM* pTmpCrsr = pCrsr;
+	sal_Bool bMarkChanged = sal_False;
+	SwAccessibleContextMap_Impl mapTemp;
+	if( pTmpCrsr != NULL )
+	{
+		do
+		{
+			if( pTmpCrsr->HasMark() )
+			{
+				SwNodeIndex nStartIndex( pTmpCrsr->Start()->nNode );
+				SwNodeIndex nEndIndex( pTmpCrsr->End()->nNode );
+				while(nStartIndex <= nEndIndex)
+				{
+					SwFrm *pFrm = NULL;
+					if(nStartIndex.GetNode().IsCntntNode())
+					{	
+						SwCntntNode* pCNd = (SwCntntNode*)&(nStartIndex.GetNode());
+						SwClientIter aClientIter( *pCNd );
+						pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm));
+					}
+					else if( nStartIndex.GetNode().IsTableNode() )
+					{
+						SwTableNode * pTable= (SwTableNode *)&(nStartIndex.GetNode());
+						SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(pTable->GetTable().GetFrmFmt());
+						SwClientIter aClientIter( *pFmt );
+						pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm));
+					}
+					
+                    if( pFrm && mpFrmMap)
+					{
+						aIter = mpFrmMap->find( pFrm );
+						if( aIter != mpFrmMap->end() )
+						{
+							uno::Reference < XAccessible > xAcc = (*aIter).second;
+							sal_Bool isChanged = sal_False;
+							if( xAcc.is() )
+							{
+								isChanged = (static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_True );
+							}
+							if(!isChanged)
+							{
+								SwAccessibleContextMap_Impl::iterator aEraseIter = mpSeletedFrmMap->find( pFrm );
+								if(aEraseIter != mpSeletedFrmMap->end())
+									mpSeletedFrmMap->erase(aEraseIter);
+							}
+							else
+							{
+								bMarkChanged = sal_True;
+								vecAdd.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+							}
+							
+							mapTemp.insert( SwAccessibleContextMap_Impl::value_type( pFrm, xAcc ) );
+						}
+					}
+					nStartIndex++;
+				}
+			}
+			pTmpCrsr = static_cast<SwPaM*>( pTmpCrsr->GetNext() );
+		}
+		while( pTmpCrsr != pCrsr );
+	}
+	if( !mpSeletedFrmMap )
+		mpSeletedFrmMap = new SwAccessibleContextMap_Impl;
+	if( !mpSeletedFrmMap->empty() )
+	{
+		aIter = mpSeletedFrmMap->begin();
+		while( aIter != mpSeletedFrmMap->end() )
+		{
+			uno::Reference < XAccessible > xAcc = (*aIter).second;
+			if(xAcc.is())
+				(static_cast< SwAccessibleContext * >(xAcc.get()))->SetSelectedState( sal_False );
+			++aIter;
+			vecRemove.push_back(static_cast< SwAccessibleContext * >(xAcc.get()));
+		}
+		bMarkChanged = sal_True;
+		mpSeletedFrmMap->clear();
+	}
+	
+	if( !mapTemp.empty() )
+	{
+		aIter = mapTemp.begin();
+		while( aIter != mapTemp.end() )
+		{
+			mpSeletedFrmMap->insert( SwAccessibleContextMap_Impl::value_type( (*aIter).first, (*aIter).second ) );
+			++aIter;
+		}
+		mapTemp.clear();
+	}
+	if( bMarkChanged && mpFrmMap)
+	{
+		VEC_PARA::iterator vi = vecAdd.begin();
+		for (; vi != vecAdd.end() ; ++vi)
+		{
+			AccessibleEventObject aEvent;
+			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+			SwAccessibleContext* pAccPara = *vi;
+			if (pAccPara)
+			{
+				pAccPara->FireAccessibleEvent( aEvent );
+			}			
+		}
+		vi = vecRemove.begin();
+		for (; vi != vecRemove.end() ; ++vi)
+		{
+			AccessibleEventObject aEvent;
+			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+			SwAccessibleContext* pAccPara = *vi;
+			if (pAccPara)
+			{
+				pAccPara->FireAccessibleEvent( aEvent );
+			}			
+		}
+	}
+}
+
+//Marge with DoInvalidateShapeFocus
+void SwAccessibleMap::DoInvalidateShapeSelection(sal_Bool bInvalidateFocusMode /*=sal_False*/)
 {
 	SwAccessibleObjShape_Impl *pShapes = 0;
 	SwAccessibleObjShape_Impl *pSelShape = 0;
@@ -1053,7 +1474,14 @@
 	const SwFEShell *pFESh = pVSh->ISA( SwFEShell ) ?
 							static_cast< const SwFEShell * >( pVSh ) : 0;
 	sal_uInt16 nSelShapes = pFESh ? pFESh->IsObjSelected() : 0;
+	
 
+	//when InvalidateFocus Call this function ,and the current selected shape count is not 1 ,
+	//return 
+	if (bInvalidateFocusMode && nSelShapes != 1)
+	{
+		return;
+	}
 	{
 		vos::OGuard aGuard( maMutex );
 		if( mpShapeMap )
@@ -1062,24 +1490,71 @@
 
 	if( pShapes )
 	{
-		::std::list< const SwFrm * > aParents;
+		typedef std::vector< ::vos::ORef < ::accessibility::AccessibleShape >  >  VEC_SHAPE;
+		VEC_SHAPE vecxShapeAdd;
+		VEC_SHAPE vecxShapeRemove;
+		int nCountSelectedShape=0;
+
 		Window *pWin = GetShell()->GetWin();
 		sal_Bool bFocused = pWin && pWin->HasFocus();
 		SwAccessibleObjShape_Impl *pShape = pShapes;
+		int nShapeCount = nShapes;
+		while( nShapeCount )
+		{
+			//if( pShape->second.isValid() )
+			if (pShape->second.isValid() && IsInSameLevel(pShape->first, pFESh))
+				{
+				if( pShape < pSelShape )
+				{
+					if(pShape->second->ResetState( AccessibleStateType::SELECTED ))
+					{
+						vecxShapeRemove.push_back(pShape->second);
+					}
+					pShape->second->ResetState( AccessibleStateType::FOCUSED );
+				}
+			}
+			--nShapeCount;
+			++pShape;
+		}
+
+		VEC_SHAPE::iterator vi =vecxShapeRemove.begin();
+		for (; vi != vecxShapeRemove.end(); ++vi)
+		{
+			::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+			if (pAccShape)
+			{
+				pAccShape->CommitChange(AccessibleEventId::SELECTION_CHANGED_REMOVE, uno::Any(), uno::Any());
+			}
+		}
+
+		pShape = pShapes;
 		while( nShapes )
 		{
-			if( pShape->second.isValid() )
+			//if( pShape->second.isValid() )
+			if (pShape->second.isValid() && IsInSameLevel(pShape->first, pFESh))
 			{
-				sal_Bool bChanged;
+				// IA2 - why?
+				// sal_Bool bChanged;
 				if( pShape >= pSelShape )
 				{
-					bChanged =
-						pShape->second->SetState( AccessibleStateType::SELECTED );
+					// IA2: first fire focus event
+					// bChanged = pShape->second->SetState( AccessibleStateType::SELECTED );					
+
+					//first fire focus event
 					if( bFocused && 1 == nSelShapes )
 						pShape->second->SetState( AccessibleStateType::FOCUSED );
 					else
 						pShape->second->ResetState( AccessibleStateType::FOCUSED );
+
+					// IA2 CWS:
+					if(pShape->second->SetState( AccessibleStateType::SELECTED ))
+					{
+						vecxShapeAdd.push_back(pShape->second);
+					}
+					++nCountSelectedShape;
 				}
+				/* MT: This still was in DEV300m80, but was removed in IA2 CWS.
+				   Someone needs to check what should happen here, see original diff CWS oo31ia2 vs. OOO310M11
 				else
 				{
 					bChanged =
@@ -1093,47 +1568,97 @@
                                                     GetShell()->IsPreView() );
                     aParents.push_back( pParent );
 				}
+				*/
 			}
 
 			--nShapes;
 			++pShape;
 		}
-		if( aParents.size() > 0 )
-		{
-			::std::list< const SwFrm * >::const_iterator aIter = aParents.begin();
-			::std::list< const SwFrm * >::const_iterator aEndIter = aParents.end();
-			while( aIter != aEndIter )
-			{
-				::vos::ORef< SwAccessibleContext > xParentAccImpl;
-				{
-					vos::OGuard aGuard( maMutex );
-					if(  mpFrmMap )
-					{
-						SwAccessibleContextMap_Impl::const_iterator aMapIter =
-							mpFrmMap->find( *aIter );
-						if( aMapIter != mpFrmMap->end() )
-						{
-							uno::Reference < XAccessible > xAcc( (*aMapIter).second );
-							xParentAccImpl =
-								static_cast< SwAccessibleContext *>( xAcc.get() );
-						}
-					}
-				}
-				if( xParentAccImpl.isValid() )
-				{
-					AccessibleEventObject aEvent;
-					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-					xParentAccImpl->FireAccessibleEvent( aEvent );
-				}
 
-				++aIter;
+		const int SELECTION_WITH_NUM =10;
+		if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
+		{
+			uno::Reference< XAccessible > xDoc = GetDocumentView( );
+			 SwAccessibleContext * pCont = static_cast<SwAccessibleContext *>(xDoc.get());
+			 if (pCont)
+			 {
+				 AccessibleEventObject aEvent;
+				 aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+				 pCont->FireAccessibleEvent(aEvent);
+			 }
+		}
+		else
+		{
+			short nEventID = AccessibleEventId::SELECTION_CHANGED_ADD;
+			if (nCountSelectedShape <= 1 && vecxShapeAdd.size() == 1 )
+			{
+				nEventID = AccessibleEventId::SELECTION_CHANGED;
+			}
+			vi = vecxShapeAdd.begin();
+			for (; vi != vecxShapeAdd.end(); ++vi)
+			{
+				::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+				if (pAccShape)
+				{
+					pAccShape->CommitChange(nEventID, uno::Any(), uno::Any());
+				}				
 			}
 		}
 
+		vi = vecxShapeAdd.begin();
+		for (; vi != vecxShapeAdd.end(); ++vi)
+		{
+			::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+			if (pAccShape)
+			{
+				SdrObject *pObj = GetSdrObjectFromXShape(pAccShape->GetXShape());
+				SwFrmFmt *pFrmFmt = pObj ? FindFrmFmt( pObj ) : NULL;
+				if (pFrmFmt)
+				{
+					const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+					if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+					{
+						uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+						if (xPara.is())
+						{
+							uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+							if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+							{
+								SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+								if (pAccPara)
+								{
+									m_setParaAdd.insert(pAccPara);
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+		vi = vecxShapeRemove.begin();
+		for (; vi != vecxShapeRemove.end(); ++vi)
+		{
+			::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+			if (pAccShape)
+			{
+				uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+				uno::Reference< XAccessibleContext > xParaContext = xPara->getAccessibleContext();
+				if (xParaContext.is() && xParaContext->getAccessibleRole() == AccessibleRole::PARAGRAPH)
+				{
+					SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+					if (m_setParaAdd.count(pAccPara) == 0 )
+					{
+						m_setParaRemove.insert(pAccPara);
+					}
+				}
+			}
+		}		
 		delete[] pShapes;
 	}
 }
 
+//Marge with DoInvalidateShapeSelection
+/*
 void SwAccessibleMap::DoInvalidateShapeFocus()
 {
 	const ViewShell *pVSh = GetShell();
@@ -1177,7 +1702,8 @@
 		delete[] pShapes;
 	}
 }
-
+*/
+//-----IAccessibility2 Implementation 2009
 
 SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) :
 	mpFrmMap( 0  ),
@@ -1193,7 +1719,8 @@
 	mnPara( 1 ),
 	mnFootnote( 1 ),
 	mnEndnote( 1 ),
-	mbShapeSelected( sal_False )
+	mbShapeSelected( sal_False ),
+	mpSeletedFrmMap(NULL)//IAccessibility2 Implementation 2009
 {
 	pSh->GetLayout()->AddAccessibleShell();
 }
@@ -1214,10 +1741,28 @@
 		}
 	}
 
+	//IAccessibility2 Implementation 2009-----
+	if(xAcc.is())
+	{
 	SwAccessibleDocument *pAcc =
 		static_cast< SwAccessibleDocument * >( xAcc.get() );
 	pAcc->Dispose( sal_True );
-
+	}
+	if( mpFrmMap )
+	{
+		SwAccessibleContextMap_Impl::iterator aIter = mpFrmMap->begin();
+		while( aIter != mpFrmMap->end() )
+		{
+			uno::Reference < XAccessible > xTmp = (*aIter).second;
+			if( xTmp.is() )
+			{
+				SwAccessibleContext *pTmp = static_cast< SwAccessibleContext * >( xTmp.get() );
+				pTmp->SetMap(NULL);
+			}
+			++aIter;
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	{
 		vos::OGuard aGuard( maMutex );
 #ifdef DBG_UTIL
@@ -1298,6 +1843,7 @@
 		mpEvents = 0;
 	}
 	mpVSh->GetLayout()->RemoveAccessibleShell();
+	delete mpSeletedFrmMap;//IAccessibility2 Implementation 2009
 }
 
 uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
@@ -1429,7 +1975,7 @@
 						sal_Bool bIsEndnote =
 							SwAccessibleFootnote::IsEndnote( pFtnFrm );
 						pAcc = new SwAccessibleFootnote( this, bIsEndnote,
-									(bIsEndnote ? mnEndnote++ : mnFootnote++),
+									/*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/
 									pFtnFrm );
 					}
 					break;
@@ -1584,6 +2130,10 @@
 					}
 					// TODO: focus!!!
 				}
+				//IAccessibility2 Implementation 2009-----
+				if (xAcc.is())
+					AddGroupContext(pObj, xAcc);
+				//-----IAccessibility2 Implementation 2009
 			}
 		}
 	}
@@ -1594,6 +2144,105 @@
 
 	return xAcc;
 }
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleMap::IsInSameLevel(const SdrObject* pObj, const SwFEShell* pFESh)
+{
+	if (pFESh)
+		return pFESh->IsObjSameLevelWithMarked(pObj);
+	return sal_False;
+}
+void SwAccessibleMap::AddShapeContext(const SdrObject *pObj, uno::Reference < XAccessible > xAccShape)
+{
+	vos::OGuard aGuard( maMutex );
+
+	if( mpShapeMap )
+	{
+		SwAccessibleShapeMap_Impl::value_type aEntry( pObj, xAccShape );
+		mpShapeMap->insert( aEntry );
+	}
+
+}
+
+//Added by yanjun for sym2_6407
+void SwAccessibleMap::RemoveGroupContext(const SdrObject *pParentObj, ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > xAccParent)
+{
+	vos::OGuard aGuard( maMutex );
+	if (mpShapeMap && pParentObj && pParentObj->IsGroupObject() && xAccParent.is())
+	{
+		uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+		if (xContext.is())
+		{
+			for (sal_Int32 i = 0; i < xContext->getAccessibleChildCount(); ++i)
+			{
+				uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+				if (xChild.is())
+				{
+					uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+					if (xChildContext.is())
+					{
+						if (xChildContext->getAccessibleRole() == AccessibleRole::SHAPE)
+						{
+							::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+							uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+							if (xShape.is())
+							{
+								SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+								if (pObj)
+									RemoveContext(pObj);
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+}
+//End
+
+
+void SwAccessibleMap::AddGroupContext(const SdrObject *pParentObj, uno::Reference < XAccessible > xAccParent)
+{
+	vos::OGuard aGuard( maMutex );
+	if( mpShapeMap )
+	{
+		//here get all the sub list.
+		if (pParentObj->IsGroupObject())
+		{
+			if (xAccParent.is())
+			{
+				uno::Reference < XAccessibleContext > xContext = xAccParent->getAccessibleContext();
+				if (xContext.is())
+				{
+					sal_Int32 nChildren = xContext->getAccessibleChildCount();
+					for(sal_Int32 i = 0; i<nChildren; i++)
+					{
+						uno::Reference < XAccessible > xChild = xContext->getAccessibleChild(i);
+						if (xChild.is())
+						{
+							uno::Reference < XAccessibleContext > xChildContext = xChild->getAccessibleContext();
+							if (xChildContext.is())
+							{
+								short nRole = xChildContext->getAccessibleRole();
+								if (nRole == AccessibleRole::SHAPE)
+								{
+									::accessibility::AccessibleShape* pAccShape = static_cast < ::accessibility::AccessibleShape* >( xChild.get());
+									uno::Reference < drawing::XShape > xShape = pAccShape->GetXShape();
+									if (xShape.is())
+									{
+										SdrObject* pObj = GetSdrObjectFromXShape(xShape);
+										AddShapeContext(pObj, xChild);
+										AddGroupContext(pObj,xChild);
+									}
+								}
+							}
+						}	
+					}
+				}
+			}
+		}
+	}				
+}
+//-----IAccessibility2 Implementation 2009
 
 ::vos::ORef < ::accessibility::AccessibleShape > SwAccessibleMap::GetContextImpl(
 			const SdrObject *pObj,
@@ -1656,13 +2305,16 @@
 			mpShapeMap->find( pObj );
 		if( aIter != mpShapeMap->end() )
 		{
+			//IAccessible2 Implementation 2009 ----
+			uno::Reference < XAccessible > xAcc( (*aIter).second );
 			mpShapeMap->erase( aIter );
-
+			RemoveGroupContext(pObj, xAcc);
 			// The shape selection flag is not cleared, but one might do
 			// so but has to make sure that the removed context is the one
 			// that is selected.
-
-			if( mpShapeMap->empty() )
+			
+			if( mpShapeMap && mpShapeMap->empty() )
+			//---- IAccessible2 Implementation 2009
 			{
 				delete mpShapeMap;
 				mpShapeMap = 0;
@@ -1809,6 +2461,7 @@
 	{
 		::vos::ORef< SwAccessibleContext > xAccImpl;
 		::vos::ORef< SwAccessibleContext > xParentAccImpl;
+		const SwFrm *pParent =NULL; //IAccessibility2 Implementation 2009
 		{
 			vos::OGuard aGuard( maMutex );
 
@@ -1831,7 +2484,7 @@
 				{
 					// Otherwise we look if the parent is accessible.
 					// If not, there is nothing to do.
-					const SwFrm *pParent =
+					pParent = //IAccessibility2 Implementation 2009
 						SwAccessibleFrame::GetParent( aFrmOrObj,
                                                       GetShell()->IsPreView());
 
@@ -1881,7 +2534,54 @@
 														  rOldBox );
 			}
 		}
+		//IAccessibility2 Implementation 2009-----
+		else if(pParent)
+		{
+/*
+For child graphic and it's parent paragraph,if split 2 graphic to 2 paragraph,
+will delete one graphic swfrm and new create 1 graphic swfrm ,
+then the new paragraph and the new graphic SwFrm will add .
+but when add graphic SwFrm ,the accessible of the new Paragraph is not created yet.
+so the new graphic accessible 'parent is NULL,
+so run here: save the parent's SwFrm not the accessible object parent,
+*/		
+			sal_Bool bIsValidFrm = sal_False;
+			sal_Bool bIsTxtParent = sal_False;
+			if (aFrmOrObj.GetSwFrm())
+			{
+				int nType = pFrm->GetType();
+				if ( FRM_FLY == nType )
+				{
+					bIsValidFrm =sal_True;
+				}
+			}
+			else if(pObj)
+			{
+				int nType = pParent->GetType();
+				if (FRM_TXT == nType)
+				{
+					bIsTxtParent =sal_True;
+				}
+			}
+//			sal_Bool bIsVisibleChildrenOnly =aFrmOrObj.IsVisibleChildrenOnly() ;
+//			sal_Bool bIsBoundAsChar =aFrmOrObj.IsBoundAsChar() ;//bIsVisibleChildrenOnly && bIsBoundAsChar && 
+			if((bIsValidFrm || bIsTxtParent) )
+			{
+				if( GetShell()->ActionPend() )
+				{
+					SwAccessibleEvent_Impl aEvent(
+						SwAccessibleEvent_Impl::CHILD_POS_CHANGED,
+						pParent, aFrmOrObj, rOldBox );
+					AppendEvent( aEvent );
+				}
+				else
+				{
+					OSL_ENSURE(false,"");
+				}
+			}
+		}
 	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 void SwAccessibleMap::InvalidateContent( const SwFrm *pFrm )
@@ -2016,6 +2716,29 @@
 				mpFrmMap->find( aFrmOrObj.GetSwFrm() );
 			if( aIter != mpFrmMap->end() )
 				xAcc = (*aIter).second;
+			//IAccessibility2 Implementation 2009-----
+			else
+			{
+				SwRect rcEmpty;
+				const SwTabFrm* pTabFrm = aFrmOrObj.GetSwFrm()->FindTabFrm();
+				if (pTabFrm)
+				{
+					InvalidatePosOrSize(pTabFrm,0,0,rcEmpty);
+				}
+				else
+				{
+					InvalidatePosOrSize(aFrmOrObj.GetSwFrm(),0,0,rcEmpty);
+				}
+
+
+				aIter =
+					mpFrmMap->find( aFrmOrObj.GetSwFrm() );
+				if( aIter != mpFrmMap->end() )
+				{
+					xAcc = (*aIter).second;
+				}
+			}
+			//-----IAccessibility2 Implementation 2009
 
 			// For cells, some extra thoughts are necessary,
 			// because invalidating the cursor for one cell
@@ -2044,18 +2767,202 @@
 					xAcc = GetContext( aFrmOrObj.GetSwFrm(), sal_True );
 			}
 		}
+        //IAccessibility2 Implementation 2009-----
+        else if (bShapeSelected)
+        {
+            const SwFEShell *pFESh = pVSh ? static_cast< const SwFEShell * >( pVSh ) : NULL ;
+            if(pFESh)
+            {
+                const SdrMarkList *pMarkList = pFESh->GetMarkList();
+                if (pMarkList != NULL && pMarkList->GetMarkCount() == 1)
+                {
+                    SdrObject *pObj = pMarkList->GetMark( 0 )->GetMarkedSdrObj();
+					::vos::ORef < ::accessibility::AccessibleShape > pAccShapeImpl = GetContextImpl(pObj,NULL,sal_False);
+                    if (!pAccShapeImpl.isValid())
+                    {
+                        while (pObj && pObj->GetUpGroup())
+                        {
+                            pObj = pObj->GetUpGroup();
+                        }
+                        if (pObj != NULL)
+                        {
+                            const SwFrm *pParent = SwAccessibleFrame::GetParent( SwAccessibleChild(pObj), GetShell()->IsPreView() );
+                            if( pParent )
+                            {
+                                ::vos::ORef< SwAccessibleContext > xParentAccImpl = GetContextImpl(pParent,sal_False);
+                                if (!xParentAccImpl.isValid())
+                                {
+                                    const SwTabFrm* pTabFrm = pParent->FindTabFrm();
+                                    if (pTabFrm)
+                                    {   
+                                        //The Table should not add in acc.because the "pParent" is not add to acc .
+                                        uno::Reference< XAccessible>  xAccParentTab = GetContext(pTabFrm,sal_True);//Should Create.
+
+                                        const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pTabFrm), GetShell()->IsPreView() );
+                                        if (pParentRoot)
+                                        {
+                                            ::vos::ORef< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+                                            if(xParentAccImplRoot.isValid())
+                                            {
+                                                AccessibleEventObject aEvent;
+                                                aEvent.EventId = AccessibleEventId::CHILD;
+                                                aEvent.NewValue <<= xAccParentTab;
+                                                xParentAccImplRoot->FireAccessibleEvent( aEvent );
+                                            }
+                                        }
+
+                                        //Get "pParent" acc again.
+                                        xParentAccImpl = GetContextImpl(pParent,sal_False);
+                                    }
+                                    else
+                                    {   
+                                        //directly create this acc para .
+                                        xParentAccImpl = GetContextImpl(pParent,sal_True);//Should Create.
+
+                                        const SwFrm *pParentRoot = SwAccessibleFrame::GetParent( SwAccessibleChild(pParent), GetShell()->IsPreView() );
+
+                                        ::vos::ORef< SwAccessibleContext > xParentAccImplRoot = GetContextImpl(pParentRoot,sal_False);
+                                        if(xParentAccImplRoot.isValid())
+                                        {
+                                            AccessibleEventObject aEvent;
+                                            aEvent.EventId = AccessibleEventId::CHILD;
+                                            aEvent.NewValue <<= uno::Reference< XAccessible>(xParentAccImpl.getBodyPtr());
+                                            xParentAccImplRoot->FireAccessibleEvent( aEvent );
+                                        }
+                                    }
+                                }
+                                if (xParentAccImpl.isValid())
+                                {
+                                    uno::Reference< XAccessible>  xAccShape = 
+                                        GetContext(pObj,xParentAccImpl.getBodyPtr(),sal_True);
+
+                                    AccessibleEventObject aEvent;
+                                    aEvent.EventId = AccessibleEventId::CHILD;
+                                    aEvent.NewValue <<= xAccShape;
+                                    xParentAccImpl->FireAccessibleEvent( aEvent );
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
 	}
 
+	m_setParaAdd.clear();
+	m_setParaRemove.clear();
 	if( xOldAcc.is() && xOldAcc != xAcc )
 		InvalidateCursorPosition( xOldAcc );
 	if( bOldShapeSelected || bShapeSelected )
 		InvalidateShapeSelection();
 	if( xAcc.is() )
 		InvalidateCursorPosition( xAcc );
+
+	InvalidateShapeInParaSelection();
+
+	SET_PARA::iterator si = m_setParaRemove.begin();
+	for (; si != m_setParaRemove.end() ; ++si)
+	{
+		SwAccessibleParagraph* pAccPara = *si;
+		if(pAccPara && pAccPara->getSelectedAccessibleChildCount() == 0 && pAccPara->getSelectedText().getLength() == 0)
+		{
+			if(pAccPara->SetSelectedState(sal_False))
+			{
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+				pAccPara->FireAccessibleEvent( aEvent );
+			}
+		}			
+	}
+	si = m_setParaAdd.begin();
+	for (; si != m_setParaAdd.end() ; ++si)
+	{
+		SwAccessibleParagraph* pAccPara = *si;
+		if(pAccPara && pAccPara->SetSelectedState(sal_True))
+		{
+			AccessibleEventObject aEvent;
+			aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+			pAccPara->FireAccessibleEvent( aEvent );
+		}
+	}
+    //-----IAccessibility2 Implementation 2009
 }
 
+//IAccessibility2 Implementation 2009-----
+//Notify the page change event to bridge. 
+void SwAccessibleMap::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+	uno::Reference<XAccessible> xAcc = GetDocumentView( );
+    	if ( xAcc.is() )
+    	{
+    		SwAccessibleDocumentBase *pAcc =
+			static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+			if (pAcc)
+			{
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::PAGE_CHANGED;
+				aEvent.OldValue <<= nOldPage;
+				aEvent.NewValue <<= nNewPage;
+				pAcc->FireAccessibleEvent( aEvent );
+			}
+    	}
+}
+ 
+void SwAccessibleMap::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+	uno::Reference<XAccessible> xAcc = GetDocumentView( );
+    	if ( xAcc.is() )
+    	{
+    		SwAccessibleDocumentBase *pAcc =
+			static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+			if (pAcc)
+			{
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::SECTION_CHANGED;
+				aEvent.OldValue <<= nOldSection;
+				aEvent.NewValue <<= nNewSection;
+				pAcc->FireAccessibleEvent( aEvent );
+
+			}
+    	}
+}
+void SwAccessibleMap::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+	uno::Reference<XAccessible> xAcc = GetDocumentView( );
+    	if ( xAcc.is() )
+    	{
+    		SwAccessibleDocumentBase *pAcc =
+			static_cast< SwAccessibleDocumentBase * >( xAcc.get() );
+		if (pAcc)
+		{
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::COLUMN_CHANGED;
+				aEvent.OldValue <<= nOldColumn;
+				aEvent.NewValue <<= nNewColumn;
+				pAcc->FireAccessibleEvent( aEvent );
+			
+		}
+    	}
+}
+//-----IAccessibility2 Implementation 2009
+
 void SwAccessibleMap::InvalidateFocus()
 {
+	//IAccessibility2 Implementation 2009-----
+	if(GetShell()->IsPreView())
+	{
+		uno::Reference<XAccessible> xAcc = _GetDocumentView( sal_True );
+		if (xAcc.get())
+		{
+			SwAccessiblePreview *pAccPreview = static_cast<SwAccessiblePreview *>(xAcc.get());
+			if (pAccPreview)
+			{
+				pAccPreview->InvalidateFocus();
+				return ;
+			}			
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	uno::Reference < XAccessible > xAcc;
 	sal_Bool bShapeSelected;
 	{
@@ -2071,10 +2978,12 @@
 			static_cast< SwAccessibleContext *>( xAcc.get() );
 		pAccImpl->InvalidateFocus();
 	}
-	else if( bShapeSelected  )
+	//IAccessibility2 Implementation 2009-----
+	else
 	{
-		DoInvalidateShapeFocus();
+		DoInvalidateShapeSelection(sal_True);
 	}
+	//-----IAccessibility2 Implementation 2009 
 }
 
 void SwAccessibleMap::SetCursorContext(
@@ -2357,6 +3266,9 @@
 		if( mpEvents )
 		{
 			mpEvents->SetFiring();
+			//IAccessibility2 Implementation 2009-----
+			mpEvents->MoveInvalidXAccToEnd();
+			//-----IAccessibility2 Implementation 2009
 			SwAccessibleEventList_Impl::iterator aIter = mpEvents->begin();
 			while( aIter != mpEvents->end() )
 			{
@@ -2547,6 +3459,92 @@
 	return sal_True;
 }
 
+//IAccessibility2 Implementation 2009-----
+//Get the accessible control shape from the model object, here model object is with XPropertySet type
+::accessibility::AccessibleControlShape * SwAccessibleMap::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+	if( mpShapeMap )
+	{
+		SwAccessibleShapeMap_Impl::const_iterator aIter = mpShapeMap->begin();
+		SwAccessibleShapeMap_Impl::const_iterator aEndIter = mpShapeMap->end();
+		while( aIter != aEndIter)
+		{
+			uno::Reference < XAccessible > xAcc( (*aIter).second );
+			::accessibility::AccessibleShape *pAccShape =
+				static_cast < ::accessibility::AccessibleShape* >( xAcc.get() );
+			if(pAccShape && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
+			{
+				::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+				if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+					return pCtlAccShape;
+			}
+			++aIter;
+		}
+	}
+	return NULL;
+}
+
+::com::sun::star::uno::Reference< XAccessible >
+    SwAccessibleMap::GetAccessibleCaption (const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& xShape)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+		SdrObject* captionedObject = GetSdrObjectFromXShape(xShape);
+
+		SwDrawContact *pContact = (SwDrawContact*)GetUserCall( captionedObject );
+		ASSERT( RES_DRAWFRMFMT == pContact->GetFmt()->Which(),
+				"fail" );
+		if( !pContact )
+			return 0;
+
+		SwDrawFrmFmt *pCaptionedFmt = (SwDrawFrmFmt *)pContact->GetFmt();
+		if( !pCaptionedFmt )
+			return 0;
+
+		SwFlyFrm* pFrm = NULL;
+		if (pCaptionedFmt->HasCaption())
+		{
+			const SwFrmFmt *pCaptionFrmFmt = pCaptionedFmt->GetCaptionFmt();
+			SwClientIter aIter (*(SwModify*)pCaptionFrmFmt);
+			pFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
+		}
+		if (!pFrm)
+			return 0;
+		//SwFrmFmt* pFrm = pCaptionedFmt->GetCaptionFmt();
+		uno::Reference < XAccessible > xAcc( GetContext((SwFrm*)pFrm,sal_True) );
+		//Reference < XAccessibleShape > xAccShape( xAcc, UNO_QUERY );
+		
+		uno::Reference< XAccessibleContext > xAccContext = xAcc->getAccessibleContext();
+		if( xAccContext.is() )
+		{	//get the parent of caption frame, which is paragaph
+			uno::Reference< XAccessible > xAccParent = xAccContext->getAccessibleParent();
+			if(xAccParent.is())
+			{
+				//get the great parent of caption frame which is text frame.
+				uno::Reference< XAccessibleContext > xAccParentContext = xAccParent->getAccessibleContext();
+				uno::Reference< XAccessible > xAccGreatParent = xAccParentContext->getAccessibleParent();
+				if(xAccGreatParent.is())
+				{
+					AccessibleEventObject aEvent;
+					aEvent.EventId = AccessibleEventId::CHILD;
+					aEvent.NewValue <<= xAccParent;
+					( static_cast< SwAccessibleContext * >(xAccGreatParent.get()) )->FireAccessibleEvent( aEvent );
+
+				}
+
+				AccessibleEventObject aEvent;
+				aEvent.EventId = AccessibleEventId::CHILD;
+				aEvent.NewValue <<= xAcc;
+				( static_cast< SwAccessibleContext * >(xAccParent.get()) )->FireAccessibleEvent( aEvent );
+			}
+		}
+		
+		if(xAcc.get())
+			return xAcc;
+		else
+			return NULL;
+
+}
+//-----IAccessibility2 Implementation 2009
 Point SwAccessibleMap::PixelToCore( const Point& rPoint ) const
 {
 	Point aPoint;
@@ -2872,3 +3870,10 @@
            : GetShell()->VisArea();
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleMap::IsDocumentSelAll()
+{
+	return GetShell()->GetDoc()->IsPrepareSelAll();
+}
+//-----IAccessibility2 Implementation 2009
+
diff --git a/main/sw/source/core/access/accnotextframe.cxx b/main/sw/source/core/access/accnotextframe.cxx
index 4746956..9ad2334 100644
--- a/main/sw/source/core/access/accnotextframe.cxx
+++ b/main/sw/source/core/access/accnotextframe.cxx
@@ -39,10 +39,20 @@
 #include <hints.hxx>
 // <--
 #include "accnotextframe.hxx"
+//IAccessibility2 Implementation 2009-----
+#include <fmturl.hxx>
+#include <accnotexthyperlink.hxx>
+#include <svtools/imap.hxx>
+#include <unotools/accessiblerelationsethelper.hxx>
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <doc.hxx>
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
+using utl::AccessibleRelationSetHelper;
+//-----IAccessibility2 Implementation 2009
 
 const SwNoTxtNode *SwAccessibleNoTextFrame::GetNoTxtNode() const
 {
@@ -52,7 +62,13 @@
 	{
 		const SwCntntFrm *pCntFrm =
 			static_cast<const SwCntntFrm *>( pFlyFrm->Lower() );
-		pNd = pCntFrm->GetNode()->GetNoTxtNode();
+		//IAccessibility2 Implementation 2009-----
+		const SwCntntNode* pSwCntntNode = pCntFrm->GetNode();
+		if(pSwCntntNode != NULL)
+		{
+			pNd = pSwCntntNode->GetNoTxtNode();
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 
 	return pNd;
@@ -203,6 +219,12 @@
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
 	CHECK_FOR_DEFUNC( XAccessibleContext )
+	//IAccessibility2 Implementation 2009-----
+	// OUString longDesc;	
+	// const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
+	// longDesc = OUString( pFlyFmt->GetLongDescription() );
+	// return  longDesc; MT: Do not return longDesc, which still is empty - why was the line above commented out?
+	//-----IAccessibility2 Implementation 2009
 
     return msDesc;
 }
@@ -224,6 +246,15 @@
         aAny <<= xImage;
         return aAny;
     }
+	//IAccessibility2 Implementation 2009-----
+	else if ( aType == ::getCppuType((uno::Reference<XAccessibleHypertext> *)0) )
+    {
+		uno::Reference<XAccessibleHypertext> aAccHypertext = this;
+		uno::Any aAny;
+		aAny <<= aAccHypertext;
+		return aAny;
+    }
+	//-----IAccessibility2 Implementation 2009
     else
         return SwAccessibleContext::queryInterface( aType );
 }
@@ -269,3 +300,137 @@
 {
     return getSize().Width;
 }
+//IAccessibility2 Implementation 2009-----
+//=====  XAccesibleText  ==================================================
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setCaretPosition( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+sal_Unicode SAL_CALL SwAccessibleNoTextFrame::getCharacter( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return 0;}
+::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL SwAccessibleNoTextFrame::getCharacterAttributes( sal_Int32 , const ::com::sun::star::uno::Sequence< ::rtl::OUString >& ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	uno::Sequence<beans::PropertyValue> aValues(0);
+	return aValues;
+}
+::com::sun::star::awt::Rectangle SAL_CALL SwAccessibleNoTextFrame::getCharacterBounds( sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	return com::sun::star::awt::Rectangle(0, 0, 0, 0 );
+}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getIndexAtPoint( const ::com::sun::star::awt::Point& ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException){return 0;}
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::setSelection( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getText(  ) throw (::com::sun::star::uno::RuntimeException){return OUString();}
+::rtl::OUString SAL_CALL SwAccessibleNoTextFrame::getTextRange( sal_Int32 , sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return OUString();}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextAtIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+	return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBeforeIndex( sal_Int32, sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+	return aResult;
+}
+::com::sun::star::accessibility::TextSegment SAL_CALL SwAccessibleNoTextFrame::getTextBehindIndex( sal_Int32 , sal_Int16 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	::com::sun::star::accessibility::TextSegment aResult;
+	return aResult;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextFrame::copyText( sal_Int32, sal_Int32 ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException){return sal_True;}
+
+
+//
+//  XAccessibleHyperText
+//
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkCount()
+throw (uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+	sal_Int32 nCount = 0;
+	SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+	if(aURL.GetMap() || aURL.GetURL().Len())
+		nCount = 1;
+
+	return nCount;
+}
+
+uno::Reference< XAccessibleHyperlink > SAL_CALL 
+	SwAccessibleNoTextFrame::getHyperLink( sal_Int32 nLinkIndex )
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+	uno::Reference< XAccessibleHyperlink > xRet;
+
+	SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() );
+
+	if( nLinkIndex > 0 )
+		throw lang::IndexOutOfBoundsException();
+
+	if( aURL.GetMap() || aURL.GetURL().Len() )
+	{
+		if ( !alink.is() )
+		{
+			alink = new SwAccessibleNoTextHyperlink( this, GetFrm() );
+		}		
+
+		return alink;
+	}
+
+	return NULL;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextFrame::getHyperLinkIndex( sal_Int32 )
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	CHECK_FOR_DEFUNC( XAccessibleHypertext );
+
+	sal_Int32 nRet = 0;
+	
+	return nRet;
+}
+
+AccessibleRelation SwAccessibleNoTextFrame::makeRelation( sal_Int16 nType, const SwFlyFrm* pFrm )
+{
+	uno::Sequence<uno::Reference<XInterface> > aSequence(1);
+    aSequence[0] = GetMap()->GetContext( pFrm );
+	return AccessibleRelation( nType, aSequence );
+}
+
+
+uno::Reference<XAccessibleRelationSet> SAL_CALL SwAccessibleNoTextFrame::getAccessibleRelationSet( )
+	throw ( uno::RuntimeException )
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+	CHECK_FOR_DEFUNC( XAccessibleContext );
+
+    // get the caption frame, and insert label relations into helper
+
+    AccessibleRelationSetHelper* pHelper = new AccessibleRelationSetHelper();
+
+	SwFlyFrm* pFlyFrm = getFlyFrm();
+	DBG_ASSERT( pFlyFrm != NULL, "fly frame expected" );
+	
+	SwFlyFrm* pCaptionFrm = NULL;
+	const SwFrmFmt* pFrm = pFlyFrm ->GetFmt()->GetCaptionFmt();
+	if (pFrm)
+	{
+		SwClientIter aIter (*(SwModify*)pFrm);
+		pCaptionFrm = (SwFlyFrm*)aIter.First( TYPE ( SwFlyFrm ));
+	}
+	if(pCaptionFrm!=NULL)
+	{
+		pHelper->AddRelation( makeRelation( AccessibleRelationType::DESCRIBED_BY, pCaptionFrm ) );
+	}
+	
+	return pHelper;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accnotextframe.hxx b/main/sw/source/core/access/accnotextframe.hxx
index e9ff9e6..8f2ca77 100644
--- a/main/sw/source/core/access/accnotextframe.hxx
+++ b/main/sw/source/core/access/accnotextframe.hxx
@@ -24,13 +24,30 @@
 #define _ACCNOTEXTFRAME_HXX
 #include "accframebase.hxx"
 #include <com/sun/star/accessibility/XAccessibleImage.hpp>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEHYPERTEXT_HPP_
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#endif
+
+namespace utl { class AccessibleRelationSetHelper; }
+namespace com { namespace star {
+    namespace accessibility { struct AccessibleRelation; }
+} }
 
 class SwFlyFrm;
 class SwNoTxtNode;
+class SwAccessibleNoTextHyperlink;
+//-----IAccessibility2 Implementation 2009
 
 class SwAccessibleNoTextFrame : public	SwAccessibleFrameBase,
-                                public ::com::sun::star::accessibility::XAccessibleImage
+                                public ::com::sun::star::accessibility::XAccessibleImage,
+                                public ::com::sun::star::accessibility::XAccessibleHypertext//Added by yangzhh for HyperLink
 {
+	//IAccessibility2 Implementation 2009-----
+	friend class SwAccessibleNoTextHyperlink;
+	//HyperLinksMap alinksMap;
+	com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleHyperlink > alink;
+	//-----IAccessibility2 Implementation 2009
 	SwDepend		aDepend;
     // --> OD 2009-07-14 #i73249#
     ::rtl::OUString msTitle;
@@ -100,6 +117,51 @@
 
 	// The object is not visible an longer and should be destroyed
 	virtual void Dispose( sal_Bool bRecursive = sal_False );
+
+	//IAccessibility2 Implementation 2009-----
+    virtual sal_Int32 SAL_CALL getCaretPosition(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL setCaretPosition( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual sal_Unicode SAL_CALL getCharacter( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);//Shen Zhen Jie changed sal_Unicode to sal_uInt32
+    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::awt::Rectangle SAL_CALL getCharacterBounds( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getCharacterCount(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getIndexAtPoint( const ::com::sun::star::awt::Point& aPoint ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getSelectedText(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getSelectionStart(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getSelectionEnd(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL setSelection( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getText(  ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getTextRange( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextAtIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBeforeIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::accessibility::TextSegment SAL_CALL getTextBehindIndex( sal_Int32 nIndex, sal_Int16 aTextType ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL copyText( sal_Int32 nStartIndex, sal_Int32 nEndIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+
+
+	//=====  XAccessibleHypertext  ============================================
+	virtual sal_Int32 SAL_CALL getHyperLinkCount()
+ 		throw (::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< 
+  		::com::sun::star::accessibility::XAccessibleHyperlink > 
+	SAL_CALL getHyperLink( sal_Int32 nLinkIndex )
+  	throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+  			::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getHyperLinkIndex( sal_Int32 nCharIndex )
+	throw (::com::sun::star::lang::IndexOutOfBoundsException,
+			::com::sun::star::uno::RuntimeException);
+
+	SwAccessibleMap *GetAccessibleMap(){ return GetMap();}
+
+private:
+    com::sun::star::accessibility::AccessibleRelation makeRelation(
+        sal_Int16 nType, const SwFlyFrm* pFrm );
+
+public:
+	virtual ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessibleRelationSet> SAL_CALL
+    	getAccessibleRelationSet (void)
+        throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/accnotexthyperlink.cxx b/main/sw/source/core/access/accnotexthyperlink.cxx
new file mode 100644
index 0000000..04f52ed
--- /dev/null
+++ b/main/sw/source/core/access/accnotexthyperlink.cxx
@@ -0,0 +1,238 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_sw.hxx"
+
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <swurl.hxx>
+#include <vos/mutex.hxx>
+#include <vcl/svapp.hxx>
+#include <ndtxt.hxx>
+#include <txtinet.hxx>
+#include <frmfmt.hxx>
+
+#include <accnotexthyperlink.hxx>
+
+#include <fmturl.hxx>
+
+#include <svtools/imap.hxx>
+#include <svtools/imapobj.hxx>
+
+#include <accmap.hxx>
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+//using namespace ::rtl;
+
+SwAccessibleNoTextHyperlink::SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm *aFrm, sal_uInt16 nIndex) :
+	xFrame( p ),
+	mpFrm( aFrm ),
+	mnIndex(nIndex)
+{
+}
+
+// XAccessibleAction
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionCount() 
+		throw (RuntimeException)
+{
+	SwFmtURL aURL( GetFmt()->GetURL() );
+	ImageMap* pMap = aURL.GetMap();
+	if( pMap != NULL )
+	{
+		return	pMap->GetIMapObjectCount();
+	}else if( aURL.GetURL().Len() )
+	{
+		return 1;
+	}
+
+	return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::doAccessibleAction( sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+		throw new IndexOutOfBoundsException;
+
+	sal_Bool bRet = sal_False;
+	SwFmtURL aURL( GetFmt()->GetURL() );
+	ImageMap* pMap = aURL.GetMap();
+	if( pMap != NULL )
+	{	
+		IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+		if(pMapObj->GetURL().Len())
+		{
+			ViewShell *pVSh = xFrame->GetShell();
+			if( pVSh )
+			{
+				LoadURL( pMapObj->GetURL(), pVSh, URLLOAD_NOFILTER, 
+						 &pMapObj->GetTarget() );
+				bRet = sal_True;
+			}
+		}
+	}
+	else if( aURL.GetURL().Len() )
+	{
+		ViewShell *pVSh = xFrame->GetShell();
+		if( pVSh )
+		{
+			LoadURL( aURL.GetURL(), pVSh, URLLOAD_NOFILTER, 
+					 &aURL.GetTargetFrameName() );
+			bRet = sal_True;
+		}
+	}
+
+	return bRet;
+}
+		
+rtl::OUString SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionDescription(
+		sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	rtl::OUString sDesc;
+
+	if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+		throw new IndexOutOfBoundsException;
+
+	SwFmtURL aURL( GetFmt()->GetURL() );
+	ImageMap* pMap = aURL.GetMap();
+	if( pMap != NULL )
+	{
+		IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+		if(pMapObj->GetDesc().Len())
+			sDesc = rtl::OUString( pMapObj->GetDesc() );
+		else if(pMapObj->GetURL().Len())
+			sDesc = rtl::OUString( pMapObj->GetURL() );
+	}
+	else if( aURL.GetURL().Len() )
+		sDesc = rtl::OUString( aURL.GetName() );
+		//sDesc = rtl::OUString( aURL.GetName() );
+
+	return sDesc;
+}
+
+Reference< XAccessibleKeyBinding > SAL_CALL
+	SwAccessibleNoTextHyperlink::getAccessibleActionKeyBinding( sal_Int32 nIndex ) 
+	throw (IndexOutOfBoundsException, RuntimeException)
+{
+	Reference< XAccessibleKeyBinding > xKeyBinding;
+
+	if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+		throw new IndexOutOfBoundsException;
+
+	bool bIsValid = sal_False;
+	SwFmtURL aURL( GetFmt()->GetURL() );
+	ImageMap* pMap = aURL.GetMap();
+	if( pMap != NULL )
+	{
+		IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+		if(pMapObj->GetURL().Len())
+			bIsValid = sal_True;
+	}else if( aURL.GetURL().Len() )
+		bIsValid = sal_True;
+	
+	if(bIsValid)
+	{
+		::comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper =
+		   	new ::comphelper::OAccessibleKeyBindingHelper();
+		xKeyBinding = pKeyBindingHelper;
+
+		::com::sun::star::awt::KeyStroke aKeyStroke;
+		aKeyStroke.Modifiers = 0;
+		aKeyStroke.KeyCode = KEY_RETURN;
+		aKeyStroke.KeyChar = 0;
+		aKeyStroke.KeyFunc = 0;
+		pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+	}
+
+	return xKeyBinding;
+}
+
+// XAccessibleHyperlink
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionAnchor(
+		sal_Int32 nIndex ) 
+		throw (IndexOutOfBoundsException, RuntimeException)
+{
+	if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+		throw new IndexOutOfBoundsException;
+
+	Any aRet;
+	//SwFrm* pAnchor = ((SwFlyFrm*)mpFrm)->GetAnchor();
+	Reference< XAccessible > xAnchor = xFrame->GetAccessibleMap()->GetContext(mpFrm, sal_True);
+	//SwAccessibleNoTextFrame* pFrame = xFrame.get();
+	//Reference< XAccessible > xAnchor = (XAccessible*)pFrame;
+	aRet <<= xAnchor;
+	return aRet;
+}
+
+Any SAL_CALL SwAccessibleNoTextHyperlink::getAccessibleActionObject( 
+			sal_Int32 nIndex ) 
+	throw (IndexOutOfBoundsException, RuntimeException)
+{
+	if(nIndex < 0 || nIndex >= getAccessibleActionCount())
+		throw new IndexOutOfBoundsException;
+
+	SwFmtURL aURL( GetFmt()->GetURL() );
+	::rtl::OUString retText;
+	ImageMap* pMap = aURL.GetMap();
+	if( pMap != NULL )
+	{
+		IMapObject* pMapObj = pMap->GetIMapObject(nIndex);
+		if(pMapObj->GetURL().Len())
+			retText = rtl::OUString( pMapObj->GetURL() );
+	}else if( aURL.GetURL().Len() )
+		retText = rtl::OUString( aURL.GetURL() );
+
+	Any aRet;
+	aRet <<= retText;
+	return aRet;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getStartIndex() 
+		throw (RuntimeException)
+{
+	return 0;
+}
+
+sal_Int32 SAL_CALL SwAccessibleNoTextHyperlink::getEndIndex() 
+		throw (RuntimeException)
+{
+	return 0;
+}
+
+sal_Bool SAL_CALL SwAccessibleNoTextHyperlink::isValid(  ) 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	SwFmtURL aURL( GetFmt()->GetURL() );
+
+	if( aURL.GetMap() || aURL.GetURL().Len() )
+		return sal_True;
+	return sal_False;
+}
diff --git a/main/sw/source/core/access/accnotexthyperlink.hxx b/main/sw/source/core/access/accnotexthyperlink.hxx
new file mode 100644
index 0000000..032a155
--- /dev/null
+++ b/main/sw/source/core/access/accnotexthyperlink.hxx
@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ * 
+ * Copyright IBM Corporation 2010.
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org.  If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef _ACCNOTEXTHYPERLINK_HXX
+#define _ACCNOTEXTHYPERLINK_HXX
+
+
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/uno/RuntimeException.hpp>
+#include <vos/ref.hxx>
+#include <cppuhelper/implbase1.hxx>
+#include <fmtinfmt.hxx>
+#include <frame.hxx>
+#include <layfrm.hxx>
+
+#include "accnotextframe.hxx"
+/*
+using namespace ::com::sun::star::lang;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::accessibility;
+using namespace ::rtl;
+*/
+class SwAccessibleNoTextHyperlink : 
+		public ::cppu::WeakImplHelper1<
+		::com::sun::star::accessibility::XAccessibleHyperlink >
+{
+	friend class SwAccessibleNoTextFrame;
+
+	::vos::ORef< SwAccessibleNoTextFrame > xFrame;
+	const SwFrm *mpFrm;
+	sal_uInt16 mnIndex;
+
+	SwFrmFmt *GetFmt()
+	{
+		return ((SwLayoutFrm*)mpFrm)->GetFmt();
+	}
+public:
+
+	SwAccessibleNoTextHyperlink( SwAccessibleNoTextFrame *p, const SwFrm* aFrm, sal_uInt16 nIndex = 0xFFFF );
+
+	// XAccessibleAction
+    virtual sal_Int32 SAL_CALL getAccessibleActionCount() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL doAccessibleAction( sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription( 
+				sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException,
+				::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Reference< 
+			::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL
+		   	getAccessibleActionKeyBinding( sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+
+	// XAccessibleHyperlink
+    virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionAnchor( 
+				sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Any SAL_CALL getAccessibleActionObject( 
+			sal_Int32 nIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, 
+				::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getStartIndex() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Int32 SAL_CALL getEndIndex() 
+		throw (::com::sun::star::uno::RuntimeException);
+    virtual sal_Bool SAL_CALL isValid(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+};
+
+#endif
+
diff --git a/main/sw/source/core/access/accpara.cxx b/main/sw/source/core/access/accpara.cxx
index 159fa31..dab8c7e 100644
--- a/main/sw/source/core/access/accpara.cxx
+++ b/main/sw/source/core/access/accpara.cxx
@@ -56,6 +56,15 @@
 #include <sfx2/dispatch.hxx>    // for ExecuteAtViewShell(...)
 #include <unotools/charclass.hxx>   // for GetWordBoundary
 // for get/setCharacterAttribute(...)
+
+#include <reffld.hxx>
+#include <docufld.hxx>
+#include <expfld.hxx>
+#include <flddat.hxx>
+#include <fldui.hrc>
+#include "../../ui/inc/fldmgr.hxx"
+#include "fldbas.hxx"      // SwField
+#include <svl/svstdarr.hxx>
 #include <unocrsr.hxx>
 //#include <unoobj.hxx>
 #include <unoport.hxx>
@@ -66,7 +75,31 @@
 #include <acchypertextdata.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
 #include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <section.hxx>
+#include <doctxm.hxx>
 #include <comphelper/accessibletexthelper.hxx>
+#include <algorithm>
+#include <docufld.hxx>
+#include <txtfld.hxx>
+#include <fmtfld.hxx>
+#include <modcfg.hxx>
+//#include "accnote.hxx"
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include "swmodule.hxx"
+#include "redline.hxx"
+#include <com/sun/star/awt/FontWeight.hpp>
+#include <com/sun/star/awt/FontStrikeout.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <wrong.hxx>
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+#include <unosett.hxx>
+#include <paratr.hxx>
+#include <com/sun/star/container/XIndexReplace.hpp>
+//-----IAccessibility2 Implementation 2009
+// --> OD 2006-07-12 #i63870#
 #include <unomap.hxx>
 #include <unoprnms.hxx>
 #include <com/sun/star/text/WritingMode2.hpp>
@@ -86,6 +119,8 @@
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
+using namespace ::com::sun::star::container;
+using ::rtl::OUString;
 
 using beans::PropertyValue;
 using beans::XMultiPropertySet;
@@ -148,6 +183,19 @@
             // same node? Then check whether it's also within 'our' part
             // of the paragraph
             sal_uInt16 nIndex = pPoint->nContent.GetIndex();
+			//IAccessibility2 Implementation 2009-----
+			if(!GetPortionData().IsValidCorePosition( nIndex ) ||
+				( GetPortionData().IsZeroCorePositionData() && nIndex== 0) )
+			{
+				SwTxtFrm *pTxtFrm = PTR_CAST( SwTxtFrm, GetFrm() );
+				bool bFormat = (pTxtFrm && pTxtFrm->HasPara());
+				if(bFormat)
+				{
+					ClearPortionData();
+					UpdatePortionData();
+				}
+			}
+			//-----IAccessibility2 Implementation 2009
             if( GetPortionData().IsValidCorePosition( nIndex ) )
             {
                 // Yes, it's us!
@@ -392,6 +440,20 @@
             aEvent.OldValue, aEvent.NewValue );
 
 		FireAccessibleEvent( aEvent );
+		//IAccessibility2 Implementation 2009-----
+		uno::Reference< XAccessible > xparent = getAccessibleParent();
+		uno::Reference< XAccessibleContext > xAccContext(xparent,uno::UNO_QUERY);
+		if (xAccContext.is() && xAccContext->getAccessibleRole() == AccessibleRole::TABLE_CELL)
+		{
+			SwAccessibleContext* pPara = static_cast< SwAccessibleContext* >(xparent.get());
+			if(pPara)
+			{
+				AccessibleEventObject aParaEvent;
+				aParaEvent.EventId = AccessibleEventId::VALUE_CHANGED;
+				pPara->FireAccessibleEvent(aParaEvent);
+			}
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 	else if( !bVisibleDataFired )
 	{
@@ -399,6 +461,10 @@
 	}
 
 	sal_Bool bNewIsHeading = IsHeading();
+	//IAccessibility2 Implementation 2009-----
+	//Get the real heading level, Heading1 ~ Heading10
+	nHeadingLevel = GetRealHeadingLevel();
+	//-----IAccessibility2 Implementation 2009
 	sal_Bool bOldIsHeading;
 	{
 		vos::OGuard aGuard( aMutex );
@@ -467,6 +533,20 @@
 
 		if( pWin && pWin->HasFocus() && -1 == nNew )
 			FireStateChangedEvent( AccessibleStateType::FOCUSED, sal_False );
+		//IAccessibility2 Implementation 2009-----
+		//To send TEXT_SELECTION_CHANGED event
+		sal_Int32 nStart=0;
+		sal_Int32 nEnd  =0;
+		sal_Bool bCurSelection=GetSelection(nStart,nEnd);
+		if(m_bLastHasSelection || bCurSelection )
+		{
+			aEvent.EventId = AccessibleEventId::TEXT_SELECTION_CHANGED;
+			aEvent.OldValue <<= uno::Any();
+			aEvent.NewValue <<= uno::Any();
+			FireAccessibleEvent(aEvent);
+		}
+		m_bLastHasSelection =bCurSelection;
+		//-----IAccessibility2 Implementation 2009
 	}
 }
 
@@ -499,20 +579,35 @@
     , pHyperTextData( NULL )
     , nOldCaretPos( -1 )
     , bIsHeading( sal_False )
+    //IAccessibility2 Implementation 2009-----
+    //Get the real heading level, Heading1 ~ Heading10
+    , nHeadingLevel (-1)
+    //-----IAccessibility2 Implementation 2009
     , aSelectionHelper( *this )
     // --> OD 2010-02-19 #i108125#
     , mpParaChangeTrackInfo( new SwParaChangeTrackingInfo( rTxtFrm ) )
     // <--
+    //IAccessibility2 Implementation 2009-----
+    , m_bLastHasSelection(false)  //To add TEXT_SELECTION_CHANGED event
+    //-----IAccessibility2 Implementation 2009
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
 	bIsHeading = IsHeading();
+	//IAccessibility2 Implementation 2009-----
+	//Get the real heading level, Heading1 ~ Heading10
+	nHeadingLevel = GetRealHeadingLevel();
+	//-----IAccessibility2 Implementation 2009
     // --> OD 2004-09-27 #117970# - set an empty accessibility name for paragraphs
     SetName( ::rtl::OUString() );
     // <--
 
 	// If this object has the focus, then it is remembered by the map itself.
-	nOldCaretPos = GetCaretPos();
+	//IAccessibility2 Implementation 2009-----
+	// not necessary to remember this pos here. Generally, the pos will be updated in invalidateXXX method, which may fire the
+	//Focus event based on the difference of new & old caret pos. 
+	//nOldCaretPos = GetCaretPos();
+	//-----IAccessibility2 Implementation 2009
 }
 
 SwAccessibleParagraph::~SwAccessibleParagraph()
@@ -636,7 +731,76 @@
 {
     return IsValidPosition(nBegin, nLength) && IsValidPosition(nEnd, nLength);
 }
+//IAccessibility2 Implementation 2009-----
+SwTOXSortTabBase* SwAccessibleParagraph::GetTOXSortTabBase()
+{
+	const SwTxtNode* pTxtNd = GetTxtNode();
+	if( pTxtNd )
+	{
+		const SwSectionNode * pSectNd = pTxtNd->FindSectionNode();
+		if( pSectNd )
+		{
+			const SwSection * pSect = &pSectNd->GetSection();
+			SwTOXBaseSection *pTOXBaseSect = (SwTOXBaseSection *)pSect;
+			if( pSect->GetType() == TOX_CONTENT_SECTION ) 
+			{
+				SwTOXSortTabBase* pSortBase = 0;
+				int nSize = pTOXBaseSect->GetTOXSortTabBases()->Count();
+				
+				for(int nIndex = 0; nIndex<nSize; nIndex++ )
+				{
+					pSortBase = (*(pTOXBaseSect->GetTOXSortTabBases()))[nIndex];
+					if( pSortBase->pTOXNd == pTxtNd ) 
+						break;
+				}
 
+				if (pSortBase)
+				{
+					return pSortBase;
+				}			
+			}
+		}
+	}
+	return NULL;
+}
+
+short SwAccessibleParagraph::GetTOCLevel()
+{
+	SwTOXSortTabBase* pToxBase = GetTOXSortTabBase();
+	if( pToxBase )
+	{
+		const SwCntntNode*	pNd = pToxBase->aTOXSources[0].pNd;
+		if( pNd )
+			return pToxBase->GetLevel();
+		else
+			return -1;
+	}
+	else
+		return -1;
+}
+
+//the function is to check whether the position is in a redline range.
+const SwRedline* SwAccessibleParagraph::GetRedlineAtIndex( sal_Int32 )
+{
+	const SwRedline* pRedline = NULL;
+	SwPaM* pCrSr = GetCursor( true );
+	if ( pCrSr )
+	{
+		SwPosition* pStart = pCrSr->Start();
+		const SwTxtNode* pNode = GetTxtNode();
+		if ( pNode )
+		{
+			const SwDoc* pDoc = pNode->GetDoc();
+			if ( pDoc )
+			{
+				pRedline = pDoc->GetRedline( *pStart, NULL );
+			}
+		}
+	}
+
+	return pRedline;
+}
+//-----IAccessibility2 Implementation 2009
 
 //
 // text boundaries
@@ -648,6 +812,11 @@
     const ::rtl::OUString&,
     sal_Int32 nPos )
 {
+	//IAccessibility2 Implementation 2009-----
+    if( GetPortionData().FillBoundaryIFDateField( rBound,  nPos) )  	
+		return sal_True;
+	//-----IAccessibility2 Implementation 2009
+	
     rBound.startPos = nPos;
     rBound.endPos = nPos+1;
     return sal_True;
@@ -674,6 +843,46 @@
         // (DICTIONARY_WORD includes punctuation, ANY_WORD doesn't.)
         const sal_uInt16 nWordType = i18n::WordType::ANY_WORD;
 
+/*
+		// get word boundary, as the Break-Iterator sees fit.		
+		sal_Unicode SpaceChar(' ');
+		if (rText.getCodePointAt(nPos) == SpaceChar)
+		{
+			int nStartPos = nPos;
+			int nEndPos = nPos+1;
+			while (nStartPos >= 0 && rText.getCodePointAt(nStartPos) == SpaceChar)
+				--nStartPos;
+			while (nEndPos < rText.getLength() && rText.getCodePointAt(nEndPos) == SpaceChar)
+				++nEndPos;
+			//Get the previous word boundary + the followed space characters
+			if (nStartPos >= 0)
+			{
+				rBound = pBreakIt->xBreak->getWordBoundary( rText, nStartPos, aLocale, nWordType, sal_True );
+				rBound.endPos += (nEndPos-nStartPos - 1);
+			}
+			//When the frontal characters are whitespace, return the all space characters directly.
+			else 
+			{
+				rBound.startPos = 0;
+				rBound.endPos = nEndPos;
+			}
+		}
+		// add the " " into the word boundry
+		else
+		{
+			rBound = pBreakIt->xBreak->getWordBoundary(rText, nPos, aLocale, nWordType, sal_True );
+			sal_Int32 nEndPos = rBound.endPos, nLength = rText.getLength();
+			while ( nEndPos < nLength && rText.getCodePointAt(nEndPos) == SpaceChar )
+				nEndPos++;
+			rBound.endPos = nEndPos;
+		}
+		//IAccessibility2 Implementation 2009-----
+		tabCharInWord( nPos, rBound);
+		if( GetPortionData().FillBoundaryIFDateField( rBound,  rBound.startPos) ) 
+			return sal_True;
+		//-----IAccessibility2 Implementation 2009
+        return sal_True; // MT: So why do we need the return TRUE above???
+*/
         // get word boundary, as the Break-Iterator sees fit.
         rBound = pBreakIt->GetBreakIter()->getWordBoundary(
             rText, nPos, aLocale, nWordType, sal_True );
@@ -694,9 +903,17 @@
 
 sal_Bool SwAccessibleParagraph::GetSentenceBoundary(
     i18n::Boundary& rBound,
-    const ::rtl::OUString&,
+    const ::rtl::OUString& rText,
     sal_Int32 nPos )
 {
+	//IAccessibility2 Implementation 2009-----
+	const sal_Unicode* pStr = rText.getStr();
+	if (pStr)
+	{
+		while( pStr[nPos] == sal_Unicode(' ') && nPos < rText.getLength())
+			nPos++;
+	}
+	//-----IAccessibility2 Implementation 2009
     GetPortionData().GetSentenceBoundary( rBound, nPos );
     return sal_True;
 }
@@ -810,11 +1027,80 @@
             break;
 
         case AccessibleTextType::LINE:
-            bRet = GetLineBoundary( rBound, rText, nPos );
+			//IAccessibility2 Implementation 2009-----
+            //Solve the problem of returning wrong LINE and PARAGRAPH
+            if((nPos == rText.getLength()) && nPos > 0)
+            	bRet = GetLineBoundary( rBound, rText, nPos - 1);
+            else
+            	bRet = GetLineBoundary( rBound, rText, nPos );
+			//-----IAccessibility2 Implementation 2009
             break;
 
         case AccessibleTextType::ATTRIBUTE_RUN:
             bRet = GetAttributeBoundary( rBound, rText, nPos );
+			//IAccessibility2 Implementation 2009-----
+			if(bRet)
+			{
+				SwCrsrShell* pCrsrShell = GetCrsrShell();
+				if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+				{
+					SwTxtNode* pTxtNode = const_cast<SwTxtNode*>( GetTxtNode() );
+					if(pTxtNode)
+					{
+						const SwWrongList* pWrongList = pTxtNode->GetWrong();
+						if( NULL != pWrongList )
+						{
+							xub_StrLen nBegin = nPos;
+							xub_StrLen nLen = 1;
+							const xub_StrLen nNext = pWrongList->NextWrong(nBegin);
+							xub_StrLen nLast;
+                            xub_StrLen nWrongPos = pWrongList->GetWrongPos( nBegin );
+                            if ( nWrongPos >= pWrongList->Count() || 
+                                 ( nLast = pWrongList->Pos( nWrongPos ) ) >= nBegin )
+                            {
+                                nLast = nWrongPos 
+                                        ? pWrongList->Pos( --nWrongPos ) 
+                                        : STRING_LEN;
+                            }
+                            if ( nBegin > pWrongList->GetBeginInv() && 
+                                 ( nLast == STRING_LEN || nLast < pWrongList->GetEndInv() ) )
+                            {
+                                nLast = nBegin > pWrongList->GetEndInv() 
+                                        ? pWrongList->GetEndInv() 
+                                        : nBegin;
+                            }
+                            else if ( nLast < STRING_LEN )
+                            {        
+                                nLast += pWrongList->Len( nWrongPos );
+                            }
+							//
+							sal_Bool bIn = pWrongList->InWrongWord(nBegin,nLen); // && !pTxtNode->IsSymbol(nBegin) )
+							if(bIn)
+							{
+								rBound.startPos = max(nNext,(xub_StrLen)rBound.startPos);
+								rBound.endPos = min(xub_StrLen(nNext + nLen),(xub_StrLen)rBound.endPos);
+							}
+							else
+							{
+								if (STRING_LEN == nLast)//first 
+								{
+									rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+								}
+								else if(STRING_LEN == nNext)
+								{
+									rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+								}
+								else
+								{
+									rBound.startPos = max(nLast,(xub_StrLen)rBound.startPos);
+									rBound.endPos = min(nNext,(xub_StrLen)rBound.endPos);
+								}
+							}
+						}	
+					}
+				}
+			}
+			//-----IAccessibility2 Implementation 2009
             break;
 
         case AccessibleTextType::GLYPH:
@@ -1033,6 +1319,76 @@
 	return aRet;
 }
 
+//IAccessibility2 Implementation 2009-----
+uno::Sequence< ::rtl::OUString > getAttributeNames()
+{
+    static uno::Sequence< ::rtl::OUString >* pNames = NULL;
+
+    if( pNames == NULL )
+    {
+        // Add the font name to attribute list
+        uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 13 );
+
+        ::rtl::OUString* pStrings = pSeq->getArray();
+
+        // sorted list of strings
+        sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)
+        STR( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+       	STR( GetPropName( UNO_NAME_CHAR_CONTOURED ).pName );
+		STR( GetPropName( UNO_NAME_CHAR_EMPHASIS ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_FONT_NAME ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_HEIGHT ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_POSTURE ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_SHADOWED ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_STRIKEOUT ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName );
+		STR( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName );
+        STR( GetPropName( UNO_NAME_CHAR_WEIGHT ).pName );
+#undef STR
+        DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+        if( i != pSeq->getLength() )
+            pSeq->realloc( i );
+        pNames = pSeq;
+    }
+    return *pNames;
+}
+
+uno::Sequence< ::rtl::OUString > getSupplementalAttributeNames()
+{
+    static uno::Sequence< ::rtl::OUString >* pNames = NULL;
+
+    if( pNames == NULL )
+    {
+        uno::Sequence< ::rtl::OUString >* pSeq = new uno::Sequence< ::rtl::OUString >( 9 );
+
+        ::rtl::OUString* pStrings = pSeq->getArray();
+
+        // sorted list of strings
+        sal_Int32 i = 0;
+
+#define STR(x) pStrings[i++] = OUString::createFromAscii(x)        
+        STR( GetPropName( UNO_NAME_NUMBERING_LEVEL ).pName );
+		STR( GetPropName( UNO_NAME_NUMBERING_RULES ).pName );
+        STR( GetPropName( UNO_NAME_PARA_ADJUST ).pName );
+        STR( GetPropName( UNO_NAME_PARA_BOTTOM_MARGIN ).pName );
+        STR( GetPropName( UNO_NAME_PARA_FIRST_LINE_INDENT ).pName );
+        STR( GetPropName( UNO_NAME_PARA_LEFT_MARGIN ).pName );
+        STR( GetPropName( UNO_NAME_PARA_LINE_SPACING ).pName );
+        STR( GetPropName( UNO_NAME_PARA_RIGHT_MARGIN ).pName );
+        STR( GetPropName( UNO_NAME_TABSTOPS ).pName );
+#undef STR
+        DBG_ASSERT( i == pSeq->getLength(), "Please adjust length" );
+        if( i != pSeq->getLength() )
+            pSeq->realloc( i );
+        pNames = pSeq;
+    }
+    return *pNames;
+}
+//-----IAccessibility2 Implementation 2009
 //
 //=====  XInterface  =======================================================
 //
@@ -1083,6 +1439,19 @@
         aRet <<= aAccMultiLineText;
     }
     // <--
+	//IAccessibility2 Implementation 2009-----
+	//MSAA Extension Implementation in app  module
+    else if ( rType == ::getCppuType((uno::Reference<XAccessibleTextSelection> *)NULL) )
+    {
+        uno::Reference< com::sun::star::accessibility::XAccessibleTextSelection > aTextExtension = this;
+        aRet <<= aTextExtension;
+    }
+	else if ( rType == ::getCppuType((uno::Reference<XAccessibleExtendedAttributes> *)NULL) )
+    {
+		uno::Reference<XAccessibleExtendedAttributes> xAttr = this;
+        aRet <<= xAttr;
+    }
+	//-----IAccessibility2 Implementation 2009
     else
     {
         aRet = SwAccessibleContext::queryInterface(rType);
@@ -1207,6 +1576,270 @@
         throw lang::IndexOutOfBoundsException();
 }
 
+//IAccessibility2 Implementation 2009-----
+com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwAccessibleParagraph::GetCurrentTabStop( sal_Int32 nIndex  )
+{
+vos::OGuard aGuard(Application::GetSolarMutex());
+	CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+
+    
+    /*  #i12332# The position after the string needs special treatment. 
+        IsValidChar -> IsValidPosition
+    */
+    if( ! (IsValidPosition( nIndex, GetString().getLength() ) ) )
+        throw lang::IndexOutOfBoundsException();
+
+    /*  #i12332#  */
+    sal_Bool bBehindText = sal_False;
+    if ( nIndex == GetString().getLength() )
+        bBehindText = sal_True;
+
+    // get model position & prepare GetCharRect() arguments
+    SwCrsrMoveState aMoveState;
+    aMoveState.bRealHeight = sal_True;
+    aMoveState.bRealWidth = sal_True;
+    SwSpecialPos aSpecialPos;
+    SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+
+    sal_uInt16 nPos = 0;
+
+    /*  #i12332# FillSpecialPos does not accept nIndex ==
+         GetString().getLength(). In that case nPos is set to the
+         length of the string in the core. This way GetCharRect
+         returns the rectangle for a cursor at the end of the
+         paragraph. */
+    if (bBehindText)
+    {
+        nPos = pNode->GetTxt().Len();
+    }
+    else
+        nPos = GetPortionData().FillSpecialPos
+            (nIndex, aSpecialPos, aMoveState.pSpecialPos );
+    
+    // call GetCharRect
+    SwRect aCoreRect;
+    SwIndex aIndex( pNode, nPos );
+    SwPosition aPosition( *pNode, aIndex );
+    GetFrm()->GetCharRect( aCoreRect, aPosition, &aMoveState );
+
+	// already get the caret postion
+
+	//IAccessibility2 Implementation 2009-----
+	/*SwFrm* pTFrm = const_cast<SwFrm*>(GetFrm());
+	com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs = 
+		pTFrm->GetTabStopInfo(aCoreRect.Left());*/
+	
+	com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs;
+	const xub_StrLen nStrLen = GetTxtNode()->GetTxt().Len();
+	if( nStrLen > 0 )
+	{
+		SwFrm* pTFrm = const_cast<SwFrm*>(GetFrm());
+		tabs = pTFrm->GetTabStopInfo(aCoreRect.Left());
+	}
+	//-----IAccessibility2 Implementation 2009
+
+	if( tabs.hasElements() )
+	{
+		// translate core coordinates into accessibility coordinates
+		Window *pWin = GetWindow();
+		CHECK_FOR_WINDOW( XAccessibleComponent, pWin );
+
+		SwRect aTmpRect(0, 0, tabs[0].Position, 0);
+
+		Rectangle aScreenRect( GetMap()->CoreToPixel( aTmpRect.SVRect() ));
+        SwRect aFrmLogBounds( GetBounds( *(GetMap()) ) ); // twip rel to doc root
+
+		Point aFrmPixPos( GetMap()->CoreToPixel( aFrmLogBounds.SVRect() ).TopLeft() );
+		aScreenRect.Move( -aFrmPixPos.X(), -aFrmPixPos.Y() );
+
+		tabs[0].Position = aScreenRect.GetWidth();
+	}
+
+	return tabs;
+}
+
+struct IndexCompare
+{
+	const PropertyValue* pValues;
+	IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
+	bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
+	{
+		return (pValues[a].Name < pValues[b].Name) ? true : false;
+	}
+};
+//-----IAccessibility2 Implementation 2009
+
+String SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex)
+{
+	String strTypeName;
+	SwFldMgr aMgr;
+	SwTxtFld* pTxtFld = NULL;
+	SwTxtNode* pTxtNd = const_cast<SwTxtNode*>( GetTxtNode() );
+	SwIndex fldIndex( pTxtNd, nIndex );
+	sal_Int32 nFldIndex = GetPortionData().GetFieldIndex(nIndex);
+	if (nFldIndex >= 0)
+	{
+		const SwpHints* pSwpHints = GetTxtNode()->GetpSwpHints();
+		if (pSwpHints)
+		{	
+			const sal_uInt16  nSize = pSwpHints ? pSwpHints->Count() : 0;
+			for( sal_uInt16 i = 0; i < nSize; ++i ) 
+			{
+				const SwTxtAttr* pHt = (*pSwpHints)[i];
+				if (pHt->Which() == RES_TXTATR_FIELD && (nFldIndex-- == 0))
+				{
+					pTxtFld = (SwTxtFld *)pHt;
+					break;
+				}
+				else if (pHt->Which() == RES_TXTATR_REFMARK && (nFldIndex-- == 0))
+					strTypeName = String(OUString(RTL_CONSTASCII_USTRINGPARAM("set reference")));
+			}
+		}
+	}
+	if (pTxtFld)
+	{
+		const SwField* pField = (pTxtFld->GetFmtFld()).GetField();
+		if (pField)
+		{
+			strTypeName = pField->GetTyp()->GetTypeStr(pField->GetTypeId());
+			sal_uInt16 nWhich = pField->GetTyp()->Which();
+			rtl::OUString sEntry;
+			sal_Int32 subType = 0;
+			switch (nWhich)
+			{
+			case RES_DOCSTATFLD:
+				subType = ((SwDocStatField*)pField)->GetSubType();
+				break;
+			case RES_GETREFFLD:
+				{
+					sal_uInt16 nSub = pField->GetSubType();
+					switch( nSub )
+					{
+					case REF_BOOKMARK:
+						{
+							const SwGetRefField* pRefFld = dynamic_cast<const SwGetRefField*>(pField);
+							if ( pRefFld && pRefFld->IsRefToHeadingCrossRefBookmark() )
+								sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Headings"));
+							else if ( pRefFld && pRefFld->IsRefToNumItemCrossRefBookmark() )
+								sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Numbered Paragraphs"));
+							else
+								sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Bookmarks"));
+						}
+						break;
+					case REF_FOOTNOTE:
+						sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Footnotes"));
+						break;
+					case REF_ENDNOTE:
+						sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Endnotes"));
+						break;
+					case REF_SETREFATTR:
+						sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Insert Reference"));
+						break;
+					case REF_SEQUENCEFLD:
+						sEntry = ((SwGetRefField*)pField)->GetSetRefName();
+						break;
+					}
+					//Get format string
+					strTypeName = sEntry;
+                    // <pField->GetFormat() >= 0> is always true as <pField->GetFormat()> is unsigned
+//                    if (pField->GetFormat() >= 0)
+					{
+						sEntry = aMgr.GetFormatStr( pField->GetTypeId(), pField->GetFormat() );
+						if (sEntry.getLength() > 0)
+						{
+							strTypeName.AppendAscii("-");
+							strTypeName += String(sEntry);
+						}
+					}
+				}
+				break;
+			case RES_DATETIMEFLD:
+				subType = ((SwDateTimeField*)pField)->GetSubType();
+				break;
+			case RES_JUMPEDITFLD: 
+				{
+					sal_uInt16 nFormat= pField->GetFormat();
+					sal_uInt16 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+					if (nFormat < nSize)
+					{
+						sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nFormat);
+						if (sEntry.getLength() > 0)
+						{
+							strTypeName.AppendAscii("-");
+							strTypeName += String(sEntry);
+						}
+					}
+				}
+				break;
+			case RES_EXTUSERFLD:
+				subType = ((SwExtUserField*)pField)->GetSubType();
+				break;
+			case RES_HIDDENTXTFLD:
+			case RES_SETEXPFLD:
+				{
+					sEntry = pField->GetTyp()->GetName();
+					if (sEntry.getLength() > 0)
+					{
+						strTypeName.AppendAscii("-");
+						strTypeName += String(sEntry);
+					}
+				}
+				break;
+			case RES_DOCINFOFLD:
+				subType = pField->GetSubType();
+				subType &= 0x00ff;
+				break;
+			case RES_REFPAGESETFLD:
+				{
+					SwRefPageSetField* pRPld = (SwRefPageSetField*)pField;
+					sal_Bool bOn = pRPld->IsOn();
+					strTypeName.AppendAscii("-");
+					if (bOn)
+						strTypeName += String(OUString(RTL_CONSTASCII_USTRINGPARAM("on")));
+					else
+						strTypeName += String(OUString(RTL_CONSTASCII_USTRINGPARAM("off")));
+				}
+				break;
+			case RES_AUTHORFLD:
+				{
+					strTypeName.AppendAscii("-");
+					strTypeName += aMgr.GetFormatStr(pField->GetTypeId(), pField->GetFormat() & 0xff);
+				}
+				break;
+			}
+			if (subType > 0 || (subType == 0 && (nWhich == RES_DOCINFOFLD || nWhich == RES_EXTUSERFLD || nWhich == RES_DOCSTATFLD)))
+			{
+				SvStringsDtor aLst;
+				aMgr.GetSubTypes(pField->GetTypeId(), aLst);
+				if (subType < aLst.Count())
+					sEntry = *aLst[subType];
+				if (sEntry.getLength() > 0)
+				{
+					if (nWhich == RES_DOCINFOFLD)
+					{
+						strTypeName = String(sEntry);
+						sal_uInt32 nSize = aMgr.GetFormatCount(pField->GetTypeId(), sal_False);
+						sal_uInt16 nExSub = pField->GetSubType() & 0xff00;
+						if (nSize > 0 && nExSub > 0)
+						{
+							//Get extra subtype string
+							strTypeName.AppendAscii("-");
+							sEntry = aMgr.GetFormatStr(pField->GetTypeId(), nExSub/0x0100-1);
+							strTypeName += String(sEntry);
+						}
+					}
+					else
+					{
+						strTypeName.AppendAscii("-");
+						strTypeName += String(sEntry);
+					}
+				}
+			}
+		}
+	}
+	return strTypeName;
+}
 // --> OD 2006-07-20 #i63870#
 // re-implement method on behalf of methods <_getDefaultAttributesImpl(..)> and
 // <_getRunAttributesImpl(..)>
@@ -1221,16 +1854,24 @@
 
     const ::rtl::OUString& rText = GetString();
 
-    if( ! IsValidChar( nIndex, rText.getLength() ) )
+    if( ! IsValidChar( nIndex, rText.getLength()+1 ) )//IAccessibility2 Implementation 2009
         throw lang::IndexOutOfBoundsException();
 
+	//IAccessibility2 Implementation 2009-----
+	bool bSupplementalMode = false;
+    uno::Sequence< ::rtl::OUString > aNames = aRequestedAttributes;
+	if (aNames.getLength() == 0)
+	{
+		bSupplementalMode = true;
+		aNames = getAttributeNames();
+	}
     // retrieve default character attributes
     tAccParaPropValMap aDefAttrSeq;
-    _getDefaultAttributesImpl( aRequestedAttributes, aDefAttrSeq, true );
+    _getDefaultAttributesImpl( aNames, aDefAttrSeq, true );
 
     // retrieved run character attributes
     tAccParaPropValMap aRunAttrSeq;
-    _getRunAttributesImpl( nIndex, aRequestedAttributes, aRunAttrSeq );
+    _getRunAttributesImpl( nIndex, aNames, aRunAttrSeq );
 
     // merge default and run attributes
     uno::Sequence< PropertyValue > aValues( aDefAttrSeq.size() );
@@ -1252,6 +1893,70 @@
         }
         ++i;
     }
+	if( bSupplementalMode )
+	{
+        uno::Sequence< ::rtl::OUString > aSupplementalNames = aRequestedAttributes;
+		if (aSupplementalNames.getLength() == 0)
+			aSupplementalNames = getSupplementalAttributeNames();
+
+		tAccParaPropValMap aSupplementalAttrSeq;
+		_getSupplementalAttributesImpl( nIndex, aSupplementalNames, aSupplementalAttrSeq );
+
+		aValues.realloc( aValues.getLength() + aSupplementalAttrSeq.size() );
+		pValues = aValues.getArray();
+
+		for ( tAccParaPropValMap::const_iterator aSupplementalIter = aSupplementalAttrSeq.begin();
+			aSupplementalIter != aSupplementalAttrSeq.end();
+			++aSupplementalIter )
+		{
+			pValues[i] = aSupplementalIter->second;
+			++i;
+		}
+	
+		_correctValues( nIndex, aValues );
+
+		aValues.realloc( aValues.getLength() + 1 );
+
+		pValues = aValues.getArray();
+
+		const SwTxtNode* pTxtNode( GetTxtNode() );
+		PropertyValue& rValue = pValues[aValues.getLength() - 1 ];
+		rValue.Name = OUString::createFromAscii("NumberingPrefix");
+		OUString sNumBullet = pTxtNode->GetNumString();
+		rValue.Value <<= sNumBullet;
+		rValue.Handle = -1;
+		rValue.State = PropertyState_DIRECT_VALUE;
+
+		String strTypeName = GetFieldTypeNameAtIndex(nIndex);
+		if (strTypeName.Len() > 0)
+		{		
+			aValues.realloc( aValues.getLength() + 1 );
+			pValues = aValues.getArray();
+			rValue = pValues[aValues.getLength() - 1];
+			rValue.Name = OUString::createFromAscii("FieldType");
+			rValue.Value <<= rtl::OUString(strTypeName.ToLowerAscii());
+			rValue.Handle = -1;
+			rValue.State = PropertyState_DIRECT_VALUE;
+		}
+
+		//sort property values
+		// build sorted index array
+		sal_Int32 nLength = aValues.getLength();
+		const PropertyValue* pPairs = aValues.getConstArray();
+		sal_Int32* pIndices = new sal_Int32[nLength];
+		for( i = 0; i < nLength; i++ )
+			pIndices[i] = i;
+		sort( &pIndices[0], &pIndices[nLength], IndexCompare(pPairs) );
+		// create sorted sequences accoring to index array
+        uno::Sequence<PropertyValue> aNewValues( nLength );
+		PropertyValue* pNewValues = aNewValues.getArray();
+		for( i = 0; i < nLength; i++ )
+		{
+			pNewValues[i] = pPairs[pIndices[i]];
+		}
+		delete[] pIndices; 
+		return aNewValues;
+	}
 
 //    // create a (dummy) text portion for the sole purpose of calling
 //    // getPropertyValues on it
@@ -1670,6 +2375,308 @@
     return aValues;
 }
 // <--
+// IAccessibility2 Implementation 2009----
+void SwAccessibleParagraph::_getSupplementalAttributesImpl(
+        const sal_Int32,
+        const uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+        tAccParaPropValMap& rSupplementalAttrSeq )
+{
+	const SwTxtNode* pTxtNode( GetTxtNode() );
+	::boost::scoped_ptr<SfxItemSet> pSet;
+	pSet.reset( new SfxItemSet( const_cast<SwAttrPool&>(pTxtNode->GetDoc()->GetAttrPool()),
+		RES_PARATR_ADJUST, RES_PARATR_ADJUST,
+		RES_PARATR_TABSTOP, RES_PARATR_TABSTOP,
+		RES_PARATR_LINESPACING, RES_PARATR_LINESPACING,
+		RES_UL_SPACE, RES_UL_SPACE,
+		RES_LR_SPACE, RES_LR_SPACE,
+		RES_PARATR_NUMRULE, RES_PARATR_NUMRULE,
+		RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END-1,
+		0 ) );
+
+	if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+	{
+		pSet->Put( pTxtNode->GetAttr(RES_PARATR_LIST_LEVEL, RES_PARATR_LIST_LEVEL) );
+	}
+	pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_UL_SPACE) );
+	pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_LR_SPACE) );
+	pSet->Put( pTxtNode->SwCntntNode::GetAttr(RES_PARATR_ADJUST) );
+
+	tAccParaPropValMap aSupplementalAttrSeq;
+    {
+//        const SfxItemPropertySet& rPropSet =
+//                    aSwMapProvider.GetPropertyMap( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE );
+//        const SfxItemPropertyMap* pPropMap( rPropSet.getPropertyMap() );
+        const SfxItemPropertyMapEntry* pPropMap( 
+                aSwMapProvider.GetPropertyMapEntries( PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE ) );
+        while ( pPropMap->pName )
+        {
+            const SfxPoolItem* pItem = pSet->GetItem( pPropMap->nWID );
+            if ( pItem )
+            {
+                uno::Any aVal;
+                pItem->QueryValue( aVal, pPropMap->nMemberId );
+
+                PropertyValue rPropVal;
+                rPropVal.Name = OUString::createFromAscii( pPropMap->pName );
+                rPropVal.Value = aVal;
+                rPropVal.Handle = -1;
+                rPropVal.State = beans::PropertyState_DEFAULT_VALUE;
+
+                aSupplementalAttrSeq[rPropVal.Name] = rPropVal;
+            }
+
+            ++pPropMap;
+        }
+	}
+
+	const OUString* pSupplementalAttrs = aRequestedAttributes.getConstArray();
+	const sal_Int32 nSupplementalLength = aRequestedAttributes.getLength();
+	
+	for( sal_Int32 index = 0; index < nSupplementalLength; ++index )
+	{
+		tAccParaPropValMap::const_iterator const aIter = aSupplementalAttrSeq.find( pSupplementalAttrs[index] );
+		if ( aIter != aSupplementalAttrSeq.end() )
+		{
+			rSupplementalAttrSeq[ aIter->first ] = aIter->second;
+		}
+	}	
+}
+
+void SwAccessibleParagraph::_correctValues( const sal_Int32 nIndex,
+										   uno::Sequence< PropertyValue >& rValues)
+{
+	PropertyValue ChangeAttr, ChangeAttrColor;
+
+	const SwRedline* pRedline = GetRedlineAtIndex( nIndex );
+	if ( pRedline )
+	{
+
+		const SwModuleOptions *pOpt = SW_MOD()->GetModuleConfig();
+		AuthorCharAttr aChangeAttr;
+		if ( pOpt )
+		{
+			switch( pRedline->GetType())
+			{
+			case nsRedlineType_t::REDLINE_INSERT:
+				aChangeAttr = pOpt->GetInsertAuthorAttr();
+				break;
+			case nsRedlineType_t::REDLINE_DELETE:
+				aChangeAttr = pOpt->GetDeletedAuthorAttr();
+				break;
+			case nsRedlineType_t::REDLINE_FORMAT:
+				aChangeAttr = pOpt->GetFormatAuthorAttr();
+				break;
+			}
+		}
+		switch( aChangeAttr.nItemId )
+		{
+		case SID_ATTR_CHAR_WEIGHT:
+			ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_WEIGHT).pName );
+			ChangeAttr.Value <<= awt::FontWeight::BOLD;
+			break;
+		case SID_ATTR_CHAR_POSTURE:
+			ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_POSTURE).pName );
+			ChangeAttr.Value <<= awt::FontSlant_ITALIC; //char posture
+			break;
+		case SID_ATTR_CHAR_STRIKEOUT:
+			ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_STRIKEOUT).pName );
+			ChangeAttr.Value <<= awt::FontStrikeout::SINGLE; //char strikeout
+			break;
+		case SID_ATTR_CHAR_UNDERLINE:
+			ChangeAttr.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE).pName );
+			ChangeAttr.Value <<= aChangeAttr.nAttr; //underline line
+			break;
+		}
+		if( aChangeAttr.nColor != COL_NONE )
+		{
+			if( aChangeAttr.nItemId == SID_ATTR_BRUSH )
+			{
+				ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR).pName );
+				if( aChangeAttr.nColor == COL_TRANSPARENT )//char backcolor					
+					ChangeAttrColor.Value <<= COL_BLUE;
+				else
+					ChangeAttrColor.Value <<= aChangeAttr.nColor;
+			}
+			else
+			{
+				ChangeAttrColor.Name = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName );
+				if( aChangeAttr.nColor == COL_TRANSPARENT )//char color
+					ChangeAttrColor.Value <<= COL_BLUE;
+				else
+					ChangeAttrColor.Value <<= aChangeAttr.nColor;
+			}
+		}
+	}
+
+	PropertyValue* pValues = rValues.getArray();
+
+	const SwTxtNode* pTxtNode( GetTxtNode() );
+
+	sal_Int32 nValues = rValues.getLength();
+	for (sal_Int32 i = 0;  i < nValues;  ++i)
+	{
+		PropertyValue& rValue = pValues[i];
+
+		if (rValue.Name.compareTo( ChangeAttr.Name )==0)
+		{
+			rValue.Value = ChangeAttr.Value;
+			continue;
+		}
+
+		if (rValue.Name.compareTo( ChangeAttrColor.Name )==0)
+		{
+			rValue.Value = ChangeAttr.Value;
+			continue;
+		}
+
+		//back color
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_BACK_COLOR ).pName ) )==0)
+		{
+			uno::Any &anyChar = rValue.Value;
+			sal_uInt32 crBack = (sal_uInt32)(anyChar.pReserved);
+			if (COL_AUTO == crBack)
+			{
+                uno::Reference<XAccessibleComponent> xComponent(this);
+				if (xComponent.is())
+				{
+					crBack = (sal_uInt32)xComponent->getBackground();
+				}
+				rValue.Value <<= crBack;
+			}
+			continue;
+		}
+
+		//char color
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_COLOR ).pName ) )==0)
+		{				
+			if( GetPortionData().IsInGrayPortion( nIndex ) )
+				 rValue.Value <<= SwViewOption::GetFieldShadingsColor().GetColor();
+			uno::Any &anyChar = rValue.Value;
+			sal_uInt32 crChar = (sal_uInt32)(anyChar.pReserved);
+
+			if( COL_AUTO == crChar )
+			{
+                uno::Reference<XAccessibleComponent> xComponent(this);
+				if (xComponent.is())
+				{
+					Color cr(xComponent->getBackground());
+					crChar = cr.IsDark() ? COL_WHITE : COL_BLACK;
+					rValue.Value <<= crChar;
+				}
+			}			
+			continue;
+		}
+
+		// UnderLine
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE ).pName ) )==0)
+		{
+			//misspelled word
+			SwCrsrShell* pCrsrShell = GetCrsrShell();
+			if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+			{
+				const SwWrongList* pWrongList = pTxtNode->GetWrong();
+				if( NULL != pWrongList )
+				{
+					xub_StrLen nBegin = nIndex;
+					xub_StrLen nLen = 1;
+					if(	pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+					{
+						rValue.Value <<= (sal_uInt16)UNDERLINE_WAVE;	
+					}
+				}
+			}
+			continue;
+		}
+
+		// UnderLineColor
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_UNDERLINE_COLOR ).pName ) )==0)
+		{
+			//misspelled word
+			SwCrsrShell* pCrsrShell = GetCrsrShell();
+			if( pCrsrShell != NULL && pCrsrShell->GetViewOptions() && pCrsrShell->GetViewOptions()->IsOnlineSpell())
+			{
+				const SwWrongList* pWrongList = pTxtNode->GetWrong();
+				if( NULL != pWrongList )
+				{
+					xub_StrLen nBegin = nIndex;
+					xub_StrLen nLen = 1;
+					if(	pWrongList->InWrongWord(nBegin,nLen) && !pTxtNode->IsSymbol(nBegin) )
+					{				
+						rValue.Value <<= (sal_Int32)0x00ff0000;
+						continue;
+					}
+				}
+			}
+
+			uno::Any &anyChar = rValue.Value;
+			sal_uInt32 crUnderline = (sal_uInt32)(anyChar.pReserved);
+			if ( COL_AUTO == crUnderline )	
+			{
+                uno::Reference<XAccessibleComponent> xComponent(this);
+				if (xComponent.is())
+				{
+					Color cr(xComponent->getBackground());
+					crUnderline = cr.IsDark() ? COL_WHITE : COL_BLACK;
+					rValue.Value <<= crUnderline;
+				}
+			}
+
+			continue;
+		}
+
+		//tab stop
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_TABSTOPS ).pName ) )==0)
+		{
+			com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs = GetCurrentTabStop( nIndex );
+			if( !tabs.hasElements() )
+			{
+				tabs.realloc(1);
+				::com::sun::star::style::TabStop ts;
+				com::sun::star::awt::Rectangle rc0 = getCharacterBounds(0);
+				com::sun::star::awt::Rectangle rc1 = getCharacterBounds(nIndex);
+				if( rc1.X - rc0.X >= 48 )
+					ts.Position = (rc1.X - rc0.X) - (rc1.X - rc0.X - 48)% 47 + 47;
+				else
+					ts.Position = 48;			
+				ts.DecimalChar = ' ';
+				ts.FillChar = ' ';
+				ts.Alignment = ::com::sun::star::style::TabAlign_LEFT;
+				tabs[0] = ts;
+			}
+			rValue.Value <<= tabs;
+			continue;
+		}
+
+		//number bullet
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_NUMBERING_RULES ).pName ) )==0)
+		{
+			if ( pTxtNode->HasBullet() || pTxtNode->HasNumber() )
+			{
+                uno::Any aVal;
+				SwNumRule* pNumRule = pTxtNode->GetNumRule();
+				if (pNumRule)
+				{
+                    uno::Reference< container::XIndexReplace >  xNum = new SwXNumberingRules(*pNumRule);
+                    aVal.setValue(&xNum, ::getCppuType((const uno::Reference< container::XIndexReplace >*)0));
+				}
+				rValue.Value <<= aVal;
+			}
+			continue;
+		}
+
+		//footnote & endnote
+		if (rValue.Name.compareTo(::rtl::OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName ) )==0)
+		{
+			if ( GetPortionData().IsIndexInFootnode(nIndex) )
+			{
+				const OUString sEscapmentName = OUString::createFromAscii( GetPropName( UNO_NAME_CHAR_ESCAPEMENT ).pName );
+				rValue.Value <<= (sal_Int32)101;
+			}
+			continue;
+		}
+	}
+}
+//-----IAccessibility2 Implementation 2009
 
 awt::Rectangle SwAccessibleParagraph::getCharacterBounds(
     sal_Int32 nIndex )
@@ -1972,6 +2979,12 @@
     /*accessibility::*/TextSegment aResult;
     aResult.SegmentStart = -1;
     aResult.SegmentEnd = -1;
+	//IAccessibility2 Implementation 2009-----
+	//If nIndex = 0, then nobefore text so return -1 directly. 
+    if( nIndex == 0 )
+        	return aResult;
+	//Tab will be return when call WORDTYPE
+	//-----IAccessibility2 Implementation 2009
 
     // get starting pos
     i18n::Boundary aBound;
@@ -1986,22 +2999,47 @@
     }
 
     // now skip to previous word
-    sal_Bool bWord = sal_False;
-    while( !bWord )
-    {
-        nIndex = min( nIndex, aBound.startPos ) - 1;
-        if( nIndex >= 0 )
-            bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
-        else
-            break;  // exit if beginning of string is reached
-    }
-
-    if ( bWord )
-    {
-    	aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
-    	aResult.SegmentStart = aBound.startPos;
-    	aResult.SegmentEnd = aBound.endPos;
-    };
+	//IAccessibility2 Implementation 2009-----
+	if (nTextType==2 || nTextType == 3)
+	{
+        i18n::Boundary preBound = aBound;
+		while(preBound.startPos==aBound.startPos && nIndex > 0)
+		{
+			nIndex = min( nIndex, preBound.startPos ) - 1;
+			if( nIndex < 0 ) break;
+			GetTextBoundary( preBound, rText, nIndex, nTextType );
+		}
+		//if (nIndex>0)
+		if (nIndex>=0)
+		//Tab will be return when call WORDTYPE
+		{
+			aResult.SegmentText = rText.copy( preBound.startPos, preBound.endPos - preBound.startPos );
+			aResult.SegmentStart = preBound.startPos;
+			aResult.SegmentEnd = preBound.endPos;
+		}
+	}
+	else
+	{
+		sal_Bool bWord = sal_False;
+		while( !bWord )
+		{
+			nIndex = min( nIndex, aBound.startPos ) - 1;
+			if( nIndex >= 0 )
+			{
+				bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+			}
+			else
+				break;  // exit if beginning of string is reached
+		}
+		
+		if (bWord && nIndex<rText.getLength())
+		{
+			aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+			aResult.SegmentStart = aBound.startPos;
+			aResult.SegmentEnd = aBound.endPos;
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
     return aResult;
 }
 
@@ -2042,6 +3080,66 @@
     	aResult.SegmentStart = aBound.startPos;
     	aResult.SegmentEnd = aBound.endPos;
     }
+
+/*
+        //IAccessibility2 Implementation 2009-----
+        sal_Bool bWord = sal_False;
+    bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+
+        if (nTextType==2)
+        {
+                Boundary nexBound=aBound;
+
+		// real current word
+		if( nIndex <= aBound.endPos && nIndex >= aBound.startPos )
+		{			
+			while(nexBound.endPos==aBound.endPos&&nIndex<rText.getLength())
+			{
+				// nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) + 1;
+				nIndex = max( (sal_Int32)(nIndex), nexBound.endPos) ;
+				const sal_Unicode* pStr = rText.getStr();
+				if (pStr)
+				{
+					if( pStr[nIndex] == sal_Unicode(' ') ) 
+						nIndex++;
+				}
+				if( nIndex < rText.getLength() )
+				{
+					bWord = GetTextBoundary( nexBound, rText, nIndex, nTextType );
+				}
+			}
+		}
+
+		if (bWord && nIndex<rText.getLength())
+		{
+			aResult.SegmentText = rText.copy( nexBound.startPos, nexBound.endPos - nexBound.startPos );
+			aResult.SegmentStart = nexBound.startPos;
+			aResult.SegmentEnd = nexBound.endPos;
+		}
+		
+	}
+	else
+	{
+		bWord = sal_False;
+		while( !bWord )
+		{
+			nIndex = max( (sal_Int32)(nIndex+1), aBound.endPos );
+			if( nIndex < rText.getLength() )
+			{
+				bWord = GetTextBoundary( aBound, rText, nIndex, nTextType );
+			}
+			else
+				break;  // exit if end of string is reached
+		}
+		if (bWord && nIndex<rText.getLength())
+		{
+			aResult.SegmentText = rText.copy( aBound.startPos, aBound.endPos - aBound.startPos );
+			aResult.SegmentStart = aBound.startPos;
+			aResult.SegmentEnd = aBound.endPos;
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
+*/
     return aResult;
 }
 
@@ -2154,16 +3252,6 @@
         throw lang::IndexOutOfBoundsException();
 }
 
-struct IndexCompare
-{
-    const PropertyValue* pValues;
-    IndexCompare( const PropertyValue* pVals ) : pValues(pVals) {}
-    bool operator() ( const sal_Int32& a, const sal_Int32& b ) const
-    {
-        return (pValues[a].Name < pValues[b].Name) ? true : false;
-    }
-};
-
 
 sal_Bool SwAccessibleParagraph::setAttributes(
     sal_Int32 nStartIndex,
@@ -2369,6 +3457,16 @@
 			nCount++;
 	}
 
+	//IAccessibility2 Implementation 2009-----
+	/* Can't fin the function "GetTOCFirstWordEndIndex" declaration in sym2.0 (Added by yanjun)
+	if( GetTOXSortTabBase()  )
+	{
+		SwTxtNode* pNode = const_cast<SwTxtNode*>(GetTxtNode());	
+		if(pNode && pNode->GetTOCFirstWordEndIndex() > 0)
+			nCount++; 
+	}
+	*/
+	//-----IAccessibility2 Implementation 2009
 	return nCount;
 }
 
@@ -2383,8 +3481,163 @@
 
     // --> OD 2007-06-27 #i77108# - provide hyperlinks also in editable documents.
 //    if( !IsEditableState() )
-    // <--
+	const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
+	SwHyperlinkIter_Impl aHIter( pTxtFrm );
+	//SwAccessibleAutoRecognizerHelper_Impl aARHelper( pTxtFrm );
+	sal_Int32 nARCount = 0;
+	sal_Int32 nARIndex = 0;
+	sal_Int32 nTIndex = -1;
+	sal_Int32 nTOCEndIndex = -1;
+	SwTxtNode* pNode = NULL;
+	SwTOXSortTabBase* pTBase = GetTOXSortTabBase();
+	if( pTBase )
 	{
+		pNode = const_cast<SwTxtNode*>(GetTxtNode());
+	}
+	nTOCEndIndex = -1;
+	//if(pNode)
+	//	nTOCEndIndex = pNode->GetTOCFirstWordEndIndex();
+	SwTxtAttr* pHt = (SwTxtAttr*)(aHIter.next());
+	while( (nLinkIndex < getHyperLinkCount()) && nTIndex < nLinkIndex)
+	{
+		// no candidates, exit
+		//if( (!pHt) && (nARIndex >= nARCount) && nTOCEndIndex <= 0)
+		//	break;
+
+		sal_Int32 nHStt = -1;
+		sal_Int32 nAStt = -1;
+		sal_Bool bH = sal_False;
+		sal_Bool bA = sal_False;
+
+
+		if( pHt )
+			nHStt = *pHt->GetStart();
+		if( nARIndex < nARCount )
+		{
+			/*
+			sal_Int32 nAEnd;
+			aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+			*/
+		}
+		sal_Bool bTOC = sal_False;		
+		// Inside TOC & get the first link
+		if( pTBase && nTIndex == -1 )
+		{
+			nTIndex++;
+			bTOC = sal_True;
+		}
+		else
+		{		
+			if( nHStt >=0 && nAStt >=0 )
+			{	// both hyperlink and smart tag available
+				nTIndex++;
+				if( nHStt <= nAStt )
+					bH = sal_True;
+				else
+					bA = sal_True;
+			}
+			else if( nHStt >= 0 )
+			{	// only hyperlink available
+				nTIndex++;
+				bH = sal_True;
+			}
+			else if( nAStt >= 0 )
+			{	// only smart tag available
+				nTIndex++;
+				bA = sal_True;
+			}
+		}
+
+		if( nTIndex == nLinkIndex )
+		{	// found
+			if( bH )
+			{	// it's a hyperlink
+				if( pHt )
+				{
+//                    const SwField* pFFld = pHt->GetFld().GetFld();
+                    {
+						if( !pHyperTextData )
+							pHyperTextData = new SwAccessibleHyperTextData;
+						SwAccessibleHyperTextData::iterator aIter = 
+							pHyperTextData ->find( pHt );
+						if( aIter != pHyperTextData->end() )
+						{
+							xRet = (*aIter).second;
+						}
+						if( !xRet.is() )
+						{
+                            {    
+                                const sal_Int32 nTmpHStt= GetPortionData().GetAccessiblePosition( 
+                                    max( aHIter.startIdx(), *pHt->GetStart() ) );
+                                const sal_Int32 nTmpHEnd= GetPortionData().GetAccessiblePosition( 
+                                    min( aHIter.endIdx(), *pHt->GetAnyEnd() ) );
+                                xRet = new SwAccessibleHyperlink( aHIter.getCurrHintPos(), 
+                                    this, nTmpHStt, nTmpHEnd );
+                            }
+							if( aIter != pHyperTextData->end() )
+							{
+								(*aIter).second = xRet;
+							}
+							else
+							{
+								SwAccessibleHyperTextData::value_type aEntry( pHt, xRet );
+								pHyperTextData->insert( aEntry );
+							}
+						}
+					}
+				}
+			}
+			else if( bTOC )
+			{
+				//xRet = new SwAccessibleTOCLink( this );
+			}
+			else if( bA )
+			{
+				/*
+				// it's a smart tag
+				if( !pAutoRecognizerData )
+					pAutoRecognizerData = new SwAccessibleAutoRecognizerData;
+				SwAccessibleAutoRecognizerData::iterator aIter = 
+					pAutoRecognizerData ->find( nARIndex );
+				if( aIter != pAutoRecognizerData->end() )
+				{
+					xRet = (*aIter).second;
+				}
+				if( !xRet.is() )
+				{
+					sal_Int32 nAStt = 0;
+					sal_Int32 nAEnd = 0;
+					//aARHelper.getPosition( nARIndex, nAStt, nAEnd );
+					xRet = new SwAccessibleAutoRecognizer( this, nAStt, nAEnd );
+					if( aIter != pAutoRecognizerData->end() )
+					{
+						(*aIter).second = xRet;
+					}
+					else
+					{
+						SwAccessibleAutoRecognizerData::value_type aEntry( nARIndex, xRet );
+						pAutoRecognizerData->insert( aEntry );
+					}
+				}
+				*/
+			}
+			break;
+		}
+
+		// iterate next
+		if( bH )
+			// iterate next hyperlink
+			pHt = (SwTxtAttr*)(aHIter.next());
+		else if( bA )
+			// iterate next smart tag
+			nARIndex++;
+		else if(bTOC)
+			continue;
+		else
+			// no candidate, exit
+			break;
+	}
+	/*
 		const SwTxtFrm *pTxtFrm = static_cast<const SwTxtFrm*>( GetFrm() );
 		SwHyperlinkIter_Impl aHIter( pTxtFrm );
 		while( nLinkIndex-- )
@@ -2421,7 +3674,7 @@
 			}
 		}
 	}
-
+	*/
 	if( !xRet.is() )
         throw lang::IndexOutOfBoundsException();
 
@@ -2460,10 +3713,23 @@
 
 		if( pHt )
 			nRet = nPos;
-
 	}
+	//IAccessibility2 Implementation 2009-----
+	/* Added by yanjun for acc miagration
+	if( nRet == -1 && GetTOXSortTabBase() )
+	{
+		SwTxtNode* pNode = const_cast<SwTxtNode*>(GetTxtNode());	
+		if( nCharIndex >= 0 && nCharIndex < pNode->GetTOCFirstWordEndIndex())
+			nRet = 0;
+	}
+	*/
 
-	return nRet;
+	if (nRet == -1)
+		throw lang::IndexOutOfBoundsException();
+	else
+		return nRet;
+	//return nRet;
+	//-----IAccessibility2 Implementation 2009
 }
 
 // --> OD 2008-05-26 #i71360#
@@ -2492,6 +3758,203 @@
 
     return pTextMarkupHelper->getTextMarkupCount( nTextMarkupType );
 }
+//IAccessibility2 Implementation 2009-----
+//MSAA Extension Implementation in app  module
+sal_Bool SAL_CALL SwAccessibleParagraph::scrollToPosition( const ::com::sun::star::awt::Point&, sal_Bool )
+	throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
+{
+	return sal_False;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSelectedPortionCount(  ) 
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 nSeleted = 0;
+	SwPaM* pCrsr = GetCursor( true );
+    if( pCrsr != NULL )
+    {
+        // get SwPosition for my node
+        const SwTxtNode* pNode = GetTxtNode();
+        sal_uLong nHere = pNode->GetIndex();
+
+        // iterate over ring
+        SwPaM* pRingStart = pCrsr;
+        do
+        {
+            // ignore, if no mark
+            if( pCrsr->HasMark() )
+            {
+                // check whether nHere is 'inside' pCrsr
+                SwPosition* pStart = pCrsr->Start();
+                sal_uLong nStartIndex = pStart->nNode.GetIndex();
+                SwPosition* pEnd = pCrsr->End();
+                sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+                if( ( nHere >= nStartIndex ) &&
+                    ( nHere <= nEndIndex )      )
+                {
+					nSeleted++;
+                }
+                // else: this PaM doesn't point to this paragraph
+            }
+            // else: this PaM is collapsed and doesn't select anything
+
+            // next PaM in ring
+            pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+        }
+        while( pCrsr != pRingStart );
+    }
+	return nSeleted;
+    
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+	sal_Int32 nStart, nEnd;
+    /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+	return nStart;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex ) 
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+	sal_Int32 nStart, nEnd;
+    /*sal_Bool bSelected = */GetSelectionAtIndex(nSelectedPortionIndex, nStart, nEnd );
+	return nEnd;
+}
+
+sal_Bool SAL_CALL SwAccessibleParagraph::removeSelection( sal_Int32 selectionIndex )
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	if(selectionIndex < 0) return sal_False;
+
+    sal_Bool bRet = sal_False;
+	sal_Int32 nSelected = selectionIndex;
+
+    // get the selection, and test whether it affects our text node
+	SwPaM* pCrsr = GetCursor( true );
+//  SwPaM* pFirst = pCrsr;
+	SwPaM* pPrev = pCrsr;
+
+    if( pCrsr != NULL )
+    {
+        // get SwPosition for my node
+        const SwTxtNode* pNode = GetTxtNode();
+        sal_uLong nHere = pNode->GetIndex();
+
+        // iterate over ring
+        SwPaM* pRingStart = pCrsr;
+        do
+        {
+            // ignore, if no mark
+            if( pCrsr->HasMark() )
+            {
+                // check whether nHere is 'inside' pCrsr
+                SwPosition* pStart = pCrsr->Start();
+                sal_uLong nStartIndex = pStart->nNode.GetIndex();
+                SwPosition* pEnd = pCrsr->End();
+                sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+                if( ( nHere >= nStartIndex ) &&
+                    ( nHere <= nEndIndex )      )
+                {
+					if( nSelected == 0 )
+					{
+						pCrsr->MoveTo((Ring*)0);
+						delete pCrsr;
+						bRet = sal_True;
+					}
+					else
+					{
+						nSelected--;
+					}
+				}
+			}
+            // else: this PaM is collapsed and doesn't select anything
+		   pPrev = pCrsr;
+           pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+        }
+        while( !bRet && (pCrsr != pRingStart) );
+	}
+	return sal_True;
+}
+
+sal_Int32 SAL_CALL SwAccessibleParagraph::addSelection( sal_Int32, sal_Int32 startOffset, sal_Int32 endOffset)
+	throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+	vos::OGuard aGuard(Application::GetSolarMutex());
+
+	CHECK_FOR_DEFUNC_THIS( XAccessibleText, *this );
+
+    // parameter checking
+    sal_Int32 nLength = GetString().getLength();
+    if ( ! IsValidRange( startOffset, endOffset, nLength ) )
+    {
+        throw lang::IndexOutOfBoundsException();
+    }
+
+	sal_Int32 nSelectedCount = getSelectedPortionCount();
+	for ( sal_Int32 i = nSelectedCount ; i >= 0 ; i--)
+	{
+		sal_Int32 nStart, nEnd;
+		sal_Bool bSelected = GetSelectionAtIndex(i, nStart, nEnd );
+		if(bSelected)
+		{
+			if(nStart <= nEnd )
+			{
+				if (( startOffset>=nStart && startOffset <=nEnd ) ||     //startOffset in a selection
+			   		( endOffset>=nStart && endOffset <=nEnd )     ||  //endOffset in a selection
+					( startOffset <= nStart && endOffset >=nEnd)  ||       //start and  end include the old selection
+					( startOffset >= nStart && endOffset <=nEnd) )
+				{
+					removeSelection(i);
+				}
+				
+			}
+			else
+			{
+				if (( startOffset>=nEnd && startOffset <=nStart ) ||     //startOffset in a selection
+			   		( endOffset>=nEnd && endOffset <=nStart )     || //endOffset in a selection
+					( startOffset <= nStart && endOffset >=nEnd)  ||       //start and  end include the old selection
+					( startOffset >= nStart && endOffset <=nEnd) )
+
+				{
+					removeSelection(i);
+				}
+			}
+		}
+
+	}
+
+    sal_Bool bRet = sal_False;
+
+    // get cursor shell
+    SwCrsrShell* pCrsrShell = GetCrsrShell();
+    if( pCrsrShell != NULL )
+    {
+        // create pam for selection
+		pCrsrShell->StartAction();
+//        SwTxtNode* pNode = const_cast<SwTxtNode*>( GetTxtNode() );
+        SwPaM* aPaM = pCrsrShell->CreateCrsr();
+        aPaM->SetMark();
+		aPaM->GetPoint()->nContent = GetPortionData().GetModelPosition(startOffset);
+        aPaM->GetMark()->nContent =  GetPortionData().GetModelPosition(endOffset);
+		//pCrsrShell->ShowCrsr();
+		pCrsrShell->EndAction();
+        // set PaM at cursor shell
+        //bRet = Select( aPaM );
+    }
+
+    return bRet;
+}
+//-----IAccessibility2 Implementation 2009
 
 /*accessibility::*/TextSegment SAL_CALL
         SwAccessibleParagraph::getTextMarkup( sal_Int32 nTextMarkupIndex,
@@ -2673,3 +4136,267 @@
     CheckRegistration( pOld, pNew );
 }
 // <--
+
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleParagraph::GetSelectionAtIndex(
+    sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd)
+{
+        if(nIndex < 0) return sal_False;
+
+
+    sal_Bool bRet = sal_False;
+    nStart = -1;
+    nEnd = -1;
+	sal_Int32 nSelected = nIndex;
+
+    // get the selection, and test whether it affects our text node
+	SwPaM* pCrsr = GetCursor( true );
+    if( pCrsr != NULL )
+    {
+        // get SwPosition for my node
+        const SwTxtNode* pNode = GetTxtNode();
+        sal_uLong nHere = pNode->GetIndex();
+
+        // iterate over ring
+        SwPaM* pRingStart = pCrsr;
+        do
+        {
+            // ignore, if no mark
+            if( pCrsr->HasMark() )
+            {
+                // check whether nHere is 'inside' pCrsr
+                SwPosition* pStart = pCrsr->Start();
+                sal_uLong nStartIndex = pStart->nNode.GetIndex();
+                SwPosition* pEnd = pCrsr->End();
+                sal_uLong nEndIndex = pEnd->nNode.GetIndex();
+                if( ( nHere >= nStartIndex ) &&
+                    ( nHere <= nEndIndex )      )
+                {
+					if( nSelected == 0 )
+					{					
+						// translate start and end positions
+
+						// start position
+						sal_Int32 nLocalStart = -1;
+						if( nHere > nStartIndex )
+						{
+							// selection starts in previous node:
+							// then our local selection starts with the paragraph
+							nLocalStart = 0;
+						}
+						else
+						{
+							DBG_ASSERT( nHere == nStartIndex,
+										"miscalculated index" );
+
+							// selection starts in this node:
+							// then check whether it's before or inside our part of
+							// the paragraph, and if so, get the proper position
+							sal_uInt16 nCoreStart = pStart->nContent.GetIndex();
+							if( nCoreStart <
+								GetPortionData().GetFirstValidCorePosition() )
+							{
+								nLocalStart = 0;
+							}
+							else if( nCoreStart <=
+									 GetPortionData().GetLastValidCorePosition() )
+							{
+								DBG_ASSERT(
+									GetPortionData().IsValidCorePosition(
+																	  nCoreStart ),
+									 "problem determining valid core position" );
+
+								nLocalStart =
+									GetPortionData().GetAccessiblePosition(
+																	  nCoreStart );
+							}
+						}
+
+						// end position
+						sal_Int32 nLocalEnd = -1;
+						if( nHere < nEndIndex )
+						{
+							// selection ends in following node:
+							// then our local selection extends to the end
+							nLocalEnd = GetPortionData().GetAccessibleString().
+																	   getLength();
+						}
+						else
+						{
+							DBG_ASSERT( nHere == nStartIndex,
+										"miscalculated index" );
+
+							// selection ends in this node: then select everything
+							// before our part of the node
+							sal_uInt16 nCoreEnd = pEnd->nContent.GetIndex();
+							if( nCoreEnd >
+									GetPortionData().GetLastValidCorePosition() )
+							{
+								// selection extends beyond out part of this para
+								nLocalEnd = GetPortionData().GetAccessibleString().
+																	   getLength();
+							}
+							else if( nCoreEnd >=
+									 GetPortionData().GetFirstValidCorePosition() )
+							{
+								// selection is inside our part of this para
+								DBG_ASSERT(
+									GetPortionData().IsValidCorePosition(
+																	  nCoreEnd ),
+									 "problem determining valid core position" );
+
+								nLocalEnd = GetPortionData().GetAccessiblePosition(
+																	   nCoreEnd );
+							}
+						}
+
+						if( ( nLocalStart != -1 ) && ( nLocalEnd != -1 ) )
+						{
+							nStart = nLocalStart;
+							nEnd = nLocalEnd;
+							bRet = sal_True;
+						}
+					} // if hit the index
+					else
+					{
+						nSelected--;
+					}
+                }
+                // else: this PaM doesn't point to this paragraph
+            }
+            // else: this PaM is collapsed and doesn't select anything
+
+            // next PaM in ring
+            pCrsr = static_cast<SwPaM*>( pCrsr->GetNext() );
+        }
+        while( !bRet && (pCrsr != pRingStart) );
+    }
+    // else: nocursor -> no selection
+
+    if( bRet )
+    {
+		sal_Int32 nCaretPos = GetCaretPos();
+		if( nStart == nCaretPos )
+		{
+			sal_Int32 tmp = nStart;
+			nStart = nEnd;
+			nEnd = tmp;
+		}
+    }
+    return bRet;
+}
+
+sal_Int16 SAL_CALL SwAccessibleParagraph::getAccessibleRole (void) throw (::com::sun::star::uno::RuntimeException)
+{
+	//Get the real heading level, Heading1 ~ Heading10
+	if (nHeadingLevel > 0)
+	{
+		return AccessibleRole::HEADING;
+	}
+	else
+	{
+		return AccessibleRole::PARAGRAPH;
+	}
+}
+
+// End Add
+
+
+/* This funcion is already defined in accpara.cxx(Added by yanjun)
+sal_Int32 SAL_CALL SwAccessibleParagraph::getBackground() 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+// Test Code
+//     Sequence<OUString> seNames(1);
+//     OUString* pStrings = seNames.getArray();
+// 	pStrings[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("ParaBackColor"));
+// 
+//     Sequence<Any> aAnys(1);
+// 	Reference<XMultiPropertySet> xPortion = CreateUnoPortion( 0, 0 );
+//     aAnys = xPortion->getPropertyValues( seNames );
+// 	const Any* pAnys = aAnys.getConstArray();
+// 
+// 	sal_uInt32 crColorT=0;
+// 	pAnys[0] >>= crColorT;
+// End Test Code
+
+	const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+	sal_uInt32 crBack = rBack.GetColor().GetColor();
+	
+	if (COL_AUTO == crBack)
+	{
+		Reference<XAccessible> xAccDoc = getAccessibleParent();
+		if (xAccDoc.is())
+		{
+			Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,UNO_QUERY);
+			if (xCompoentDoc.is())
+			{
+				crBack = (sal_uInt32)xCompoentDoc->getBackground();
+			}
+		}
+	}
+	return crBack;
+}
+*/
+
+//Get the real heading level, Heading1 ~ Heading10
+sal_Int32 SwAccessibleParagraph::GetRealHeadingLevel()
+{
+    uno::Reference< ::com::sun::star::beans::XPropertySet > xPortion = CreateUnoPortion( 0, 0 );
+    ::rtl::OUString pString = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaStyleName"));
+    uno::Any styleAny = xPortion->getPropertyValue( pString );
+    ::rtl::OUString sValue;
+	if (styleAny >>= sValue)
+	{
+		//Modified by yanjun for acc migration
+		sal_Int32 length = sValue.getLength/*GetCharCount*/();
+		if (length == 9 || length == 10)
+		{
+            ::rtl::OUString headStr = sValue.copy(0, 7);
+            if (headStr.equals(::rtl::OUString::createFromAscii("Heading")))
+			{
+                ::rtl::OUString intStr = sValue.copy(8);
+				sal_Int32 headingLevel = intStr.toInt32(10);
+				return headingLevel;
+			}
+		}
+	}	
+	return -1;
+}
+
+uno::Any SAL_CALL SwAccessibleParagraph::getExtendedAttributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+    uno::Any Ret;
+    ::rtl::OUString strHeading(::rtl::OUString::createFromAscii("heading-level:"));
+	if( nHeadingLevel >= 0 )
+		strHeading += OUString::valueOf(nHeadingLevel, 10);
+	strHeading += OUString::createFromAscii(";");
+
+	Ret <<= strHeading;
+
+	return Ret;
+}
+
+//Tab will be return when call WORDTYPE
+sal_Bool SwAccessibleParagraph::tabCharInWord( sal_Int32 nIndex, i18n::Boundary& aBound)
+{
+	sal_Bool bFind =  sal_False;
+	if( aBound.startPos != nIndex) 
+	{
+		OUString tabStr;
+		if(aBound.startPos>nIndex)
+			tabStr = GetString().copy(nIndex,(aBound.startPos - nIndex) );
+
+		sal_Unicode tabChar('\t');
+		sal_Int32 tabIndex = tabStr.indexOf(tabChar);
+		if( tabIndex > -1 )
+		{
+			aBound.startPos = nIndex + tabIndex ;
+			aBound.endPos = aBound.startPos + 1;
+			bFind = sal_True;
+		}
+	}
+	return bFind;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accpara.hxx b/main/sw/source/core/access/accpara.hxx
index 167879b..61dc45d 100644
--- a/main/sw/source/core/access/accpara.hxx
+++ b/main/sw/source/core/access/accpara.hxx
@@ -29,6 +29,11 @@
 #include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
 #include <com/sun/star/accessibility/XAccessibleTextMarkup.hpp>
 #include <com/sun/star/accessibility/XAccessibleMultiLineText.hpp>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
+#include <txmsrt.hxx>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+//-----IAccessibility2 Implementation 2009 
 #include <com/sun/star/accessibility/XAccessibleTextAttributes.hpp>
 #include <hash_map>
 #include <accselectionhelper.hxx>
@@ -36,11 +41,13 @@
 #include <calbck.hxx>
 // <--
 
+class SwField;
 class SwTxtFrm;
 class SwTxtNode;
 class SwPaM;
 class SwAccessiblePortionData;
 class SwAccessibleHyperTextData;
+class SwRedline; //IAccessibility2 Implementation 2009
 class SwXTextPortion;
 // --> OD 2010-02-19 #i108125#
 class SwParaChangeTrackingInfo;
@@ -50,6 +57,7 @@
 namespace com { namespace sun { namespace star {
     namespace i18n { struct Boundary; }
     namespace accessibility { class XAccessibleHyperlink; }
+    namespace style { class TabStop; }
 } } }
 
 typedef ::std::hash_map< ::rtl::OUString,
@@ -67,7 +75,11 @@
         public com::sun::star::accessibility::XAccessibleHypertext,
         public com::sun::star::accessibility::XAccessibleTextMarkup,
         public com::sun::star::accessibility::XAccessibleMultiLineText,
-        public ::com::sun::star::accessibility::XAccessibleTextAttributes
+        public ::com::sun::star::accessibility::XAccessibleTextAttributes,
+		//IAccessibility2 Implementation 2009-----
+		public com::sun::star::accessibility::XAccessibleTextSelection,
+		public  com::sun::star::accessibility::XAccessibleExtendedAttributes
+		//-----IAccessibility2 Implementation 2009
 {
 	friend class SwAccessibleHyperlink;
 
@@ -86,6 +98,9 @@
 							// mutex)
 
 	sal_Bool bIsHeading;	// protected by base classes mutex
+	//IAccessibility2 Implementation 2009-----
+	sal_Int32 nHeadingLevel;
+	//-----IAccessibility2 Implementation 2009 
 
     // implementation for XAccessibleSelection
     SwAccessibleSelectionHelper aSelectionHelper;
@@ -144,6 +159,10 @@
         }
     }
 
+	//IAccessibility2 Implementation 2009-----
+    const SwRedline* GetRedlineAtIndex( sal_Int32 nPos );
+	String GetFieldTypeNameAtIndex(sal_Int32 nIndex);
+	//-----IAccessibility2 Implementation 2009 
     // --> OD 2006-07-13 #i63870#
     void _getDefaultAttributesImpl(
             const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
@@ -154,9 +173,22 @@
             const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
             tAccParaPropValMap& rRunAttrSeq );
     // <--
+	// IAccessibility2 Implementation 2009----
+	void _getSupplementalAttributesImpl(
+			const sal_Int32 nIndex,
+            const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes,
+            tAccParaPropValMap& rSupplementalAttrSeq );	
+
+	void _correctValues(
+			const sal_Int32 nIndex,
+			::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rValues );
+	// ----IAccessibility2 Implementation 2009
 
 public:
-
+	//IAccessibility2 Implementation 2009-----
+	SwTOXSortTabBase* GetTOXSortTabBase();
+	short GetTOCLevel();
+	//-----IAccessibility2 Implementation 2009
 	sal_Bool IsHeading() const;
 
 protected:
@@ -241,6 +273,15 @@
 
 	virtual sal_Bool HasCursor();	// required by map to remember that object
 
+	//IAccessibility2 Implementation 2009-----
+	com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > GetCurrentTabStop( sal_Int32 nIndex  );
+	virtual sal_Int16 SAL_CALL getAccessibleRole (void)     throw (::com::sun::star::uno::RuntimeException);
+	//-----IAccessibility2 Implementation 2009
+    // --> OD 2010-02-19 #i108125#
+    // MT: Solved merge conflict - seems this was removed between 101 and 103?
+    // virtual void Modify( SfxPoolItem* pOld, SfxPoolItem* pNew);
+    // <--
+
     //=====  XAccessibleContext  ==============================================
 
     ///	Return this object's description.
@@ -406,7 +447,29 @@
                    ::com::sun::star::lang::IllegalArgumentException,
                    ::com::sun::star::uno::RuntimeException);
     // <--
-
+    //IAccessibility2 Implementation 2009-----
+	//======   XAccessibleTextSelection  ======================================
+	virtual sal_Bool SAL_CALL scrollToPosition( const ::com::sun::star::awt::Point& aPoint, sal_Bool isLeftTop )
+		throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getSelectedPortionCount(  ) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getSeletedPositionStart( sal_Int32 nSelectedPortionIndex )
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL getSeletedPositionEnd( sal_Int32 nSelectedPortionIndex ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL removeSelection( sal_Int32 selectionIndex )
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual sal_Int32 SAL_CALL  addSelection( sal_Int32 selectionIndex, sal_Int32 startOffset, sal_Int32 endOffset)
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	//=====  XAccessibleExtendedAttributes  ==============================================
+    virtual ::com::sun::star::uno::Any SAL_CALL getExtendedAttributes()
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	sal_Bool GetSelectionAtIndex(sal_Int32& nIndex, sal_Int32& nStart, sal_Int32& nEnd);
+	sal_Int32 GetRealHeadingLevel();
+	//=====  XAccessibleComponent  ============================================
+	sal_Bool m_bLastHasSelection;
+	sal_Bool tabCharInWord(sal_Int32 nIndex, com::sun::star::i18n::Boundary&  aBound);
+	//-----IAccessibility2 Implementation 2009
     // --> OD 2008-05-29 #i89175#
     //=====  XAccessibleMultiLineText  ========================================
     virtual sal_Int32 SAL_CALL getLineNumberAtIndex( sal_Int32 nIndex )
diff --git a/main/sw/source/core/access/accportions.cxx b/main/sw/source/core/access/accportions.cxx
index 62b9ed7..7f07820 100644
--- a/main/sw/source/core/access/accportions.cxx
+++ b/main/sw/source/core/access/accportions.cxx
@@ -64,6 +64,10 @@
 
 using namespace ::com::sun::star;
 
+//IAccessibility2 Implementation 2009-----
+//#include "accnote.hxx"
+//-----IAccessibility2 Implementation 2009
+
 using rtl::OUString;
 using rtl::OUStringBuffer;
 using i18n::Boundary;
@@ -140,6 +144,13 @@
 
     bLastIsSpecial = sal_False;
 }
+//IAccessibility2 Implementation 2009-----
+void SwAccessiblePortionData::SetAttrFieldType( sal_uInt16 nAttrFldType )
+{
+	aAttrFieldType.push_back(nAttrFldType);
+	return;
+}
+//-----IAccessibility2 Implementation 2009
 
 void SwAccessiblePortionData::Special(
     sal_uInt16 nLength, const String& rText, sal_uInt16 nType)
@@ -156,10 +167,45 @@
     switch( nType )
     {
         case POR_POSTITS:
-        case POR_FLYCNT:
-        case POR_GRFNUM:
+			//IAccessibility2 Implementation 2009-----
             sDisplay = String(sal_Unicode(0xfffc));
-
+            
+			break;
+		case POR_FLYCNT:
+			sDisplay = String(sal_Unicode(0xfffc));
+			break;
+		case POR_GRFNUM:
+		case POR_BULLET:
+				break;
+		case POR_FLD:
+		//Added by yanjun for 6854
+		case POR_HIDDEN:
+		case POR_COMBINED:
+		case POR_ISOREF:
+		//End
+			{
+				//When the filed content is empty, input a special character.
+				if (rText.Len() == 0)
+					sDisplay = String(sal_Unicode(0xfffc));
+				else
+					sDisplay = rText;
+				aFieldPosition.push_back(aBuffer.getLength());		
+				aFieldPosition.push_back(aBuffer.getLength() + rText.Len());
+				break;
+			}
+		case POR_FTNNUM:
+			{
+				break;
+			}
+		case POR_FTN:
+			{
+				sDisplay = rText;			
+				sal_Int32 nStart=aBuffer.getLength();
+				sal_Int32 nEnd=nStart + rText.Len();
+				m_vecPairPos.push_back(std::make_pair(nStart,nEnd));
+				break;
+			}
+			//-----IAccessibility2 Implementation 2009
             break;
         case POR_NUMBER:
         {
@@ -675,6 +721,37 @@
     return static_cast<sal_uInt16>( nModelPos );
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_uInt16 SwAccessiblePortionData::GetAttrFldType( sal_Int32 nPos )
+{
+	if( aFieldPosition.size() < 2 ) return sal_False;
+	sal_Int32 nFieldIndex = 0;
+    for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+ 	{
+		if( nPos < aFieldPosition[ i + 1 ]  &&  nPos >= aFieldPosition[ i ] ) 
+		{		
+			return aAttrFieldType[nFieldIndex];
+		}
+		nFieldIndex++ ;
+ 	}
+	return 0;  	
+}
+
+sal_Bool SwAccessiblePortionData::FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos )
+{
+	if( aFieldPosition.size() < 2 ) return sal_False;
+    for( size_t i = 0; i < aFieldPosition.size() - 1; i += 2 )
+	{
+		if( nPos < aFieldPosition[ i + 1 ]  &&  nPos >= aFieldPosition[ i ] ) 
+		{
+			rBound.startPos = aFieldPosition[i];
+			rBound.endPos =  aFieldPosition[i + 1];
+			return sal_True;
+		}
+	}
+	return sal_False;  	
+}
+//-----IAccessibility2 Implementation 2009
 void SwAccessiblePortionData::AdjustAndCheck(
     sal_Int32 nPos,
     size_t& nPortionNo,
@@ -738,6 +815,50 @@
            ( nPos <= aModelPositions[ aModelPositions.size()-1 ] );
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessiblePortionData::IsZeroCorePositionData()
+{
+	if( aModelPositions.size() < 1  ) return sal_True;
+	return aModelPositions[0] == 0 &&  aModelPositions[aModelPositions.size()-1] == 0;
+}
+
+sal_Bool SwAccessiblePortionData::IsIndexInFootnode(sal_Int32 nIndex)
+{
+	VEC_PAIR_POS::iterator vi =m_vecPairPos.begin();
+	for (;vi != m_vecPairPos.end() ; ++vi)
+	{
+		const PAIR_POS &pairPos = *vi;
+		if(nIndex >= pairPos.first && nIndex < pairPos.second )
+		{
+			return sal_True;
+		}
+	}
+	return sal_False;
+}
+
+sal_Bool SwAccessiblePortionData::IsInGrayPortion( sal_Int32 nPos )
+{
+//    return IsGrayPortion( FindBreak( aAccessiblePositions, nPos ) );
+    return IsPortionAttrSet( FindBreak( aAccessiblePositions, nPos ), 
+                             PORATTR_GRAY );
+}
+
+sal_Int32 SwAccessiblePortionData::GetFieldIndex(sal_Int32 nPos)
+{
+	sal_Int32 nIndex = -1;
+	if( aFieldPosition.size() >= 2 ) 
+	{
+		for( sal_Int32 i = 0; i < aFieldPosition.size() - 1; i += 2 )
+		{
+			if( nPos <= aFieldPosition[ i + 1 ]  &&  nPos >= aFieldPosition[ i ] ) 
+			{
+				nIndex = i/2;
+				break;
+			}
+		}
+	}
+	return nIndex;
+}
 sal_uInt16 SwAccessiblePortionData::GetFirstValidCorePosition() const
 {
     return static_cast<sal_uInt16>( aModelPositions[0] );
diff --git a/main/sw/source/core/access/accportions.hxx b/main/sw/source/core/access/accportions.hxx
index a112f72..b58160b 100644
--- a/main/sw/source/core/access/accportions.hxx
+++ b/main/sw/source/core/access/accportions.hxx
@@ -61,7 +61,11 @@
     Positions_t aLineBreaks;        /// position of line breaks
     Positions_t aModelPositions;    /// position of portion breaks in the model
     Positions_t aAccessiblePositions;   /// portion breaks in sAccessibleString
-
+    //IAccessibility2 Implementation 2009-----
+    Positions_t aFieldPosition;
+    //-----IAccessibility2 Implementation 2009
+    Positions_t aAttrFieldType;
+	
     typedef std::vector<sal_uInt8> PortionAttrs_t;
     PortionAttrs_t aPortionAttrs;   /// additional portion attributes
 
@@ -104,7 +108,15 @@
     virtual void Skip(sal_uInt16 nLength);
     virtual void Finish();
 
+    //IAccessibility2 Implementation 2009-----
+    virtual void SetAttrFieldType( sal_uInt16 nAttrFldType );
+    sal_Bool FillBoundaryIFDateField( com::sun::star::i18n::Boundary& rBound, const sal_Int32 nPos );
+	sal_Bool IsIndexInFootnode(sal_Int32 nIndex);
+	sal_Bool IsInGrayPortion( sal_Int32 nPos );
+	sal_Int32 GetFieldIndex(sal_Int32 nPos);
+	//-----IAccessibility2 Implementation 2009
 
+    sal_Bool IsZeroCorePositionData();
     // access to the portion data
 
     /// get the text string, as presented by the layout
@@ -149,6 +161,7 @@
     void GetAttributeBoundary( com::sun::star::i18n::Boundary& rBound,
                                sal_Int32 nPos ) const;
 
+    sal_uInt16 GetAttrFldType( sal_Int32 nPos );
     /// Convert start and end positions into core positions.
     /// @returns true if 'special' portions are included either completely
     ///          or not at all. This can be used to test whether editing
@@ -164,6 +177,12 @@
     sal_Bool IsValidCorePosition( sal_uInt16 nPos ) const;
     sal_uInt16 GetFirstValidCorePosition() const;
     sal_uInt16 GetLastValidCorePosition() const;
+	//IAccessibility2 Implementation 2009-----
+private:
+	typedef std::pair<sal_Int32,sal_Int32> PAIR_POS;
+	typedef std::vector<PAIR_POS> VEC_PAIR_POS;
+	VEC_PAIR_POS m_vecPairPos;
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/core/access/accpreview.cxx b/main/sw/source/core/access/accpreview.cxx
index 56b22da..d82b62b 100644
--- a/main/sw/source/core/access/accpreview.cxx
+++ b/main/sw/source/core/access/accpreview.cxx
@@ -32,6 +32,11 @@
 #endif
 #include <accpreview.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLESTATETYPE_HPP_
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#endif
+//-----IAccessibility2 Implementation 2009
 
 const sal_Char sServiceName[] = "com.sun.star.text.AccessibleTextDocumentPageView";
 const sal_Char sImplementationName[] = "com.sun.star.comp.Writer.SwAccessibleDocumentPageView";
@@ -54,7 +59,9 @@
 SwAccessiblePreview::SwAccessiblePreview( SwAccessibleMap *pMp ) :
     SwAccessibleDocumentBase( pMp )
 {
-	SetName( GetResource( STR_ACCESS_DOC_NAME ) );
+	//IAccessibility2 Implementation 2009-----
+	SetName( GetResource( STR_ACCESS_PREVIEW_DOC_NAME ) );
+	//-----IAccessibility2 Implementation 2009
 }
 
 SwAccessiblePreview::~SwAccessiblePreview()
@@ -98,3 +105,21 @@
     }
     return aId;
 }
+//IAccessibility2 Implementation 2009-----
+OUString SAL_CALL SwAccessiblePreview::getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException)
+{
+	return GetResource( STR_ACCESS_PREVIEW_DOC_NAME );
+}
+
+OUString SAL_CALL SwAccessiblePreview::getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException)
+{
+	OUString sName = SwAccessibleDocumentBase::getAccessibleName();
+	sName += OUString::createFromAscii(" ");
+	sName += GetResource( STR_ACCESS_PREVIEW_DOC_SUFFIX );
+	return sName;
+}
+void SwAccessiblePreview::_InvalidateFocus()
+{
+	FireStateChangedEvent( ::com::sun::star::accessibility::AccessibleStateType::FOCUSED, sal_True );
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/core/access/accpreview.hxx b/main/sw/source/core/access/accpreview.hxx
index 68c032d..7c0c62e 100644
--- a/main/sw/source/core/access/accpreview.hxx
+++ b/main/sw/source/core/access/accpreview.hxx
@@ -66,6 +66,12 @@
 
 	//====== XTypeProvider ====================================================
     virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(  ) throw(::com::sun::star::uno::RuntimeException);
+
+	//IAccessibility2 Implementation 2009-----
+	::rtl::OUString SAL_CALL getAccessibleDescription (void) throw (com::sun::star::uno::RuntimeException);
+	::rtl::OUString SAL_CALL getAccessibleName (void) throw (::com::sun::star::uno::RuntimeException);
+	virtual void _InvalidateFocus();
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif
diff --git a/main/sw/source/core/access/accselectionhelper.cxx b/main/sw/source/core/access/accselectionhelper.cxx
index 648e9d0..d59c24c 100644
--- a/main/sw/source/core/access/accselectionhelper.cxx
+++ b/main/sw/source/core/access/accselectionhelper.cxx
@@ -38,6 +38,14 @@
 #include <flyfrm.hxx>
 
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/XAccessibleStateSet.hpp>
+#include <fmtanchr.hxx>
+//-----IAccessibility2 Implementation 2009
+
+using namespace ::com::sun::star::accessibility;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 
@@ -117,6 +125,43 @@
     // return bRet;
 }
 
+//IAccessibility2 Implementation 2009-----
+//When the selected state of the SwFrmOrObj is setted, return true.
+static sal_Bool lcl_getSelectedState(const SwAccessibleChild& aChild, 
+									 SwAccessibleContext* pContext,
+									 SwAccessibleMap* pMap)
+{
+	Reference< XAccessible > xAcc;
+    if ( aChild.GetSwFrm() )
+    {        
+		xAcc = pMap->GetContext( aChild.GetSwFrm(), sal_False );
+    }
+    else if ( aChild.GetDrawObject() )
+    {
+        xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, sal_False );
+    }
+	
+	if( xAcc.is() )
+	{
+		Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext();
+		if(!pRContext.is())
+			return sal_False;
+		Reference<XAccessibleStateSet> pRStateSet = pRContext->getAccessibleStateSet();
+		if( pRStateSet.is() )
+		{
+			Sequence<short> pStates = pRStateSet->getStates();
+			long count = pStates.getLength();
+			for( int i = 0; i < count; i++ )
+			{
+				if( pStates[i] == AccessibleStateType::SELECTED)
+					return sal_True;
+			}
+		}
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
+
 sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected(
     sal_Int32 nChildIndex )
     throw ( lang::IndexOutOfBoundsException,
@@ -143,6 +188,14 @@
 		{
             bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() );
 		}
+		//IAccessibility2 Implementation 2009-----
+		//If the SwFrmOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor.
+		if( !bRet )
+		{
+			if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) == sal_True)
+				bRet = sal_True;
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 
 	return bRet;
@@ -200,11 +253,11 @@
         const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm();
 		if( pFlyFrm )
 		{
-            if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
-                    rContext.GetFrm() )
-            {
+			//IAccessibility2 Implementation 2009-----
+            //if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
+            //        rContext.GetFrm() )
 				nCount = 1;
-            }
+			//-----IAccessibility2 Implementation 2009
 		}
 		else
 		{
@@ -232,6 +285,26 @@
 				}
 			}
 		}
+		//IAccessibility2 Implementation 2009-----
+		//If the SwFrmOrObj is not selected directly in the UI, 
+		//we should check whether it is selected in the selection cursor.
+		if( nCount == 0 )
+		{
+            ::std::list< SwAccessibleChild > aChildren;
+            rContext.GetChildren( *(rContext.GetMap()), aChildren );
+            ::std::list< SwAccessibleChild >::const_iterator aIter =
+				aChildren.begin();
+            ::std::list< SwAccessibleChild >::const_iterator aEndIter =
+				aChildren.end();
+			while( aIter != aEndIter )
+			{
+                const SwAccessibleChild& aChild = *aIter;
+				if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) )
+					nCount++;
+				++aIter;
+			}
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
     return nCount;
 }
@@ -255,12 +328,28 @@
 	const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm();
 	if( pFlyFrm )
 	{
-		if( 0 == nSelectedChildIndex &&
-            rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) ==
-                rContext.GetFrm() )
-        {
-        	aChild = pFlyFrm;
-        }
+		//IAccessibility2 Implementation 2009-----
+		if( 0 == nSelectedChildIndex )
+		{
+            if(rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == rContext.GetFrm() )
+			{
+				aChild = pFlyFrm;
+			}
+			else
+			{
+				const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt();
+				if (pFrmFmt)
+				{
+					const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor();
+                    if( pAnchor.GetAnchorId() == FLY_AS_CHAR )
+					{
+                        const SwFrm  *pParaFrm =  rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview() );
+						aChild  = pParaFrm;
+					}
+				}
+			}
+		}
+		//-----IAccessibility2 Implementation 2009
 	}
 	else
 	{
diff --git a/main/sw/source/core/access/acctable.cxx b/main/sw/source/core/access/acctable.cxx
index 6ffcadf..62ef202 100644
--- a/main/sw/source/core/access/acctable.cxx
+++ b/main/sw/source/core/access/acctable.cxx
@@ -49,9 +49,14 @@
 #include <accmap.hxx>
 #include <access.hrc>
 #include <acctable.hxx>
-
+#include <rowfrm.hxx>
+#include <layfrm.hxx>
 #include <com/sun/star/accessibility/XAccessibleText.hpp>
 
+#include <editeng/brshitem.hxx>
+#include <swatrset.hxx>
+#include <frmatr.hxx>
+
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
@@ -67,6 +72,8 @@
 typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl;
 typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl;
 
+const int SELECTION_WITH_NUM =10;
+
 class SwAccTableSelHander_Impl
 {
 public:
@@ -88,6 +95,10 @@
     bool mbOnlyTableColumnHeader;
 
 	void CollectData( const SwFrm *pFrm );
+	//IAccessibility2 Implementation 2009-----
+	void CollectColumnHeaderData( const SwFrm *pFrm );
+	void CollectRowHeaderData( const SwFrm *pFrm );
+	//-----IAccessibility2 Implementation 2009
 	void CollectExtents( const SwFrm *pFrm );
 
 	sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm ,
@@ -182,6 +193,99 @@
 	}
 }
 
+//IAccessibility2 Implementation 2009-----
+void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm )
+{
+    const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+    SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+    SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+	while( aIter != aEndIter )
+	{
+        const SwAccessibleChild& rLower = *aIter;
+		const SwFrm *pLower = rLower.GetSwFrm();
+		if( pLower )
+		{
+			if( pLower->IsRowFrm() )
+			{
+
+				const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+				while( pLine->GetUpper() )
+					pLine = pLine->GetUpper()->GetUpper();
+
+				// Headerline?
+				//if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+				//return ;
+
+				maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+		
+				CollectRowHeaderData( pLower );
+
+
+			}
+			else if( pLower->IsCellFrm() && 
+                     rLower.IsAccessible( mbIsInPagePreview ) )
+			{
+				//Added by yanjun. Can't find the "GetRowHeaderFlag" function(Need vefiry).
+				//if(((SwCellFrm*)pLower)->GetRowHeaderFlag())
+				//	maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+			}
+			else
+			{
+				CollectRowHeaderData( pLower );
+			}
+		}
+		++aIter;
+	}
+}
+//-----IAccessibility2 Implementation 2009
+
+void SwAccessibleTableData_Impl::CollectColumnHeaderData( const SwFrm *pFrm )
+{
+    const SwAccessibleChildSList aList( *pFrm, mrAccMap );
+    SwAccessibleChildSList::const_iterator aIter( aList.begin() );
+    SwAccessibleChildSList::const_iterator aEndIter( aList.end() );
+	while( aIter != aEndIter )
+	{
+        const SwAccessibleChild& rLower = *aIter;
+		const SwFrm *pLower = rLower.GetSwFrm();
+		if( pLower )
+		{
+			if( pLower->IsRowFrm() )
+			{
+
+				const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine();
+				while( pLine->GetUpper() )
+					pLine = pLine->GetUpper()->GetUpper();
+
+				// Headerline?
+				//if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine)
+				//return ;
+
+				//if the current line is now header line, then return ;
+				sal_Int16 iCurrentRowIndex = mpTabFrm->GetTable()->GetTabLines().GetPos( pLine);
+				if(iCurrentRowIndex >= mpTabFrm->GetTable()->_GetRowsToRepeat())
+					return ;
+
+				maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() );
+		
+				CollectColumnHeaderData( pLower );
+
+
+			}
+			else if( pLower->IsCellFrm() && 
+                     rLower.IsAccessible( mbIsInPagePreview ) )
+			{
+				maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() );
+			}
+			else
+			{
+				CollectColumnHeaderData( pLower );
+			}
+		}
+		++aIter;
+	}
+}
+//-----IAccessibility2 Implementation 2009
 void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm )
 {
     const SwAccessibleChildSList aList( *pFrm, mrAccMap );
@@ -396,7 +500,11 @@
 
 inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const
 {
-	return static_cast< sal_Int32 >( maRows.size() );
+	//IAccessibility2 Implementation 2009-----
+	sal_Int32 count =  static_cast< sal_Int32 >( maRows.size() ) ;
+	count = (count <=0)? 1:count;
+	//-----IAccessibility2 Implementation 2009
+	return count;
 }
 
 inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const
@@ -696,8 +804,12 @@
 		::utl::AccessibleStateSetHelper& rStateSet )
 {
 	SwAccessibleContext::GetStates( rStateSet );
-
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add resizable state to table
+	rStateSet.AddState( AccessibleStateType::RESIZABLE );
 	// MULTISELECTABLE
+	rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
+	//-----IAccessibility2 Implementation 2009
     SwCrsrShell* pCrsrShell = GetCrsrShell();
     if( pCrsrShell  )
 		rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE );
@@ -727,6 +839,9 @@
 	OUString sArg2( GetFormattedPageNumber() );
 
 	sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 );
+	//IAccessibility2 Implementation 2009-----
+	UpdateTableData();
+	//-----IAccessibility2 Implementation 2009
 }
 
 SwAccessibleTable::~SwAccessibleTable()
@@ -784,8 +899,7 @@
 
 	case RES_OBJECTDYING:
         // mba: it seems that this class intentionally does not call code in base class SwClient
-		if( GetRegisteredIn() ==
-				static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) )
+		if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) )
 			GetRegisteredInNonConst()->Remove( this );
 		break;
 
@@ -809,6 +923,13 @@
         uno::Reference<XAccessibleSelection> xSelection( this );
         aRet <<= xSelection;
     }
+	//IAccessibility2 Implementation 2009-----
+	else if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) )
+    {
+		uno::Reference<XAccessibleTableSelection> xTableExtent( this );
+        aRet <<= xTableExtent;
+    }
+	//-----IAccessibility2 Implementation 2009
     else
     {
         aRet = SwAccessibleContext::queryInterface(rType);
@@ -981,6 +1102,9 @@
 
 	CHECK_FOR_DEFUNC( XAccessibleTable )
 
+	//IAccessibility2 Implementation 2009-----
+	UpdateTableData();
+	//-----IAccessibility2 Implementation 2009
 	GetTableData().CheckRowAndCol( nRow, nColumn, this );
 
 	Int32Set_Impl::const_iterator aSttCol(
@@ -1011,6 +1135,9 @@
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
 	CHECK_FOR_DEFUNC( XAccessibleTable )
+	//IAccessibility2 Implementation 2009-----
+	UpdateTableData();
+	//-----IAccessibility2 Implementation 2009
 
 	GetTableData().CheckRowAndCol( nRow, nColumn, this );
 
@@ -1045,6 +1172,25 @@
 		SwAccessibleTable::getAccessibleColumnHeaders(  )
 	throw (uno::RuntimeException)
 {
+// MT IA2: Which one should win nowadys???
+/*
+    // IA2 version:
+	uno::Reference< XAccessibleTable > xRet;
+	SwTabFrm* pTabFrm =( SwTabFrm*)( GetFrm() );
+	if (pTabFrm)
+	{
+		if(pTabFrm->GetTable()->_GetRowsToRepeat() > 0)
+		{
+			//for errata table header
+			SwAccessibleTableData_Impl *mpHeadTableData = new SwAccessibleTableData_Impl( pTabFrm, sal_False, sal_True);
+			//for errata table header
+			SwAccessibleTable *pHeadAccessibleTable = new SwAccessibleTable(GetMap(),pTabFrm);
+			pHeadAccessibleTable->SetTableData(mpHeadTableData);
+			xRet = pHeadAccessibleTable;
+		}
+	}
+	return xRet;
+*/
     // --> OD 2010-03-10 #i87532#
     // assure that return accesible object is empty, if no column header exists.
     SwAccessibleTableColHeaders* pTableColHeaders =
@@ -1346,6 +1492,15 @@
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
+	//IAccessibility2 Implementation 2009-----
+	//need to update children 
+	SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData();
+	if( !pNewTableData->CompareExtents( GetTableData() ) )
+	{
+		delete mpTableData;
+		mpTableData = pNewTableData;
+		FireTableChangeEvent(*mpTableData);
+	}
 	if( HasTableData() )
 		GetTableData().SetTablePos( GetFrm()->Frm().Pos() );
 
@@ -1402,6 +1557,34 @@
             // <--
 			if( !pNewTableData->CompareExtents( GetTableData() ) )
 			{
+				//IAccessibility2 Implementation 2009-----
+				if(pNewTableData->GetRowCount()!= mpTableData->GetRowCount())
+				{
+					Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) );
+					Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) );
+					const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow, sal_False );
+					Int32Set_Impl::const_iterator aSttCol2(	pNewTableData->GetColumnIter( 0 ) );
+					Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) );
+					const SwFrm *pCellFrm2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2,	sal_False );
+
+					if(pCellFrm == pCellFrm2)
+					{
+						AccessibleTableModelChange aModelChange;
+						aModelChange.Type = AccessibleTableModelChangeType::UPDATE;
+						aModelChange.FirstRow = 0;
+						aModelChange.LastRow = mpTableData->GetRowCount() - 1;
+						aModelChange.FirstColumn = 0;
+						aModelChange.LastColumn = mpTableData->GetColumnCount() - 1;
+
+						AccessibleEventObject aEvent;
+						aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED;
+						aEvent.NewValue <<= aModelChange;
+
+						FireAccessibleEvent( aEvent );
+					}
+				}
+				else
+				//-----IAccessibility2 Implementation 2009
 				FireTableChangeEvent( GetTableData() );
 				ClearTableData();
 				mpTableData = pNewTableData;
@@ -1674,6 +1857,153 @@
 	pCrsrShell->EndAction();
 }
 
+//IAccessibility2 Implementation 2009-----
+void  SwAccessibleTable::SetTableData(SwAccessibleTableData_Impl* mpNewTableData)  
+{
+	mpTableData = mpNewTableData;
+}
+
+sal_Int32 SAL_CALL SwAccessibleTable::getBackground() 
+		throw (::com::sun::star::uno::RuntimeException)
+{
+	const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground();
+	sal_uInt32 crBack = rBack.GetColor().GetColor();
+	
+	if (COL_AUTO == crBack)
+	{
+		uno::Reference<XAccessible> xAccDoc = getAccessibleParent();
+		if (xAccDoc.is())
+		{
+			uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,uno::UNO_QUERY);
+			if (xCompoentDoc.is())
+			{
+				crBack = (sal_uInt32)xCompoentDoc->getBackground();
+			}
+		}
+	}
+	return crBack;
+}
+
+void SwAccessibleTable::FireSelectionEvent( )
+{
+	AccessibleEventObject aEvent;
+
+	aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE;
+
+//    int nRemove = m_vecCellRemove.size();
+//    int nAdd = m_vecCellAdd.size();
+
+	VEC_CELL::iterator vi = m_vecCellRemove.begin();
+	for (; vi != m_vecCellRemove.end()  ; ++vi)
+	{
+		SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+		OSL_ASSERT(pAccCell != NULL );
+		pAccCell->FireAccessibleEvent(aEvent);
+	}
+
+	if (m_vecCellAdd.size() <= SELECTION_WITH_NUM)
+	{
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+		vi = m_vecCellAdd.begin();
+		for (; vi != m_vecCellAdd.end()  ; ++vi)
+		{
+			SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi);
+			OSL_ASSERT(pAccCell != NULL );
+			pAccCell->FireAccessibleEvent(aEvent);
+		}
+		return ;
+	}
+	else
+	{
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+		FireAccessibleEvent(aEvent);
+	}
+}
+
+void SwAccessibleTable::ClearSelectionCellCache()
+{
+	m_vecCellAdd.clear();
+	m_vecCellRemove.clear();
+}
+
+void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove)
+{
+	if (bAddOrRemove)
+	{
+		m_vecCellAdd.push_back(pAccCell);
+	}
+	else
+	{
+		m_vecCellRemove.push_back(pAccCell);
+	}	
+}
+
+//=====  XAccessibleTableSelection  ============================================
+sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row ) 
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException) 
+{
+	if( isAccessibleColumnSelected( row ) )
+		return sal_True;
+
+	long lCol, lColumnCount, lChildIndex;
+	lColumnCount = getAccessibleColumnCount();
+	for(lCol = 0; lCol < lColumnCount; lCol ++)
+	{
+		lChildIndex = getAccessibleIndex(row, lCol);
+		selectAccessibleChild(lChildIndex);
+	}
+
+	return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column ) 
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if( isAccessibleColumnSelected( column ) )
+		return sal_True;
+
+	long lRow, lRowCount, lChildIndex;
+	lRowCount = getAccessibleRowCount();
+
+	for(lRow = 0; lRow < lRowCount; lRow ++)
+	{
+		lChildIndex = getAccessibleIndex(lRow, column);
+		selectAccessibleChild(lChildIndex);
+	}
+	return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row ) 
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if( isAccessibleSelected( row , 0 ) &&  isAccessibleSelected( row , getAccessibleColumnCount()-1 ) )
+	{
+		SwCrsrShell* pCrsrShell = GetCrsrShell();
+		if( pCrsrShell != NULL )
+		{
+			pCrsrShell->StartAction();
+			pCrsrShell->ClearMark();
+			pCrsrShell->EndAction();
+			return sal_True;
+		}
+	}
+	return sal_True;
+}
+sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column ) 
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if( isAccessibleSelected( 0 , column ) &&  isAccessibleSelected( getAccessibleRowCount()-1,column))
+	{
+		SwCrsrShell* pCrsrShell = GetCrsrShell();
+		if( pCrsrShell != NULL )
+		{
+			pCrsrShell->StartAction();
+			pCrsrShell->ClearMark();
+			pCrsrShell->EndAction();
+			return sal_True;
+		}
+	}
+	return sal_True;
+}
+//-----IAccessibility2 Implementation 2009
 // --> OD 2007-06-28 #i77106#
 // implementation of class <SwAccessibleTableColHeaders>
 SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2,
diff --git a/main/sw/source/core/access/acctable.hxx b/main/sw/source/core/access/acctable.hxx
index da272fb..866b037 100644
--- a/main/sw/source/core/access/acctable.hxx
+++ b/main/sw/source/core/access/acctable.hxx
@@ -23,6 +23,12 @@
 #ifndef _ACCTABLE_HXX
 #define _ACCTABLE_HXX
 #include <com/sun/star/accessibility/XAccessibleTable.hpp>
+//IAccessibility2 Implementation 2009-----
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleTableSelection_HPP_
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#endif
+#include <vector>
+//-----IAccessibility2 Implementation 2009
 #include <com/sun/star/accessibility/XAccessibleSelection.hpp>
 
 #include <acccontext.hxx>
@@ -40,6 +46,7 @@
 		public SwAccessibleContext,
 		public ::com::sun::star::accessibility::XAccessibleTable,
         public ::com::sun::star::accessibility::XAccessibleSelection,
+		public	 ::com::sun::star::accessibility::XAccessibleTableSelection,
 		public SwClient
 {
 	SwAccessibleTableData_Impl *mpTableData;	// the table's data, prot by Sol-Mutex
@@ -85,6 +92,9 @@
 	// Is table data evailable?
     sal_Bool HasTableData() const { return (mpTableData != 0); }
 
+	//IAccessibility2 Implementation 2009-----
+	void SetTableData(SwAccessibleTableData_Impl* mpNewTableData)  ;
+	//-----IAccessibility2 Implementation 2009
 	virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew);
 
 public:
@@ -187,7 +197,17 @@
     virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex )
 		throw (::com::sun::star::lang::IndexOutOfBoundsException,
 				::com::sun::star::uno::RuntimeException);
-
+	//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleTableSelection  ============================================
+	virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+    virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ;
+	//-----IAccessibility2 Implementation 2009
 	//=====  XServiceInfo  ====================================================
 
     /**	Returns an identifier for the implementation of this object.
@@ -254,6 +274,17 @@
         throw ( ::com::sun::star::lang::IndexOutOfBoundsException,
                 ::com::sun::star::uno::RuntimeException );
 
+	//IAccessibility2 Implementation 2009-----
+	//=====  XAccessibleComponent  ============================================
+	sal_Int32 SAL_CALL getBackground() 
+		throw (::com::sun::star::uno::RuntimeException);
+	typedef std::vector<const SwAccessibleContext*> VEC_CELL;
+	VEC_CELL m_vecCellAdd;
+	VEC_CELL m_vecCellRemove;
+	void FireSelectionEvent( );
+	void ClearSelectionCellCache();
+	void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove);
+	//-----IAccessibility2 Implementation 2009
 };
 
 inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData()
diff --git a/main/sw/source/core/access/acctextframe.cxx b/main/sw/source/core/access/acctextframe.cxx
index d1704f6..2654a7b 100644
--- a/main/sw/source/core/access/acctextframe.cxx
+++ b/main/sw/source/core/access/acctextframe.cxx
@@ -44,6 +44,11 @@
 // <--
 #include "acctextframe.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::accessibility;
 using ::rtl::OUString;
@@ -152,6 +157,125 @@
 	}
 }
 
+//IAccessibility2 Implementation 2009-----
+//=====  XInterface  ==========================================================
+
+com::sun::star::uno::Any SAL_CALL
+    SwAccessibleTextFrame::queryInterface (const com::sun::star::uno::Type & rType)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+    ::com::sun::star::uno::Any aReturn = SwAccessibleContext::queryInterface (rType);
+    if ( ! aReturn.hasValue())
+        aReturn = ::cppu::queryInterface (rType,
+            static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this)
+            );
+    return aReturn;
+}
+
+
+
+
+void SAL_CALL
+    SwAccessibleTextFrame::acquire (void)
+    throw ()
+{
+    SwAccessibleContext::acquire ();
+}
+
+void SAL_CALL
+    SwAccessibleTextFrame::release (void)
+    throw ()
+{
+    SwAccessibleContext::release ();
+}
+
+//
+//=====  XAccessibleSelection  ============================================
+//
+
+//--------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{
+    DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------------
+sal_Bool SAL_CALL SwAccessibleTextFrame::isAccessibleChildSelected( sal_Int32 nChildIndex ) 
+	throw (lang::IndexOutOfBoundsException, uno::RuntimeException )
+{	
+	uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex );
+	uno::Reference<XAccessibleContext> xContext;
+	if( xAcc.is() )
+		xContext = xAcc->getAccessibleContext();
+	
+	if( xContext.is() )
+	{
+		if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+		{
+			uno::Reference< ::com::sun::star::accessibility::XAccessibleText >
+				xText(xAcc, uno::UNO_QUERY);
+			if( xText.is() )
+			{				
+				if( xText->getSelectionStart() >= 0 ) return sal_True;
+			}		
+		}
+	}	
+	
+	return sal_False;	
+}
+
+//---------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::clearAccessibleSelection(  ) 
+	throw ( uno::RuntimeException )
+{
+    DBG_ASSERT( false, "<SwAccessibleTextFrame::clearAccessibleSelection(  )> - missing implementation" );
+}
+
+//-------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::selectAllAccessibleChildren(  ) 
+	throw ( uno::RuntimeException )
+{
+    DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren(  )> - missing implementation" );
+}
+
+//----------------------------------------------------------------------------
+sal_Int32 SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChildCount() 
+	throw ( uno::RuntimeException )
+{	
+	sal_Int32 nCount = 0;
+	sal_Int32 TotalCount = getAccessibleChildCount();
+	for( sal_Int32 i = 0; i < TotalCount; i++ )
+		if( isAccessibleChildSelected(i) ) nCount++;
+
+	return nCount;
+}
+
+//--------------------------------------------------------------------------------------
+uno::Reference<XAccessible> SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if ( nSelectedChildIndex > getSelectedAccessibleChildCount() )
+		throw lang::IndexOutOfBoundsException();
+	sal_Int32 i1, i2;
+	for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ )
+		if( isAccessibleChildSelected(i1) )
+		{
+			if( i2 == nSelectedChildIndex )
+				return getAccessibleChild( i1 );
+			i2++;
+		}
+	return uno::Reference<XAccessible>();
+}
+
+//----------------------------------------------------------------------------------
+void SAL_CALL SwAccessibleTextFrame::deselectAccessibleChild( sal_Int32 ) 
+	throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
+{	
+    DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( sal_Int32 )> - missing implementation" );
+}
+//-----IAccessibility2 Implementation 2009
+
 // --> OD 2009-07-14 #i73249#
 OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void)
         throw (uno::RuntimeException)
@@ -168,15 +292,29 @@
     return SwAccessibleFrameBase::getAccessibleName();
 }
 // <--
+
 OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void)
         throw (uno::RuntimeException)
 {
 	vos::OGuard aGuard(Application::GetSolarMutex());
 
     CHECK_FOR_DEFUNC( XAccessibleContext )
+	/* MT: I guess msDesc is correct noadays?
+	//IAccessibility2 Implementation 2009-----
+	OUString longDesc;	
+	const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0);
+	if( pFlyFmt )
+	{
+		longDesc = OUString( pFlyFmt->GetDescription() );		
+	}
+	if( longDesc.getLength() > 0 )
+		return GetName() + OUString(' ') + longDesc;
+	else
+		return GetName();
+	//-----IAccessibility2 Implementation 2009
+	*/
 
     return msDesc;
-
 }
 
 OUString SAL_CALL SwAccessibleTextFrame::getImplementationName()
diff --git a/main/sw/source/core/access/acctextframe.hxx b/main/sw/source/core/access/acctextframe.hxx
index e96db07..c2de65c 100644
--- a/main/sw/source/core/access/acctextframe.hxx
+++ b/main/sw/source/core/access/acctextframe.hxx
@@ -24,13 +24,18 @@
 #define _ACCTEXTFRAME_HXX
 #include "accframebase.hxx"
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+//-----IAccessibility2 Implementation 2009
+
 class SwFlyFrm;
 namespace utl { class AccessibleRelationSetHelper; }
 namespace com { namespace star {
     namespace accessibility { struct AccessibleRelation; }
 } }
 
-class SwAccessibleTextFrame : public SwAccessibleFrameBase
+class SwAccessibleTextFrame : public SwAccessibleFrameBase,
+        public ::com::sun::star::accessibility::XAccessibleSelection 
 {
 private:
     // --> OD 2009-07-14 #i73249#
@@ -48,6 +53,43 @@
 
     SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm );
 
+	//IAccessibility2 Implementation 2009-----
+	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface(
+		::com::sun::star::uno::Type const & rType )
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL acquire() throw ();
+	virtual void SAL_CALL release() throw ();
+	//=====  XAccessibleSelection  ============================================
+	virtual void SAL_CALL selectAccessibleChild( 
+		sal_Int32 nChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
+	
+	virtual sal_Bool SAL_CALL isAccessibleChildSelected( 
+		sal_Int32 nChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
+	
+	virtual void SAL_CALL clearAccessibleSelection(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual void SAL_CALL selectAllAccessibleChildren(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount(  ) 
+		throw ( ::com::sun::star::uno::RuntimeException );
+	
+	virtual ::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);
+	
+	virtual void SAL_CALL deselectAccessibleChild( 
+		sal_Int32 nSelectedChildIndex ) 
+		throw ( ::com::sun::star::lang::IndexOutOfBoundsException, 
+		::com::sun::star::uno::RuntimeException );
+	//-----IAccessibility2 Implementation 2009
+
 	//=====  XAccessibleContext  ==============================================
 
     // --> OD 2009-07-14 #i73249#
diff --git a/main/sw/source/core/attr/format.cxx b/main/sw/source/core/attr/format.cxx
index 69488b1..e05aa27 100644
--- a/main/sw/source/core/attr/format.cxx
+++ b/main/sw/source/core/attr/format.cxx
@@ -257,7 +257,9 @@
 		}
 		else
 		{
-			while( GetDepends() )
+			//IAccessibility2 Implementation 2009-----
+			while( GetDepends() && pParentFmt)
+			//-----IAccessibility2 Implementation 2009
 			{
 				SwFmtChg aOldFmt(this);
 				SwFmtChg aNewFmt(pParentFmt);
diff --git a/main/sw/source/core/crsr/crsrsh.cxx b/main/sw/source/core/crsr/crsrsh.cxx
index 6217e2a..659c838 100644
--- a/main/sw/source/core/crsr/crsrsh.cxx
+++ b/main/sw/source/core/crsr/crsrsh.cxx
@@ -424,6 +424,66 @@
     }
 	return bRet;
 }
+//IAccessibility2 Implementation 2009-----
+void SwCrsrShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+#ifdef ACCESSIBLE_LAYOUT
+	if( Imp()->IsAccessible() )
+		Imp()->FirePageChangeEvent( nOldPage, nNewPage );
+#endif
+}
+
+void SwCrsrShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+#ifdef ACCESSIBLE_LAYOUT
+	if( Imp()->IsAccessible() )
+		Imp()->FireColumnChangeEvent( nOldColumn,  nNewColumn);
+#endif
+}
+
+
+void SwCrsrShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+#ifdef ACCESSIBLE_LAYOUT
+	if( Imp()->IsAccessible() )
+		Imp()->FireSectionChangeEvent( nOldSection, nNewSection );
+#endif
+}
+bool SwCrsrShell::bColumnChange()
+{
+	
+	sal_uInt16 nCurrCol = 0;
+	SwFrm* pCurrFrm = GetCurrFrm(sal_False);
+
+	if (pCurrFrm == NULL)
+	{
+		return sal_False;
+	}
+
+	SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm();
+
+	while(pCurrCol== NULL && pCurrFrm!=NULL )
+	{
+		SwLayoutFrm* pParent = pCurrFrm->GetUpper();
+		if(pParent!=NULL)
+		{
+			pCurrCol=((SwFrm*)pParent)->FindColFrm();
+			pCurrFrm = (SwFrm*)pParent;
+		}
+		else
+		{
+			break;
+		}
+	}
+	if(oldColFrm == pCurrCol)
+		return sal_False;
+	else
+	{
+		oldColFrm = pCurrCol;
+		return sal_True;
+	}
+}
+//-----IAccessibility2 Implementation 2009
 
 // --> OD 2008-04-02 #refactorlists#
 void SwCrsrShell::MarkListLevel( const String& sListId,
@@ -2604,6 +2664,9 @@
 //	UpdateCrsr( 0 );
     // OD 11.02.2003 #100556#
     mbMacroExecAllowed = rShell.IsMacroExecAllowed();
+	//IAccessibility2 Implementation 2009-----
+	oldColFrm = NULL;
+	//-----IAccessibility2 Implementation 2009 
 }
 
 
diff --git a/main/sw/source/core/doc/tblcpy.cxx b/main/sw/source/core/doc/tblcpy.cxx
index e5770c7..54842c1 100644
--- a/main/sw/source/core/doc/tblcpy.cxx
+++ b/main/sw/source/core/doc/tblcpy.cxx
@@ -1029,7 +1029,11 @@
 
 	// loesche die Frames
 	aFndBox.SetTableLines( *this );
-	aFndBox.DelFrms( *this );
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Not dispose accessible table
+	//aFndBox.DelFrms( *this );
+	aFndBox.DelFrms( *this,sal_False );
+	//-----IAccessibility2 Implementation 2009
 
 	if( 1 == rCpyTbl.GetTabSortBoxes().Count() )
 	{
diff --git a/main/sw/source/core/docnode/node.cxx b/main/sw/source/core/docnode/node.cxx
index 088b862..bbfca86 100644
--- a/main/sw/source/core/docnode/node.cxx
+++ b/main/sw/source/core/docnode/node.cxx
@@ -1041,7 +1041,9 @@
 	// der Abhaengikeitsliste raus!
 	// Daher muessen alle Frames in der Abhaengigkeitsliste geloescht werden.
 	if( GetDepends() )
-		DelFrms();
+		//IAccessibility2 Implementation 2009-----
+		DelFrms(sal_True, sal_False);
+		//-----IAccessibility2 Implementation 2009
 
     if( pCondColl )
 		delete pCondColl;
@@ -1368,12 +1370,77 @@
  */
 
 
-void SwCntntNode::DelFrms()
+//IAccessibility2 Implementation 2009-----
+//Solution:Add a input param to identify if the acc table should be disposed.
+//add a flag(bNeedDel) to indicate whether to del corresponding frm even in doc loading process, 
+//void SwCntntNode::DelFrms()
+void SwCntntNode::DelFrms( sal_Bool bNeedDel, sal_Bool bIsDisposeAccTable )
+//-----IAccessibility2 Implementation 2009
 {
 	if( !GetDepends() )
 		return;
 
-    SwCntntFrm::DelFrms(*this);
+	SwClientIter aIter( *this );
+	SwCntntFrm *pFrm;
+
+	for( pFrm = (SwCntntFrm*)aIter.First( TYPE(SwCntntFrm)); pFrm;
+		 pFrm = (SwCntntFrm*)aIter.Next() )
+	{
+        // --> OD 2005-12-01 #i27138#
+        // notify accessibility paragraphs objects about changed
+        // CONTENT_FLOWS_FROM/_TO relation.
+        // Relation CONTENT_FLOWS_FROM for current next paragraph will change
+        // and relation CONTENT_FLOWS_TO for current previous paragraph will change.
+        if ( pFrm->IsTxtFrm() )
+        {
+            ViewShell* pViewShell( pFrm->getRootFrm()->GetCurrShell() );
+            if ( pViewShell && pViewShell->GetLayout() &&
+                 pViewShell->GetLayout()->IsAnyShellAccessible() )
+            {
+                pViewShell->InvalidateAccessibleParaFlowRelation(
+                            dynamic_cast<SwTxtFrm*>(pFrm->FindNextCnt( true )),
+                            dynamic_cast<SwTxtFrm*>(pFrm->FindPrevCnt( true )) );
+            }
+        }
+        // <--
+        if( pFrm->HasFollow() )
+            pFrm->GetFollow()->_SetIsFollow( pFrm->IsFollow() );
+        if( pFrm->IsFollow() )
+        {
+            SwCntntFrm* pMaster = (SwTxtFrm*)pFrm->FindMaster();
+            pMaster->SetFollow( pFrm->GetFollow() );
+            pFrm->_SetIsFollow( sal_False );
+        }
+		pFrm->SetFollow( 0 );//Damit er nicht auf dumme Gedanken kommt.
+								//Andernfalls kann es sein, dass ein Follow
+								//vor seinem Master zerstoert wird, der Master
+								//greift dann ueber den ungueltigen
+								//Follow-Pointer auf fremdes Memory zu.
+								//Die Kette darf hier zerknauscht werden, weil
+								//sowieso alle zerstoert werden.
+		if( pFrm->GetUpper() && pFrm->IsInFtn() && !pFrm->GetIndNext() &&
+			!pFrm->GetIndPrev() )
+		{
+			SwFtnFrm *pFtn = pFrm->FindFtnFrm();
+			ASSERT( pFtn, "You promised a FtnFrm?" );
+			SwCntntFrm* pCFrm;
+			if( !pFtn->GetFollow() && !pFtn->GetMaster() &&
+				0 != ( pCFrm = pFtn->GetRefFromAttr()) && pCFrm->IsFollow() )
+			{
+				ASSERT( pCFrm->IsTxtFrm(), "NoTxtFrm has Footnote?" );
+				((SwTxtFrm*)pCFrm->FindMaster())->Prepare( PREP_FTN_GONE );
+			}
+		}
+		//IAccessibility2 Implementation 2009-----
+		//Solution:Set acc table dispose state
+		pFrm->SetAccTableDispose( bIsDisposeAccTable );
+		//End Added
+		pFrm->Cut();
+		//Solution:Set acc table dispose state to default value
+		pFrm->SetAccTableDispose( sal_True );
+		//-----IAccessibility2 Implementation 2009
+		delete pFrm;
+	}
 	if( IsTxtNode() )
 	{
         ((SwTxtNode*)this)->SetWrong( NULL );
diff --git a/main/sw/source/core/docnode/nodes.cxx b/main/sw/source/core/docnode/nodes.cxx
index 943816c..db39559 100644
--- a/main/sw/source/core/docnode/nodes.cxx
+++ b/main/sw/source/core/docnode/nodes.cxx
@@ -909,6 +909,17 @@
 			break;
 
 		case ND_TEXTNODE:
+			//IAccessibility2 Implementation 2009-----
+			//Solution:Add special function to text node.
+			{
+				if( bNewFrms && pAktNode->GetCntntNode() )
+					((SwCntntNode*)pAktNode)->DelFrms( sal_False );
+				pAktNode->pStartOfSection = aSttNdStack[ nLevel ];
+				nInsPos++;
+				aRg.aEnd--;
+			}
+			break;
+		    //-----IAccessibility2 Implementation 2009
 		case ND_GRFNODE:
 		case ND_OLENODE:
 			{
diff --git a/main/sw/source/core/edit/ednumber.cxx b/main/sw/source/core/edit/ednumber.cxx
index a3cd6fe..cd8951c 100644
--- a/main/sw/source/core/edit/ednumber.cxx
+++ b/main/sw/source/core/edit/ednumber.cxx
@@ -209,7 +209,7 @@
 
     return bResult;
 }
-//Sym3_879 add a new function to determine number on/off status
+//add a new function to determine number on/off status
 sal_Bool SwEditShell::SelectionHasBullet() const
 {
     sal_Bool bResult = HasBullet();
diff --git a/main/sw/source/core/frmedt/feshview.cxx b/main/sw/source/core/frmedt/feshview.cxx
index af948ab..f640eba 100644
--- a/main/sw/source/core/frmedt/feshview.cxx
+++ b/main/sw/source/core/frmedt/feshview.cxx
@@ -1020,6 +1020,27 @@
 					->IsObjMarked( const_cast< SdrObject * >( &rObj ) );
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwFEShell::IsObjSameLevelWithMarked(const SdrObject* pObj) const
+{
+	if (pObj)
+	{
+		const SdrMarkList& aMarkList = Imp()->GetDrawView()->GetMarkedObjectList();
+		if (aMarkList.GetMarkCount() == 0)
+		{
+			return sal_True;
+		}
+		SdrMark* pM=aMarkList.GetMark(0);
+		if (pM)
+		{
+			SdrObject* pMarkObj = pM->GetMarkedSdrObj();
+			if (pMarkObj && pMarkObj->GetUpGroup() == pObj->GetUpGroup())
+				return sal_True;
+		}
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
 |*
 |*	SwFEShell::EndTextEdit()
diff --git a/main/sw/source/core/frmedt/tblsel.cxx b/main/sw/source/core/frmedt/tblsel.cxx
index b3089b9..d57d121 100644
--- a/main/sw/source/core/frmedt/tblsel.cxx
+++ b/main/sw/source/core/frmedt/tblsel.cxx
@@ -2255,7 +2255,11 @@
 	pTab->bIsFollow = sal_False;
 }
 
-void _FndBox::DelFrms( SwTable &rTable )
+//IAccessibility2 Implementation 2009-----
+//Solution:When bAccTableDispose is FALSE,the acc table should not be disposed. 
+//void _FndBox::DelFrms( SwTable &rTable )
+void _FndBox::DelFrms( SwTable &rTable,sal_Bool bAccTableDispose )
+//-----IAccessibility2 Implementation 2009
 {
 	//Alle Lines zwischen pLineBefore und pLineBehind muessen aus dem
 	//Layout ausgeschnitten und geloescht werden.
@@ -2373,9 +2377,14 @@
                             // next turn.
                             ((SwTabFrm*)pTabFrm)->SetFollowFlowLine( sal_False );
                         }
-
+						//IAccessibility2 Implementation 2009-----
+						//Solution:Set acc table dispose state
+						pFrm->SetAccTableDispose( bAccTableDispose );
                         pFrm->Cut();
+						//Solution:Set acc table dispose state to default value.
+						pFrm->SetAccTableDispose( sal_True );
 						delete pFrm;
+						//-----IAccessibility2 Implementation 2009
 					}
 				}
 		}
diff --git a/main/sw/source/core/inc/SwPortionHandler.hxx b/main/sw/source/core/inc/SwPortionHandler.hxx
index f3527ac..86793d5 100644
--- a/main/sw/source/core/inc/SwPortionHandler.hxx
+++ b/main/sw/source/core/inc/SwPortionHandler.hxx
@@ -92,6 +92,10 @@
      * paragraph's portions have been processed. 
      */
     virtual void Finish() = 0;
+    //IAccessibility2 Implementation 2009-----
+    virtual void SetAttrFieldType( sal_uInt16 )
+    { return; }
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif
diff --git a/main/sw/source/core/inc/doctxm.hxx b/main/sw/source/core/inc/doctxm.hxx
index de9db92..1bf0e09 100644
--- a/main/sw/source/core/inc/doctxm.hxx
+++ b/main/sw/source/core/inc/doctxm.hxx
@@ -102,6 +102,9 @@
                  const bool        _bNewTOX = false ); // Formatieren
 	void UpdatePageNum();   			// Seitennummern einfuegen
 	TYPEINFO();							// fuers rtti
+//IAccessibility2 Implementation 2009-----
+	SwTOXSortTabBases* GetTOXSortTabBases() { return &aSortArr; }
+//-----IAccessibility2 Implementation 2009
 
 	sal_Bool SetPosAtStartEnd( SwPosition& rPos, sal_Bool bAtStart = sal_True ) const;
 };
diff --git a/main/sw/source/core/inc/frame.hxx b/main/sw/source/core/inc/frame.hxx
index d88063a..5165e8f 100644
--- a/main/sw/source/core/inc/frame.hxx
+++ b/main/sw/source/core/inc/frame.hxx
@@ -29,6 +29,11 @@
 #include "calbck.hxx"	// fuer SwClient
 #include <svl/brdcst.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/style/TabStop.hpp>
+#include <comphelper/stlunosequence.hxx>
+using namespace ::com::sun::star;
+//-----IAccessibility2 Implementation 2009
 class SwLayoutFrm;
 class SwRootFrm;
 class SwPageFrm;
@@ -292,6 +297,10 @@
 
 	//Cache fuer (Umrandungs-)Attribute.
 	static SwCache *pCache;
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Member to identify if acc table should be disposed
+	sal_Bool bIfAccTableShouldDisposing;
+	//-----IAccessibility2 Implementation 2009
 
     // --> OD 2006-05-10 #i65250#
     // frame ID is now in general available - used for layout loop control
@@ -415,6 +424,12 @@
 	sal_Bool bRetouche:			1;	//Der Frame ist fuer Retusche verantwortlich
 								//wenn sal_True.
 public:
+	//IAccessibility2 Implementation 2009-----
+	virtual uno::Sequence< style::TabStop >  GetTabStopInfo( SwTwips )
+	{
+		return uno::Sequence< style::TabStop >();
+	}
+	//-----IAccessibility2 Implementation 2009
     sal_Bool bUnUsed2:          1;
 protected:
 	sal_Bool bInfInvalid:		1;	//InfoFlags sind Invalid.
@@ -769,6 +784,10 @@
 	virtual Size ChgSize( const Size& aNewSize );
 
 	virtual void Cut() = 0;
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add a method to change the acc table dispose state.
+	void SetAccTableDispose( sal_Bool bDispose){ bIfAccTableShouldDisposing = bDispose;}
+	//-----IAccessibility2 Implementation 2009
 	virtual void Paste( SwFrm* pParent, SwFrm* pSibling = 0 ) = 0;
 
 	void ValidateLineNum() { bValidLineNum = sal_True; }
diff --git a/main/sw/source/core/inc/txtfrm.hxx b/main/sw/source/core/inc/txtfrm.hxx
index 987bc61..5a5f86b 100644
--- a/main/sw/source/core/inc/txtfrm.hxx
+++ b/main/sw/source/core/inc/txtfrm.hxx
@@ -26,7 +26,9 @@
 #include <tools/mempool.hxx>
 #include <tools/string.hxx>
 #include "cntfrm.hxx"
-
+//IAccessibility2 Implementation 2009-----
+#include "com/sun/star/uno/Sequence.hxx"
+//-----IAccessibility2 Implementation 2009
 #define STRSIZE(x) (sizeof(x)-1)
 
 class SwCharRange;
@@ -229,6 +231,9 @@
 
 public:
 
+	//IAccessibility2 Implementation 2009-----
+	com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >  GetTabStopInfo( SwTwips CurrentPos );
+	//-----IAccessibility2 Implementation 2009
 	//public, weil der eine oder andere die Methode rufen darf um das
 	//Prepare zu sparen - mit Vorsicht zu geniessen!
 	void Init();
diff --git a/main/sw/source/core/inc/viewimp.hxx b/main/sw/source/core/inc/viewimp.hxx
index 972c85c..ea98458 100644
--- a/main/sw/source/core/inc/viewimp.hxx
+++ b/main/sw/source/core/inc/viewimp.hxx
@@ -286,6 +286,12 @@
 
 	inline void AddAccessibleObj( const SdrObject *pObj );
 
+	//IAccessibility2 Implementation 2009-----
+	void FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage);
+	void FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection);
+	void FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn);
+	//-----IAccessibility2 Implementation 2009
+
 	// Invalidate accessible frame's frame's content
 	void InvalidateAccessibleFrmContent( const SwFrm *pFrm );
 
diff --git a/main/sw/source/core/layout/atrfrm.cxx b/main/sw/source/core/layout/atrfrm.cxx
index 450ed5f..35f25fe 100644
--- a/main/sw/source/core/layout/atrfrm.cxx
+++ b/main/sw/source/core/layout/atrfrm.cxx
@@ -3294,3 +3294,19 @@
 	return 0;
 }
 
+sal_Bool SwFrmFmt::HasCaption() const
+{
+	if(pCaptionFmt != NULL && pCaptionFmt->GetDepends())
+		return sal_True;
+	return sal_False;
+}
+
+void SwFrmFmt::SetCaptionFmt(SwFrmFmt * pFmt)
+{
+	pCaptionFmt = pFmt;
+}
+
+SwFrmFmt* SwFrmFmt::GetCaptionFmt() const
+{
+	return pCaptionFmt;
+}
diff --git a/main/sw/source/core/layout/wsfrm.cxx b/main/sw/source/core/layout/wsfrm.cxx
index 7cdec34..1d3afab 100644
--- a/main/sw/source/core/layout/wsfrm.cxx
+++ b/main/sw/source/core/layout/wsfrm.cxx
@@ -96,6 +96,10 @@
     pNext( 0 ),
     pPrev( 0 ),
     pDrawObjs( 0 )
+	//IAccessibility2 Implementation 2009-----
+	//Solution:Add a member to identify if the acc table should dispose
+	, bIfAccTableShouldDisposing( sal_False )
+	//-----IAccessibility2 Implementation 2009
     , bInfBody( sal_False )
     , bInfTab ( sal_False )
     , bInfFly ( sal_False )
diff --git a/main/sw/source/core/ole/ndole.cxx b/main/sw/source/core/ole/ndole.cxx
index 407c675..ba7e084 100644
--- a/main/sw/source/core/ole/ndole.cxx
+++ b/main/sw/source/core/ole/ndole.cxx
@@ -794,6 +794,15 @@
 	}
 }
 
+//IAccessibility2 Implementation 2009-----
+String SwOLEObj::GetStyleString()
+{
+	String strStyle;
+	if (xOLERef.is() && xOLERef.IsChart())
+		strStyle = xOLERef.GetChartType();
+	return strStyle;
+}
+//-----IAccessibility2 Implementation 2009
 sal_Bool SwOLEObj::IsOleRef() const
 {
     return xOLERef.is();
diff --git a/main/sw/source/core/text/frmform.cxx b/main/sw/source/core/text/frmform.cxx
index 31f1c30..d505579 100644
--- a/main/sw/source/core/text/frmform.cxx
+++ b/main/sw/source/core/text/frmform.cxx
@@ -57,6 +57,11 @@
 #include <frmfmt.hxx>	  	// SwFrmFmt
 // OD 2004-05-24 #i28701#
 #include <sortedobjs.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <portab.hxx>
+#include <editeng/lrspitem.hxx>
+#include <editeng/tstpitem.hxx>
+//-----IAccessibility2 Implementation 2009
 
 class FormatLevel
 {
@@ -556,6 +561,47 @@
     UNDO_SWAP( this )
 }
 
+//IAccessibility2 Implementation 2009-----
+com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > SwTxtFrm::GetTabStopInfo( SwTwips CurrentPos )
+{
+	com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop > tabs(1);
+	::com::sun::star::style::TabStop ts;
+
+	SwTxtFormatInfo 	aInf( this );
+	SwTxtFormatter		aLine( this, &aInf );
+	SwTxtCursor  		TxtCursor( this, &aInf );
+	const Point aCharPos( TxtCursor.GetTopLeft() );
+
+
+	SwTwips nRight = aLine.Right();
+	CurrentPos -= aCharPos.X();
+	
+	// get current tab stop information stored in the Frm 
+	const SvxTabStop *pTS = aLine.GetLineInfo().GetTabStop( CurrentPos, nRight );
+
+	if( !pTS )
+	{
+		return com::sun::star::uno::Sequence< ::com::sun::star::style::TabStop >();
+	}
+	
+	// copy tab stop information into a Sequence, which only contains one element.
+	ts.Position = pTS->GetTabPos();
+	ts.DecimalChar = pTS->GetDecimal();
+	ts.FillChar = pTS->GetFill();
+    switch( pTS->GetAdjustment() )
+    {
+    case SVX_TAB_ADJUST_LEFT   : ts.Alignment = ::com::sun::star::style::TabAlign_LEFT; break;
+    case SVX_TAB_ADJUST_CENTER : ts.Alignment = ::com::sun::star::style::TabAlign_CENTER; break;
+    case SVX_TAB_ADJUST_RIGHT  : ts.Alignment = ::com::sun::star::style::TabAlign_RIGHT; break;
+    case SVX_TAB_ADJUST_DECIMAL: ts.Alignment = ::com::sun::star::style::TabAlign_DECIMAL; break;
+    case SVX_TAB_ADJUST_DEFAULT: ts.Alignment = ::com::sun::star::style::TabAlign_DEFAULT; break;
+    default: break; // prevent warning
+    }
+	
+	tabs[0] = ts;
+	return tabs;
+}
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
  *						SwTxtFrm::AdjustFollow()
  *************************************************************************/
diff --git a/main/sw/source/core/text/porfld.cxx b/main/sw/source/core/text/porfld.cxx
index 9a5ea0a..8f7f672 100644
--- a/main/sw/source/core/text/porfld.cxx
+++ b/main/sw/source/core/text/porfld.cxx
@@ -91,6 +91,9 @@
     , m_bNoLength( sal_False )
 {
     SetWhichPor( POR_FLD );
+	//IAccessibility2 Implementation 2009-----
+	m_nAttrFldType = 0;
+	//-----IAccessibility2 Implementation 2009
 }
 
 SwFldPortion::SwFldPortion( const SwFldPortion& rFld )
@@ -481,6 +484,12 @@
 void SwFldPortion::HandlePortion( SwPortionHandler& rPH ) const
 {
     rPH.Special( GetLen(), aExpand, GetWhichPor() );
+    //IAccessibility2 Implementation 2009-----
+    if( GetWhichPor() == POR_FLD )
+    {
+    	rPH.SetAttrFieldType(m_nAttrFldType);
+    }
+    //-----IAccessibility2 Implementation 2009
 }
 
 /*************************************************************************
diff --git a/main/sw/source/core/text/porfld.hxx b/main/sw/source/core/text/porfld.hxx
index 9e9db71..258316a 100644
--- a/main/sw/source/core/text/porfld.hxx
+++ b/main/sw/source/core/text/porfld.hxx
@@ -65,6 +65,9 @@
     SwFldPortion( const XubString &rExpand, SwFont *pFnt = 0, sal_Bool bPlaceHolder = sal_False );
 	~SwFldPortion();
 
+	//IAccessibility2 Implementation 2009-----
+	sal_uInt16 m_nAttrFldType;
+	//-----IAccessibility2 Implementation 2009
 	void TakeNextOffset( const SwFldPortion* pFld );
 	void CheckScript( const SwTxtSizeInfo &rInf );
 	inline sal_Bool HasFont() const { return 0 != pFnt; }
diff --git a/main/sw/source/core/text/txtfld.cxx b/main/sw/source/core/text/txtfld.cxx
index 38e222a..b98addb 100644
--- a/main/sw/source/core/text/txtfld.cxx
+++ b/main/sw/source/core/text/txtfld.cxx
@@ -59,6 +59,14 @@
 #include "fmtmeta.hxx" // lcl_NewMetaPortion
 
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _REFFLD_HXX
+#include "reffld.hxx"
+#endif
+#ifndef _FLDDAT_HXX
+#include "flddat.hxx"
+#endif
+//-----IAccessibility2 Implementation 2009
 /*************************************************************************
  *                      SwTxtFormatter::NewFldPortion()
  *************************************************************************/
@@ -90,7 +98,9 @@
 	SwCharFmt* pChFmt = 0;
 	sal_Bool bNewFlyPor = sal_False,
 		 bINet = sal_False;
-
+	//IAccessibility2 Implementation 2009-----
+	sal_uInt16 subType;
+	//-----IAccessibility2 Implementation 2009
 	// set language
 	((SwTxtFormatter*)this)->SeekAndChg( rInf );
 	if (pFld->GetLanguage() != GetFnt()->GetLanguage())
@@ -162,7 +172,11 @@
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion( str );
             }
-			break;
+            //IAccessibility2 Implementation 2009-----
+            if(pRet)
+                ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGECOOUNTFLD;
+            //-----IAccessibility2 Implementation 2009
+            break;
 
 		case RES_PAGENUMBERFLD:
 		{
@@ -188,7 +202,11 @@
                         : pFld->ExpandField(bInClipboard) );
                 pRet = new SwFldPortion( str );
             }
-			break;
+            //IAccessibility2 Implementation 2009-----
+            if(pRet)
+                ((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_PAGENUMBERFLD;
+            //-----IAccessibility2 Implementation 2009
+            break;
 		}
 		case RES_GETEXPFLD:
 		{
@@ -263,7 +281,40 @@
 			bNewFlyPor = sal_True;
             bPlaceHolder = sal_True;
 			break;
-
+		//IAccessibility2 Implementation 2009-----
+		case RES_GETREFFLD:
+			subType = ((SwGetRefField*)pFld)->GetSubType();			
+            {
+                String const str( (bName)
+                        ? pFld->GetFieldName()
+                        : pFld->ExpandField(bInClipboard) );
+                pRet = new SwFldPortion(str);
+            }
+            if(pRet)
+			{
+				if( subType == REF_BOOKMARK  )
+                    ((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_BOOKMARKFLD;
+				else if( subType == REF_SETREFATTR )
+					((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_SETREFATTRFLD;
+				break;
+			}
+		case RES_DATETIMEFLD:
+			subType = ((SwDateTimeField*)pFld)->GetSubType();
+            {
+                String const str( (bName)
+                        ? pFld->GetFieldName()
+                        : pFld->ExpandField(bInClipboard) );
+                pRet = new SwFldPortion(str);
+            }
+            if(pRet)
+			{
+				if( subType & DATEFLD  )
+					((SwFldPortion*)pRet)->m_nAttrFldType= ATTR_DATEFLD;
+				else if( subType & TIMEFLD )
+					((SwFldPortion*)pRet)->m_nAttrFldType = ATTR_TIMEFLD;
+				break;
+			}
+		//-----IAccessibility2 Implementation 2009
 		default:
             {
                 String const str( (bName)
diff --git a/main/sw/source/core/unocore/unomap.cxx b/main/sw/source/core/unocore/unomap.cxx
index fbf09a9..3cfb510 100644
--- a/main/sw/source/core/unocore/unomap.cxx
+++ b/main/sw/source/core/unocore/unomap.cxx
@@ -482,6 +482,32 @@
                     { SW_PROP_NMID(UNO_NAME_IS_FIELD_USED),      FIELD_PROP_IS_FIELD_USED,      CPPU_E2T(CPPUTYPE_FLOAT), PropertyAttribute::READONLY, 0},\
                     { SW_PROP_NMID(UNO_NAME_IS_FIELD_DISPLAYED), FIELD_PROP_IS_FIELD_DISPLAYED, CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::READONLY, 0},\
 
+//IAccessibility2 Implementation 2009-----
+#define COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE \
+					{ SW_PROP_NMID(UNO_NAME_CHAR_BACK_COLOR), RES_CHRATR_BACKGROUND, 	CPPU_E2T(CPPUTYPE_INT32),			PROPERTY_NONE ,MID_BACK_COLOR		 },	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_COLOR), RES_CHRATR_COLOR, 		CPPU_E2T(CPPUTYPE_INT32),			PROPERTY_NONE, 0},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_CONTOURED), RES_CHRATR_CONTOUR, 	CPPU_E2T(CPPUTYPE_BOOLEAN)  ,  		PROPERTY_NONE, 0},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_EMPHASIS), RES_CHRATR_EMPHASIS_MARK,           CPPU_E2T(CPPUTYPE_INT16),   PROPERTY_NONE, MID_EMPHASIS},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_ESCAPEMENT), RES_CHRATR_ESCAPEMENT,  CPPU_E2T(CPPUTYPE_INT16),  			PROPERTY_NONE, MID_ESC			},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_FONT_NAME), RES_CHRATR_FONT,		CPPU_E2T(CPPUTYPE_OUSTRING),  PropertyAttribute::MAYBEVOID, MID_FONT_FAMILY_NAME },	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_HEIGHT), RES_CHRATR_FONTSIZE  ,  CPPU_E2T(CPPUTYPE_FLOAT),			PropertyAttribute::MAYBEVOID, MID_FONTHEIGHT|CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_POSTURE), RES_CHRATR_POSTURE   ,  CPPU_E2T(CPPUTYPE_FONTSLANT),  		PropertyAttribute::MAYBEVOID, MID_POSTURE},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_SHADOWED), RES_CHRATR_SHADOWED  ,  CPPU_E2T(CPPUTYPE_BOOLEAN)  ,  		PROPERTY_NONE, 0},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_STRIKEOUT), RES_CHRATR_CROSSEDOUT,  CPPU_E2T(CPPUTYPE_INT16),					PropertyAttribute::MAYBEVOID, MID_CROSS_OUT},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE_COLOR), RES_CHRATR_UNDERLINE ,  CPPU_E2T(CPPUTYPE_INT32),            PropertyAttribute::MAYBEVOID, MID_TL_COLOR},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_WEIGHT), RES_CHRATR_WEIGHT    ,  CPPU_E2T(CPPUTYPE_FLOAT),  			PropertyAttribute::MAYBEVOID, MID_WEIGHT},	\
+					{ SW_PROP_NMID(UNO_NAME_NUMBERING_LEVEL), RES_PARATR_LIST_LEVEL,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, 0},	\
+					{ SW_PROP_NMID(UNO_NAME_CHAR_UNDERLINE), RES_CHRATR_UNDERLINE ,  CPPU_E2T(CPPUTYPE_INT16),              PropertyAttribute::MAYBEVOID, MID_TL_STYLE},	\
+					{ SW_PROP_NMID(UNO_NAME_NUMBERING_RULES), RES_PARATR_NUMRULE,CPPU_E2T(CPPUTYPE_INT16), PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_ADJUST), RES_PARATR_ADJUST,      CPPU_E2T(CPPUTYPE_INT16),         PropertyAttribute::MAYBEVOID, MID_PARA_ADJUST},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_BOTTOM_MARGIN), RES_UL_SPACE,          CPPU_E2T(CPPUTYPE_INT32),           PropertyAttribute::MAYBEVOID, MID_LO_MARGIN|CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_FIRST_LINE_INDENT), RES_LR_SPACE,           CPPU_E2T(CPPUTYPE_INT32),      PropertyAttribute::MAYBEVOID, MID_FIRST_LINE_INDENT|CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_LEFT_MARGIN), RES_LR_SPACE,            CPPU_E2T(CPPUTYPE_INT32),           PropertyAttribute::MAYBEVOID, MID_TXT_LMARGIN|CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_LINE_SPACING), RES_PARATR_LINESPACING, CPPU_E2T(CPPUTYPE_LINESPACE),       PropertyAttribute::MAYBEVOID,     CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_PARA_RIGHT_MARGIN), RES_LR_SPACE,           CPPU_E2T(CPPUTYPE_INT32),           PropertyAttribute::MAYBEVOID, MID_R_MARGIN|CONVERT_TWIPS},	\
+					{ SW_PROP_NMID(UNO_NAME_TABSTOPS), RES_PARATR_TABSTOP,   CPPU_E2T(CPPUTYPE_SEQTABSTOP),   PropertyAttribute::MAYBEVOID, CONVERT_TWIPS},	\
+
+//-----IAccessibility2 Implementation 2009
 
 const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(sal_uInt16 nPropertyId)
 {
@@ -500,6 +526,18 @@
                 aMapEntriesArr[nPropertyId] = aCharAndParaMap_Impl;
 			}
 			break;
+			//IAccessibility2 Implementation 2009-----
+			case PROPERTY_MAP_ACCESSIBILITY_TEXT_ATTRIBUTE:
+			{
+                static SfxItemPropertyMapEntry aAccessibilityTextAttrMap_Impl[] =
+				{
+					COMMON_ACCESSIBILITY_TEXT_ATTRIBUTE
+					{0,0,0,0,0,0}
+				};
+                aMapEntriesArr[nPropertyId] = aAccessibilityTextAttrMap_Impl;
+			}
+			break;
+			//-----IAccessibility2 Implementation 2009
 			case PROPERTY_MAP_PARAGRAPH:
 			{
                 static SfxItemPropertyMapEntry aParagraphMap_Impl[] =
diff --git a/main/sw/source/core/view/viewimp.cxx b/main/sw/source/core/view/viewimp.cxx
index 1336572..bda5284 100644
--- a/main/sw/source/core/view/viewimp.cxx
+++ b/main/sw/source/core/view/viewimp.cxx
@@ -446,6 +446,24 @@
 	} while ( pTmp != pVSh );
 }
 
+//IAccessibility2 Implementation 2009-----
+void SwViewImp::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage)
+{
+	if( IsAccessible() )
+		GetAccessibleMap().FirePageChangeEvent( nOldPage, nNewPage);
+}
+
+void SwViewImp::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection)
+{
+	if( IsAccessible() )
+		GetAccessibleMap().FireSectionChangeEvent(nOldSection, nNewSection);
+}
+void SwViewImp::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn)
+{
+	if( IsAccessible() )
+		GetAccessibleMap().FireColumnChangeEvent(nOldColumn,  nNewColumn);
+}
+//-----IAccessibility2 Implementation 2009
 void SwViewImp::InvalidateAccessibleFrmContent( const SwFrm *pFrm )
 {
 	ASSERT( pFrm->IsAccessibleFrm(), "frame is not accessible" );
diff --git a/main/sw/source/filter/ww8/wrtw8esh.cxx b/main/sw/source/filter/ww8/wrtw8esh.cxx
index d054ec1..8405e2a 100644
--- a/main/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/main/sw/source/filter/ww8/wrtw8esh.cxx
@@ -2011,7 +2011,7 @@
             {
                 const SvxShadowItem* pSI = (const SvxShadowItem*)pShadItem;
 
-                const sal_uInt16 nCstScale = 635;        // unit scale between SODC and MS Word
+                const sal_uInt16 nCstScale = 635;        // unit scale between AOO and MS Word
                 const sal_uInt32 nShadowType = 131074;    // shadow type of ms word. need to set the default value.
 
                 sal_uInt32  nColor = (sal_uInt32)(pSI->GetColor().GetColor()) ;
diff --git a/main/sw/source/ui/app/docsh.cxx b/main/sw/source/ui/app/docsh.cxx
index 9d44411..39a6cc9 100644
--- a/main/sw/source/ui/app/docsh.cxx
+++ b/main/sw/source/ui/app/docsh.cxx
@@ -103,6 +103,9 @@
 #include <unotools/fltrcfg.hxx>
 #include <svtools/htmlcfg.hxx>
 #include <sfx2/fcontnr.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <sfx2/viewfrm.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <sfx2/objface.hxx>
 #include <comphelper/storagehelper.hxx>
 
@@ -401,6 +404,22 @@
 {
 	RTL_LOGFILE_CONTEXT_AUTHOR( aLog, "SW", "JP93722",  "SwDocShell::SaveAs" );
 
+	//IAccessibility2 Implementation 2009-----
+	pDoc->setDocAccTitle(String());
+    SfxViewFrame* pFrame1 = SfxViewFrame::GetFirst( this );
+	if (pFrame1)
+	{
+		Window* pWindow = &pFrame1->GetWindow();
+		if ( pWindow )
+		{
+			Window* pSysWin = pWindow->GetSystemWindow();
+			if ( pSysWin )
+			{
+				pSysWin->SetAccessibleName(String());
+			}
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 	SwWait aWait( *this, sal_True );
     //#i3370# remove quick help to prevent saving of autocorrection suggestions
     if(pView)
@@ -1266,6 +1285,43 @@
 /* -----------------------------12.02.01 12:08--------------------------------
 
  ---------------------------------------------------------------------------*/
+//IAccessibility2 Implementation 2009-----
+void SwDocShell::setDocAccTitle( const String& rTitle )
+{ 
+	if (pDoc ) 
+	{
+		pDoc->setDocAccTitle( rTitle );
+	}
+}
+const String SwDocShell::getDocAccTitle() const
+{
+	String sRet;
+	if  (pDoc)
+	{
+		sRet =  pDoc->getDocAccTitle(); 
+	}
+
+	return sRet;
+}
+
+void SwDocShell::setDocReadOnly( sal_Bool bReadOnly)
+{ 
+	if (pDoc ) 
+	{
+		pDoc->setDocReadOnly( bReadOnly );
+	}
+}
+sal_Bool SwDocShell::getDocReadOnly() const
+{
+	if  (pDoc)
+	{
+		return pDoc->getDocReadOnly(); 
+	}
+	
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009
+
 static const char* s_EventNames[] =
 {
 	"OnPageCountChange",
diff --git a/main/sw/source/ui/cctrl/actctrl.cxx b/main/sw/source/ui/cctrl/actctrl.cxx
index 5b4e014..8a1c04c 100644
--- a/main/sw/source/ui/cctrl/actctrl.cxx
+++ b/main/sw/source/ui/cctrl/actctrl.cxx
@@ -105,8 +105,13 @@
 		SetText(sTemp);
 		SetSelection(aSel);
 	}
+//IAccessibility2 Impplementaton 2009-----
+	Edit::Modify();
+	/*
 	if(GetModifyHdl().IsSet())
 		GetModifyHdl().Call(this);
+		*/
+//-----IAccessibility2 Impplementaton 2009
 }
 /* -----------------25.06.2003 15:57-----------------
 
diff --git a/main/sw/source/ui/cctrl/swlbox.cxx b/main/sw/source/ui/cctrl/swlbox.cxx
index 735fa6f..0a8da87 100644
--- a/main/sw/source/ui/cctrl/swlbox.cxx
+++ b/main/sw/source/ui/cctrl/swlbox.cxx
@@ -223,5 +223,11 @@
 	return aTxt;
 }
 
-
-
+//IAccessibility2 Impplementaton 2009-----
+void SwComboBox::SetText( const XubString& rStr )
+{
+	ComboBox::SetText(rStr);
+	// MT: CallEventListeners stay protected for now. Probably not needed at all, as the implementation of VCLXAccessibelEdit/ComboBox should do it on text changed nowadays anyway. Verify.
+	// CallEventListeners( VCLEVENT_EDIT_MODIFY );
+}
+//-----IAccessibility2 Impplementaton 2009
diff --git a/main/sw/source/ui/chrdlg/swuiccoll.cxx b/main/sw/source/ui/chrdlg/swuiccoll.cxx
index 0ccb09d..f916321 100644
--- a/main/sw/source/ui/chrdlg/swuiccoll.cxx
+++ b/main/sw/source/ui/chrdlg/swuiccoll.cxx
@@ -127,12 +127,17 @@
 			break;
 	}
 
-	const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList();
-	for( i = 0; i < rFilterList.Count(); ++i)
+//IAccessibility2 Impplementaton 2009-----
+	if( pFamilyItem )
 	{
-		aFilterLB.InsertEntry(rFilterList.GetObject(i)->aName);
-		sal_uInt16* pFilter = new sal_uInt16(rFilterList.GetObject(i)->nFlags);
-		aFilterLB.SetEntryData(i, pFilter);
+		const SfxStyleFilter& rFilterList = pFamilyItem->GetFilterList();
+		for( i = 0; i < rFilterList.Count(); ++i)
+		{
+			aFilterLB.InsertEntry(rFilterList.GetObject(i)->aName);
+			sal_uInt16* pFilter = new sal_uInt16(rFilterList.GetObject(i)->nFlags);
+			aFilterLB.SetEntryData(i, pFilter);
+		}
+//-----IAccessibility2 Impplementaton 2009
 	}
 	aFilterLB.SelectEntryPos(1);
 
diff --git a/main/sw/source/ui/dialog/uiregionsw.cxx b/main/sw/source/ui/dialog/uiregionsw.cxx
index 0b092a4..e1b9408 100644
--- a/main/sw/source/ui/dialog/uiregionsw.cxx
+++ b/main/sw/source/ui/dialog/uiregionsw.cxx
@@ -457,6 +457,9 @@
 	aPasswdPB.SetAccessibleRelationMemberOf(&aProtectFL);
 	aPasswdPB.SetAccessibleRelationLabeledBy(&aPasswdCB);
     aSubRegionED.SetAccessibleName(aSubRegionFT.GetText());
+//IAccessibility2 Impplementaton 2009-----
+	aTree.SetAllEntriesAccessibleRoleType(TREEBOX_ALLITEM_ACCROLE_TYPE_TREE);
+//-----IAccessibility2 Impplementaton 2009
 }
 /* -----------------------------26.04.01 14:56--------------------------------
 
diff --git a/main/sw/source/ui/docvw/edtwin.cxx b/main/sw/source/ui/docvw/edtwin.cxx
index a688cea..8ff4bb3 100644
--- a/main/sw/source/ui/docvw/edtwin.cxx
+++ b/main/sw/source/ui/docvw/edtwin.cxx
@@ -5730,3 +5730,17 @@
         return Selection( nPos - nStartPos, nPos - nStartPos );
     }
 }
+//IAccessibility2 Implementation 2009-----
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void SwEditWin::SwitchView()
+{
+#ifdef ACCESSIBLE_LAYOUT
+	if (!Application::IsAccessibilityEnabled())
+	{
+		return ;
+	}
+	rView.GetWrtShell().InvalidateAccessibleFocus();
+#endif
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/ui/docvw/edtwin3.cxx b/main/sw/source/ui/docvw/edtwin3.cxx
index cdc6e32..2bef6ed 100644
--- a/main/sw/source/ui/docvw/edtwin3.cxx
+++ b/main/sw/source/ui/docvw/edtwin3.cxx
@@ -142,6 +142,34 @@
     return !rRuler.StartDocDrag( rMEvt, RULER_TYPE_INDENT);
 }
 // <--
+//IAccessibility2 Impplementaton 2009-----
+void AccessibilityScrollMDI(ViewShell* pVwSh, const SwRect& rRect , sal_uInt16 nRangeX, sal_uInt16 nRangeY, sal_Bool isLeftTop)
+{
+	SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
+	if (pSfxVwSh && pSfxVwSh->ISA(SwView))
+	{
+		SwView* pView = (SwView *)pSfxVwSh;
+
+		Size aSz( rRect.Left(), rRect.Top());
+		aSz = pView->GetEditWin().PixelToLogic( aSz );
+
+		Point aTopLeft( aSz.Width(), aSz.Height() );
+		Point aPoint;
+		Rectangle aRect(aTopLeft,aPoint);
+
+		sal_Bool bIsCrsrAtTop = pView->IsCrsrAtTop();
+		sal_Bool bIsCrsrAtCenter = pView->IsCrsrAtCenter();
+		if(isLeftTop)
+			pView->SetCrsrAtTop(sal_True);
+
+		pView->Scroll( aRect, nRangeX, nRangeY );
+
+		if(isLeftTop)
+			pView->SetCrsrAtTop(bIsCrsrAtTop, bIsCrsrAtCenter);
+	}
+
+}
+//-----IAccessibility2 Impplementaton 2009
 
 LAYOUT_NS Dialog* GetSearchDialog()
 {
diff --git a/main/sw/source/ui/frmdlg/column.cxx b/main/sw/source/ui/frmdlg/column.cxx
index 06e59f9..135f444 100644
--- a/main/sw/source/ui/frmdlg/column.cxx
+++ b/main/sw/source/ui/frmdlg/column.cxx
@@ -517,8 +517,35 @@
 							| WB_ITEMBORDER
 							| WB_DOUBLEBORDER );
 
+//IAccessibility2 Impplementaton 2009-----
     for( i = 0; i < 5; i++)
-		aDefaultVS.InsertItem( i + 1, i );
+		//Solution:Set accessible name one be one
+		//aDefaultVS.InsertItem( i + 1, i );
+		{
+			String aItemText;
+			switch( i )
+			{
+				case 0:
+					aItemText =  SW_RESSTR( STR_COLUMN_VALUESET_ITEM0 ) ;
+					break;
+				case 1:
+					aItemText =  SW_RESSTR( STR_COLUMN_VALUESET_ITEM1 ) ;
+					break;
+				case 2:
+					aItemText =  SW_RESSTR( STR_COLUMN_VALUESET_ITEM2 ) ;
+					break;
+				case 3:
+					aItemText =  SW_RESSTR( STR_COLUMN_VALUESET_ITEM3 );
+					break;
+				case 4:
+					aItemText =  SW_RESSTR( STR_COLUMN_VALUESET_ITEM4 );
+					break;
+				default:
+					break;	
+			}
+			aDefaultVS.InsertItem( i + 1,  aItemText, i );
+		}
+//-----IAccessibility2 Impplementaton 2009
 
 	aDefaultVS.SetSelectHdl(LINK(this, SwColumnPage, SetDefaultsHdl));
 
@@ -968,7 +995,14 @@
 	// #i17816# changing the displayed types within the ValueSet
 	//from two columns to two columns with different settings doesn't invalidate the
 	// example windows in ::ColModify()
-    if(!pNF ||(pColMgr->GetCount() != nCols))
+//IAccessibility2 Impplementaton 2009-----
+// the pColMgr->GetCount()'s return is some how bugged,
+// it will return 0 when actual count is 1, so fix it.
+    //if(!pNF ||(pColMgr->GetCount() != nCols))
+	int nTemp = pColMgr->GetCount();
+	if(nTemp == 0) nTemp = 1;
+    if( nTemp != nCols )
+//-----IAccessibility2 Impplementaton 2009
     {
         if(pNF)
             aDefaultVS.SetNoSelection();
diff --git a/main/sw/source/ui/frmdlg/column.hrc b/main/sw/source/ui/frmdlg/column.hrc
index 79a3fa7..d31a3a1 100644
--- a/main/sw/source/ui/frmdlg/column.hrc
+++ b/main/sw/source/ui/frmdlg/column.hrc
@@ -75,8 +75,15 @@
 #define FT_TEXTDIRECTION        60
 #define LB_TEXTDIRECTION        61
 #define FL_VERT                 62
+//IAccessibility2 Impplementaton 2009-----
+#define STR_PAGESETUP_SPACING		32765
+//-----IAccessibility2 Impplementaton 2009
 #define LISTBOX_SELECTION		0
 #define LISTBOX_SECTION			1
 #define LISTBOX_SECTIONS		2
 #define LISTBOX_PAGE			3
 #define LISTBOX_FRAME			4
+
+//IAccessibility2 Impplementaton 2009-----
+#define STR_COLUMN_WIDTH	63
+//-----IAccessibility2 Impplementaton 2009
diff --git a/main/sw/source/ui/frmdlg/frmpage.cxx b/main/sw/source/ui/frmdlg/frmpage.cxx
index 24541d2..24c4c5b 100644
--- a/main/sw/source/ui/frmdlg/frmpage.cxx
+++ b/main/sw/source/ui/frmdlg/frmpage.cxx
@@ -639,11 +639,15 @@
 
 namespace
 {
-	void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto )
+	//IAccessibility2 Implementation 2009-----
+	void HandleAutoCB( sal_Bool _bChecked, FixedText& _rFT_man, FixedText& _rFT_auto, PercentField& _rPF_Edit)
 	{
 		_rFT_man.Show( !_bChecked );
 		_rFT_auto.Show( _bChecked );
+		String accName = _bChecked ? _rFT_auto.GetText() : _rFT_man.GetText();
+		_rPF_Edit.SetAccessibleName(accName);
 	}
+	//-----IAccessibility2 Implementation 2009
 }
 
 
@@ -2091,14 +2095,18 @@
 IMPL_LINK( SwFrmPage, AutoWidthClickHdl, void*, EMPTYARG )
 {
 	if( !IsInGraficMode() )
-		HandleAutoCB( aAutoWidthCB.IsChecked(), aWidthFT, aWidthAutoFT );
+		//IAccessibility2 Implementation 2009-----
+		HandleAutoCB( aAutoWidthCB.IsChecked(), aWidthFT, aWidthAutoFT, aWidthED );
+		//-----IAccessibility2 Implementation 2009
 	return 0;
 }
 
 IMPL_LINK( SwFrmPage, AutoHeightClickHdl, void*, EMPTYARG )
 {
 	if( !IsInGraficMode() )
-		HandleAutoCB( aAutoHeightCB.IsChecked(), aHeightFT, aHeightAutoFT );
+		//IAccessibility2 Implementation 2009-----
+		HandleAutoCB( aAutoHeightCB.IsChecked(), aHeightFT, aHeightAutoFT, aWidthED );
+		//-----IAccessibility2 Implementation 2009
 	return 0;
 }
 
@@ -2247,14 +2255,18 @@
 		SwFrmSize eSize = rSize.GetHeightSizeType();
 		sal_Bool bCheck = eSize != ATT_FIX_SIZE;
 		aAutoHeightCB.Check( bCheck );
-		HandleAutoCB( bCheck, aHeightFT, aHeightAutoFT );
+		//IAccessibility2 Implementation 2009-----
+		HandleAutoCB( bCheck, aHeightFT, aHeightAutoFT, aWidthED );
+		//-----IAccessibility2 Implementation 2009
 		if( eSize == ATT_VAR_SIZE )
 			aHeightED.SetValue( aHeightED.GetMin(), FUNIT_NONE );
 
 		eSize = rSize.GetWidthSizeType();
 		bCheck = eSize != ATT_FIX_SIZE;
 		aAutoWidthCB.Check( bCheck );
-		HandleAutoCB( bCheck, aWidthFT, aWidthAutoFT );
+		//IAccessibility2 Implementation 2009-----
+		HandleAutoCB( bCheck, aWidthFT, aWidthAutoFT, aWidthED );
+		//-----IAccessibility2 Implementation 2009
 		if( eSize == ATT_VAR_SIZE )
 			aWidthED.SetValue( aWidthED.GetMin(), FUNIT_NONE );
 
diff --git a/main/sw/source/ui/inc/conttree.hxx b/main/sw/source/ui/inc/conttree.hxx
index 1260884..027e337 100644
--- a/main/sw/source/ui/inc/conttree.hxx
+++ b/main/sw/source/ui/inc/conttree.hxx
@@ -36,6 +36,10 @@
 class SwGlblDocContent;
 class SfxObjectShell;
 
+//IAccessibility2 Implementation 2009-----
+//Solution:  Include  SdrObject  class
+class SdrObject;
+//-----IAccessibility2 Implementation 2009
 
 #define EDIT_MODE_EDIT			0
 #define EDIT_MODE_UPD_IDX   	1
@@ -89,7 +93,10 @@
 	sal_Bool				bIsImageListInitialized : 1;
 
 	static sal_Bool			bIsInDrag;
-
+	//IAccessibility2 Implementation 2009-----
+	sal_Bool                bIsKeySpace;
+	Rectangle 		    oldRectangle;
+	//-----IAccessibility2 Implementation 2009
 	void 				FindActiveTypeAndRemoveUserData();
 
     using SvLBox::ExecuteDrop;
@@ -144,6 +151,11 @@
 public:
 	SwContentTree(Window* pParent, const ResId& rResId);
 	~SwContentTree();
+	//IAccessibility2 Implementation 2009-----
+	String  		GetEntryAltText( SvLBoxEntry* pEntry ) const;
+	String  		GetEntryLongDescription( SvLBoxEntry* pEntry ) const;
+	SdrObject* 	GetDrawingObjectsByContent(const SwContent *pCnt);
+	//-----IAccessibility2 Implementation 2009
 
 	sal_Bool			ToggleToRoot();
 	sal_Bool 			IsRoot() const {return bIsRoot;}
@@ -196,6 +208,9 @@
 	virtual void    KeyInput(const KeyEvent& rKEvt);
 	
 	virtual sal_Bool	Select( SvLBoxEntry* pEntry, sal_Bool bSelect=sal_True );
+	//IAccessibility2 Implementation 2009-----
+	virtual sal_Int32  GetEntryRealChildsNum( SvLBoxEntry* pEntry ) const;
+	//-----IAccessibility2 Implementation 2009
 };
 
 
diff --git a/main/sw/source/ui/inc/edtwin.hxx b/main/sw/source/ui/inc/edtwin.hxx
index 34a83c3..b7997f1 100644
--- a/main/sw/source/ui/inc/edtwin.hxx
+++ b/main/sw/source/ui/inc/edtwin.hxx
@@ -297,6 +297,9 @@
 
     SwEditWin(Window *pParent, SwView &);
 	virtual ~SwEditWin();
+	//IAccessibility2 Implementation 2009-----
+	virtual void SwitchView();
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif
diff --git a/main/sw/source/ui/inc/pview.hxx b/main/sw/source/ui/inc/pview.hxx
index 927ee0b..ac7b46a 100644
--- a/main/sw/source/ui/inc/pview.hxx
+++ b/main/sw/source/ui/inc/pview.hxx
@@ -164,6 +164,9 @@
     virtual ::com::sun::star::uno::Reference<
         ::com::sun::star::accessibility::XAccessible>
                     CreateAccessible();
+	//IAccessibility2 Implementation 2009-----
+	virtual void SwitchView();
+	//-----IAccessibility2 Implementation 2009
 };
 
 
@@ -175,7 +178,7 @@
 {
 	// ViewWindow und Henkel zur Core
 	// aktuelle Dispatcher-Shell
-	SwPagePreViewWin        aViewWin;
+	SwPagePreViewWin*        pViewWin;//IAccessibility2 Implementation 2009
 	//viewdata of the previous SwView and the new crsrposition
 	String 					sSwViewData,
 	//and the new cursor position if the user double click in the PagePreView
@@ -251,11 +254,11 @@
 	TYPEINFO();
 
 	inline Window*          GetFrameWindow() const { return &(GetViewFrame())->GetWindow(); }
-    inline ViewShell*       GetViewShell() const { return aViewWin.GetViewShell(); }
+    inline ViewShell*       GetViewShell() const { return pViewWin->GetViewShell(); }
 	inline const Rectangle& GetVisArea() const { return aVisArea; }
-	inline void             GrabFocusViewWin() { aViewWin.GrabFocus(); }
+	inline void             GrabFocusViewWin() { pViewWin->GrabFocus(); }
 	inline void             RepaintCoreRect( const SwRect& rRect )
-								{ aViewWin.RepaintCoreRect( rRect ); }
+								{ pViewWin->RepaintCoreRect( rRect ); }
 
 	void            DocSzChgd(const Size& rNewSize);
 	const Size&     GetDocSz() const { return aDocSz; }
diff --git a/main/sw/source/ui/inc/swlbox.hxx b/main/sw/source/ui/inc/swlbox.hxx
index 243a8a0..de157c4 100644
--- a/main/sw/source/ui/inc/swlbox.hxx
+++ b/main/sw/source/ui/inc/swlbox.hxx
@@ -115,6 +115,9 @@
 	void					SetStyle(const sal_uInt16 nSt) 	{ nStyle = nSt; 	}
 
 	String					GetText() const;
+//IAccessibility2 Impplementaton 2009-----
+	void					SetText( const XubString& rStr );
+	void					SetText( const XubString& rStr, const Selection& rNewSelection ) { ComboBox::SetText( rStr, rNewSelection ); };
 };
 
 #endif /* _SWLBOX_HXX */
diff --git a/main/sw/source/ui/inc/swuicnttab.hxx b/main/sw/source/ui/inc/swuicnttab.hxx
index c6bc0da..e6de6aa 100644
--- a/main/sw/source/ui/inc/swuicnttab.hxx
+++ b/main/sw/source/ui/inc/swuicnttab.hxx
@@ -286,6 +286,12 @@
 	Link			aButtonSelectedHdl;
 	Control*		pActiveCtrl;
 	Link			aModifyHdl;
+//IAccessibility2 Impplementaton 2009-----
+	String 	 	accessibleName;
+	String		sAdditionalAccnameString1;
+	String		sAdditionalAccnameString2;
+	String		sAdditionalAccnameString3;
+//-----IAccessibility2 Impplementaton 2009
 
 	SwTOXEntryTabPage*	m_pParent;
 
@@ -337,6 +343,11 @@
 
 	virtual void		Resize();
     virtual void        GetFocus();
+//IAccessibility2 Impplementaton 2009-----
+	void SetFocus2theAllBtn();
+private:	
+	sal_uInt32 GetControlIndex(FormTokenType eType, const Control* pCurControl) const;
+//-----IAccessibility2 Impplementaton 2009
 };
 /* -----------------------------23.12.99 14:16--------------------------------
 
@@ -482,6 +493,10 @@
 	String 				GetLevelHelp(sal_uInt16 nLevel) const;
 
 	void 				PreTokenButtonRemoved(const SwFormToken& rToken);
+//IAccessibility2 Impplementaton 2009-----
+	void SetFocus2theAllBtn();
+	virtual long Notify( NotifyEvent& rNEvt );
+//-----IAccessibility2 Impplementaton 2009
 };
 /* -----------------05.07.99 13:00-------------------
 
diff --git a/main/sw/source/ui/inc/view.hxx b/main/sw/source/ui/inc/view.hxx
index 1a6434c..345f954 100644
--- a/main/sw/source/ui/inc/view.hxx
+++ b/main/sw/source/ui/inc/view.hxx
@@ -200,7 +200,10 @@
 						sNewCrsrPos;
     // to support keyboard the number of the page to go to can be set too
     sal_uInt16              nNewPage;
-
+	//IAccessibility2 Implementation 2009-----
+	sal_uInt16			nOldPageNum;
+	String			nOldSectionName;
+	//-----IAccessibility2 Implementation 2009
 	Point				aTabColFromDocPos;	//Verschieben von Tabellenspalten aus
 											//aus dem Dokument heraus.
     SwTxtNode           * pNumRuleNodeFromDoc; // Moving indent of numrule #i23726#
diff --git a/main/sw/source/ui/index/cnttab.cxx b/main/sw/source/ui/index/cnttab.cxx
index 007c64c..121153d 100644
--- a/main/sw/source/ui/index/cnttab.cxx
+++ b/main/sw/source/ui/index/cnttab.cxx
@@ -1860,7 +1860,15 @@
 			bNextControl = sal_False;
 			bCall = sal_True;
 		}
-
+//IAccessibility2 Impplementaton 2009-----
+		else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+		{
+			if ( m_pParent )
+			{
+				m_pParent->SetFocus2theAllBtn();
+			}
+		}
+//-----IAccessibility2 Impplementaton 2009
 		if(bCall && aPrevNextControlLink.IsSet())
 			aPrevNextControlLink.Call(this);
 
@@ -1996,6 +2004,15 @@
 		//this is invalid here
 		return;
 	}
+//IAccessibility2 Impplementaton 2009-----
+	else if ( (aCode.GetCode() == KEY_F3) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )
+	{
+		if ( m_pParent )
+		{
+			m_pParent->SetFocus2theAllBtn();
+		}
+	}
+//-----IAccessibility2 Impplementaton 2009
 	if(bCall && aPrevNextControlLink.IsSet())
 			aPrevNextControlLink.Call(this);
 	else
@@ -2644,6 +2661,30 @@
 	sal_uInt16 nPos = aAuthFieldsLB.InsertEntry(sTemp);
 	aAuthFieldsLB.SetEntryData(nPos, (void*)(nData));
 }
+//IAccessibility2 Impplementaton 2009-----
+void SwTOXEntryTabPage::SetFocus2theAllBtn()
+{
+	aAllLevelsPB.GrabFocus();
+}
+long SwTOXEntryTabPage::Notify( NotifyEvent& rNEvt )
+{
+	if ( rNEvt.GetType() == EVENT_KEYINPUT )
+	{
+		const KeyEvent& rKEvt = *rNEvt.GetKeyEvent();
+		KeyCode aCode = rKEvt.GetKeyCode();
+		if ( (aCode.GetCode() == KEY_F4) && aCode.IsShift() && !aCode.IsMod1() && !aCode.IsMod2() )		
+		{
+			if ( aTokenWIN.GetActiveControl() )
+			{
+				aTokenWIN.GetActiveControl()->GrabFocus();
+			}
+		}
+
+	}
+
+	return SfxTabPage::Notify( rNEvt );
+}
+//-----IAccessibility2 Impplementaton 2009
 /*-- 16.06.99 10:47:35---------------------------------------------------
 
 This function inizializes the default value in the Token
@@ -3137,7 +3178,12 @@
 			nHelpId = STR_TOKEN_HELP_ENTRY;
 		aButtonHelpTexts[i] = String(ResId(nHelpId, *rResId.GetResMgr()));
 	}
-
+//IAccessibility2 Impplementaton 2009-----
+	accessibleName = String(SW_RES(STR_STRUCTURE));
+	sAdditionalAccnameString1 = String(SW_RES(STR_ADDITIONAL_ACCNAME_STRING1));
+	sAdditionalAccnameString2 = String(SW_RES(STR_ADDITIONAL_ACCNAME_STRING2));
+	sAdditionalAccnameString3 = String(SW_RES(STR_ADDITIONAL_ACCNAME_STRING3));
+//-----IAccessibility2 Impplementaton 2009
 	FreeResource();
 
 	Link aLink(LINK(this, SwTokenWindow, ScrollHdl));
@@ -3295,6 +3341,32 @@
 		pEdit->SetPosPixel(aControlPos);
 		aControlList.Insert(pEdit, aControlList.Count());
 		pEdit->SetText(rText);
+//IAccessibility2 Impplementaton 2009-----
+		sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT, pEdit );
+		String s1 = String::CreateFromAscii(" (");
+		String s2 = String::CreateFromAscii(")");
+		String s3 = String::CreateFromAscii(", ");
+		String strName(accessibleName);
+		strName += String::CreateFromInt32(nIndex);
+		if ( nIndex == 1 )
+		{
+			/*Press left or right arrow to choose the structure controls*/
+			strName += s1;
+			strName += sAdditionalAccnameString2;
+			strName += s3;
+			/*Press Ctrl+Alt+A to move focus for more operations*/
+			strName += sAdditionalAccnameString1;
+			strName += s3;
+			/*Press Ctrl+Alt+B to move focus back to the current structure control*/
+			strName += sAdditionalAccnameString3;
+			strName += s2;
+			pEdit->SetAccessibleName(strName);
+		}
+		else
+		{
+			pEdit->SetAccessibleName(strName);
+		}
+//-----IAccessibility2 Impplementaton 2009
 	 	Size aEditSize(aControlSize);
 		aEditSize.Width() = pEdit->GetTextWidth(rText) + EDIT_MINWIDTH;
 		pEdit->SetSizePixel(aEditSize);
@@ -3325,6 +3397,17 @@
 						(ToxAuthorityField)rToken.nAuthorityField));
 			pButton->SetText(sTmp.Copy(0, 2));
 		}
+//IAccessibility2 Impplementaton 2009-----
+		String sSpace = String::CreateFromAscii(" ");
+		sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType, pButton );
+		String sAccName = aButtonHelpTexts[rToken.eTokenType];
+		if ( nIndex )
+		{
+			sAccName += sSpace;
+			sAccName += String::CreateFromInt32(nIndex);
+		}
+		pButton->SetAccessibleName( sAccName );
+//-----IAccessibility2 Impplementaton 2009
 		pButton->Show();
 		pRet = pButton;
 	}
@@ -3466,6 +3549,32 @@
 		SwTOXEdit* pEdit = new SwTOXEdit(&aCtrlParentWin, this, aTmpToken);
 		aControlList.Insert(pEdit, nActivePos + 1);
 		pEdit->SetText(sRight);
+//IAccessibility2 Impplementaton 2009-----
+		sal_uInt32 nIndex = GetControlIndex( TOKEN_TEXT, pEdit );
+		String s1 = String::CreateFromAscii(" (");
+		String s2 = String::CreateFromAscii(")");
+		String s3 = String::CreateFromAscii(", ");
+		String strName(accessibleName);
+		strName += String::CreateFromInt32(nIndex);
+		if ( nIndex == 1)
+		{
+			/*Press left or right arrow to choose the structure controls*/
+			strName += s1;
+			strName += sAdditionalAccnameString2;
+			strName += s3;
+			/*Press Ctrl+Alt+A to move focus for more operations*/
+			strName += sAdditionalAccnameString1;
+			strName += s3;
+			/*Press Ctrl+Alt+B to move focus back to the current structure control*/
+			strName += sAdditionalAccnameString3;
+			strName += s2;
+			pEdit->SetAccessibleName(strName);
+		}
+		else
+		{
+			pEdit->SetAccessibleName(strName);
+		}
+//-----IAccessibility2 Impplementaton 2009
 		pEdit->SetSizePixel(aControlSize);
 		pEdit->AdjustSize();
 		pEdit->SetModifyHdl(LINK(this, SwTokenWindow, EditResize ));
@@ -3495,6 +3604,17 @@
 		pButton->SetText(sTmp.Copy(0, 2));
 	}
 
+//IAccessibility2 Impplementaton 2009-----
+	String sSpace = String::CreateFromAscii(" ");
+	sal_uInt32 nIndex = GetControlIndex( rToken.eTokenType, pButton );
+	String sAccName = aButtonHelpTexts[rToken.eTokenType];
+	if ( nIndex )
+	{
+		sAccName += sSpace;
+		sAccName += String::CreateFromInt32(nIndex);
+	}
+	pButton->SetAccessibleName( sAccName );
+//-----IAccessibility2 Impplementaton 2009
  Size aEditSize(GetOutputSizePixel());
 	aEditSize.Width() = pButton->GetTextWidth(rText) + 5;
 	pButton->SetSizePixel(aEditSize);
@@ -3925,6 +4045,41 @@
        }
     }
 }
+//IAccessibility2 Impplementaton 2009-----
+void SwTokenWindow::SetFocus2theAllBtn()
+{
+	if (m_pParent)
+	{
+		m_pParent->SetFocus2theAllBtn();
+	}
+}
+sal_uInt32 SwTokenWindow::GetControlIndex(FormTokenType eType, const Control* pCurControl) const
+{
+	//there are only one entry-text button and only one page-number button,
+	//so we need not add index for these two buttons.
+	if ( eType == TOKEN_ENTRY_TEXT || eType == TOKEN_PAGE_NUMS )
+	{
+		return 0;
+	}
+
+	sal_uInt32 nIndex = 0;
+	const Control* pControl = ((SwTokenWindow*)this)->aControlList.First();
+	while(pControl)
+	{
+		const SwFormToken& rNewToken = WINDOW_EDIT == pControl->GetType()
+			? ((SwTOXEdit*)pControl)->GetFormToken()
+			: ((SwTOXButton*)pControl)->GetFormToken();
+
+		if(eType == rNewToken.eTokenType)
+		{
+			nIndex++;
+		}
+		pControl = ((SwTokenWindow*)this)->aControlList.Next();
+	}
+	
+	return nIndex;
+}
+//-----IAccessibility2 Impplementaton 2009
 /* -----------------25.03.99 15:17-------------------
  *
  * --------------------------------------------------*/
diff --git a/main/sw/source/ui/index/cnttab.hrc b/main/sw/source/ui/index/cnttab.hrc
index c70ce78..99feab7 100644
--- a/main/sw/source/ui/index/cnttab.hrc
+++ b/main/sw/source/ui/index/cnttab.hrc
@@ -169,7 +169,12 @@
 #define STR_TOKEN_HELP_AUTHORITY     (STR_BUTTON_HELP_TEXT_START + 9)
 
 #define STR_CHARSTYLE				(STR_TOKEN_HELP_AUTHORITY + 1)
-
+//IAccessibility2 Impplementaton 2009-----
+#define STR_STRUCTURE	(STR_TOKEN_HELP_AUTHORITY + 2)
+#define STR_ADDITIONAL_ACCNAME_STRING1 (STR_TOKEN_HELP_AUTHORITY + 3)
+#define STR_ADDITIONAL_ACCNAME_STRING2 (STR_TOKEN_HELP_AUTHORITY + 4)
+#define STR_ADDITIONAL_ACCNAME_STRING3 (STR_TOKEN_HELP_AUTHORITY + 5)
+//-----IAccessibility2 Impplementaton 2009
 #define TLB_STYLES				100
 #define FL_STYLES                   101
 #define PB_OK		            102
diff --git a/main/sw/source/ui/index/cnttab.src b/main/sw/source/ui/index/cnttab.src
index fbd4c60..2568979 100644
--- a/main/sw/source/ui/index/cnttab.src
+++ b/main/sw/source/ui/index/cnttab.src
@@ -674,6 +674,24 @@
 		{
 			Text [ en-US ] = "Character Style: ";
 		};
+//IAccessibility2 Impplementaton 2009-----
+		String STR_STRUCTURE
+		{
+			Text [ en-US ] = "Structure text";
+		};
+		String STR_ADDITIONAL_ACCNAME_STRING1
+		{
+			Text [ en-US ] = "Press Ctrl+Alt+A to move focus for more operations";
+		};
+		String STR_ADDITIONAL_ACCNAME_STRING2
+		{
+			Text [ en-US ] = "Press left or right arrow to choose the structure controls";
+		};
+		String STR_ADDITIONAL_ACCNAME_STRING3
+		{
+			Text [ en-US ] = "Press Ctrl+Alt+B to move focus back to the current structure control";
+		};
+//-----IAccessibility2 Impplementaton 2009
 	};
 	PushButton PB_ALL_LEVELS
 	{
diff --git a/main/sw/source/ui/misc/glossary.hrc b/main/sw/source/ui/misc/glossary.hrc
index 21d5b4e..9db5a93 100644
--- a/main/sw/source/ui/misc/glossary.hrc
+++ b/main/sw/source/ui/misc/glossary.hrc
@@ -84,4 +84,6 @@
 #define   FL_NN              9
 #define   BT_CANCEL			10
 #define   BT_OKNEW			11
-
+//IAccessibility2 Implementation 2009-----
+#define STR_SW_CATEGORY 12
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/ui/ribbar/inputwin.cxx b/main/sw/source/ui/ribbar/inputwin.cxx
index a0bd280..d9f6eec 100644
--- a/main/sw/source/ui/ribbar/inputwin.cxx
+++ b/main/sw/source/ui/ribbar/inputwin.cxx
@@ -47,6 +47,7 @@
 #include "cellatr.hxx"
 #include "edtwin.hxx"
 #include "helpid.h"
+#include "access.hrc"
 
 // nur fuers UpdateRange - Box in dem der gestackte Cursor sthet loeschen
 #include "pam.hxx"
@@ -90,9 +91,16 @@
 	pWrtShell = pView ? pView->GetWrtShellPtr() : 0;
 
 	InsertWindow( ED_POS, &aPos, 0, 0);
+	//IAccessibility2 Implementation 2009-----
+	SetItemText(ED_POS, String(SW_RES(STR_ACCESS_FORMULA_TYPE)));
+	aPos.SetAccessibleName(String(SW_RES(STR_ACCESS_FORMULA_TYPE)));
+	SetAccessibleName(String(SW_RES(STR_ACCESS_FORMULA_TOOLBAR)));
 	InsertSeparator ( 1 );
 	InsertSeparator ();
 	InsertWindow( ED_FORMULA, &aEdit);
+	SetItemText(ED_FORMULA, String(SW_RES(STR_ACCESS_FORMULA_TEXT)));
+	aEdit.SetAccessibleName(String(SW_RES(STR_ACCESS_FORMULA_TEXT)));
+	//-----IAccessibility2 Implementation 2009
 	SetHelpId(ED_FORMULA, HID_EDIT_FORMULA);
 
     sal_Bool bHC = GetSettings().GetStyleSettings().GetHighContrastMode();
diff --git a/main/sw/source/ui/ribbar/inputwin.hrc b/main/sw/source/ui/ribbar/inputwin.hrc
index 1cd0292..80bc005 100644
--- a/main/sw/source/ui/ribbar/inputwin.hrc
+++ b/main/sw/source/ui/ribbar/inputwin.hrc
@@ -60,6 +60,11 @@
 #define ED_POS				2
 #define ED_FORMULA 			3
 
+//IAccessibility2 Impplementaton 2009-----
+#define STR_ED_POS			1
+#define STR_ED_FORMULA		2
+#define STR_TOOLBAR_FORMULA	35
+//-----IAccessibility2 Impplementaton 2009
 #endif
 
 
diff --git a/main/sw/source/ui/ribbar/inputwin.src b/main/sw/source/ui/ribbar/inputwin.src
index 8689077..536bbe4 100644
--- a/main/sw/source/ui/ribbar/inputwin.src
+++ b/main/sw/source/ui/ribbar/inputwin.src
@@ -28,6 +28,8 @@
 #include "globals.hrc"
 #include "ribbar.hrc"
 #include "inputwin.hrc"
+#include "access.hrc"
+
 ToolBox RID_TBX_FORMULA
 {
 	Pos = MAP_APPFONT ( 0 , 0 ) ;
@@ -279,6 +281,20 @@
 {
 	Text [ en-US ] = "Text formula" ;
 };
+//IAccessibility2 Impplementaton 2009-----
+String STR_ACCESS_FORMULA_TOOLBAR
+{
+	Text [ en-US ] = "Formula Tool Bar" ;
+};
+String STR_ACCESS_FORMULA_TYPE
+{
+	Text [ en-US ] = "Formula Type" ;
+};
+String STR_ACCESS_FORMULA_TEXT
+{
+	Text [ en-US ] = "Formula Text" ;
+};
+//-----IAccessibility2 Impplementaton 2009
 #define TB_INPUT  \
     ToolBoxItem\
     {\
diff --git a/main/sw/source/ui/ribbar/workctrl.cxx b/main/sw/source/ui/ribbar/workctrl.cxx
index 19ae9a5..cdd23d9 100644
--- a/main/sw/source/ui/ribbar/workctrl.cxx
+++ b/main/sw/source/ui/ribbar/workctrl.cxx
@@ -503,6 +503,15 @@
             sText = String(SW_RES(nResStr));
             nTbxBits = TIB_CHECKABLE;
         }
+		//IAccessibility2 Impplementaton 2009-----
+		else
+		{
+			if (nNaviId == NID_PREV)
+				sText = String(SW_RES(STR_IMGBTN_PGE_UP));
+			else if (nNaviId == NID_NEXT)
+				sText = String(SW_RES(STR_IMGBTN_PGE_DOWN));
+		}
+		//-----IAccessibility2 Impplementaton 2009
         aToolBox.InsertItem(nNaviId, sText, nTbxBits);
         aToolBox.SetHelpId( nNaviId, aNavigationHelpIds[i] );
     }
diff --git a/main/sw/source/ui/shells/textsh1.cxx b/main/sw/source/ui/shells/textsh1.cxx
index 28cbab4..4f93012 100644
--- a/main/sw/source/ui/shells/textsh1.cxx
+++ b/main/sw/source/ui/shells/textsh1.cxx
@@ -1119,8 +1119,35 @@
 
 		case SID_DEC_INDENT:
 		case SID_INC_INDENT:
+//IAccessibility2 Implementation 2009-----
+			//According to the requirement, modified the behavior when user
+			//using the indent button on the toolbar. Now if we increase/decrease indent for a
+			//paragraph which has bullet style it will increase/decrease the bullet level.
+			{
+				//If the current paragraph has bullet call the function to 
+				//increase or decrease the bullet level.
+				//Why could I know wheter a paragraph has bullet or not by checking the below conditions?
+				//Please refer to the "case KEY_TAB:" section in SwEditWin::KeyInput(..) :
+				//		if( rSh.GetCurNumRule() && rSh.IsSttOfPara() &&
+				//					!rSh.HasReadonlySel() )
+				//				eKeyState = KS_NumDown;
+				//Above code demonstrates that when the cursor is at the start of a paragraph which has bullet,
+				//press TAB will increase the bullet level.
+				//So I copied from that ^^
+				if ( rWrtSh.GetCurNumRule() && !rWrtSh.HasReadonlySel() )
+				{
+					rWrtSh.NumUpDown( SID_INC_INDENT == nSlot );
+				}
+				else//execute the original processing functions
+				{
+					//below is copied of the old codes
 			rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
 									rReq.GetModifier() != KEY_MOD1 );
+				}
+			}
+			//rWrtSh.MoveLeftMargin( SID_INC_INDENT == nSlot,
+			//						rReq.GetModifier() != KEY_MOD1 );
+//-----IAccessibility2 Implementation 2009
 			rReq.Done();
 			break;
 		case FN_DEC_INDENT_OFFSET:
@@ -1516,11 +1543,36 @@
 		case SID_DEC_INDENT:
 		case SID_INC_INDENT:
 			{
+//IAccessibility2 Implementation 2009-----
+				//if the paragrah has bullet we'll do the following things:
+				//1: if the bullet level is the first level, disable the decrease-indent button
+				//2: if the bullet level is the last level, disable the increase-indent button
+				if ( rSh.GetCurNumRule() && !rSh.HasReadonlySel() )
+				{
+					sal_uInt8 nLevel = rSh.GetNumLevel();
+					if ( nLevel == (MAXLEVEL-1) && nWhich == SID_INC_INDENT ||
+						nLevel == 0 && nWhich == SID_DEC_INDENT )
+					{
+						rSet.DisableItem( nWhich );
+					}
+				}
+				else//if the paragraph has no bullet, execute the original functions
+				{
+					//below is copied of the old codes
 				sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
 				nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
 				if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
 										SID_INC_INDENT == nWhich, sal_True ))
 					rSet.DisableItem( nWhich );
+				}
+				//old code begins
+				//sal_uInt16 nHtmlMode = ::GetHtmlMode(GetView().GetDocShell());
+				//nHtmlMode &= HTMLMODE_ON|HTMLMODE_SOME_STYLES;
+				//if( (nHtmlMode == HTMLMODE_ON) || !rSh.IsMoveLeftMargin(
+				//	SID_INC_INDENT == nWhich, TRUE ))
+				//	rSet.DisableItem( nWhich );
+				//old code ends
+//-----IAccessibility2 Implementation 2009
 			}
 			break;
 
diff --git a/main/sw/source/ui/shells/txtnum.cxx b/main/sw/source/ui/shells/txtnum.cxx
index f675c89..3163470 100644
--- a/main/sw/source/ui/shells/txtnum.cxx
+++ b/main/sw/source/ui/shells/txtnum.cxx
@@ -354,7 +354,7 @@
 						 numfunc::GetDefaultPositionAndSpaceMode() );
 	
 					SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
-					//Sym3_2508, set unit attribute to NB Manager
+					// set unit attribute to NB Manager
 					SfxItemSet aSet(GetPool(),
 							SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
 							0 );
@@ -407,7 +407,7 @@
 						 numfunc::GetDefaultPositionAndSpaceMode() );
 	
 					SvxNumRule aTempRule = aTmpRule.MakeSvxNumRule();
-					//Sym3_2508, set unit attribute to NB Manager
+					// set unit attribute to NB Manager
 					SfxItemSet aSet(GetPool(),
 							SID_ATTR_NUMBERING_RULE, SID_PARAM_CUR_NUM_LEVEL,
 							0 );
diff --git a/main/sw/source/ui/table/convert.hrc b/main/sw/source/ui/table/convert.hrc
index 350973b..267f2fd 100644
--- a/main/sw/source/ui/table/convert.hrc
+++ b/main/sw/source/ui/table/convert.hrc
@@ -35,6 +35,12 @@
 #define FL_OPTIONS                      17
 #define FT_REPEAT_HEADER	18
 #define NF_REPEAT_HEADER	19
+//Table Row Header for ACC Supporting 2010.02.22
+#define FT_EXPLAIN_REPEAT_HEADER		20
+#define CB_LABEL		21
+#define NF_REPEAT_LABEL		22
+#define FT_REPEAT_LABEL		23
+//End table_row_header
 
 #define BT_OK 			100
 #define BT_CANCEL 		101
diff --git a/main/sw/source/ui/table/tabledlg.cxx b/main/sw/source/ui/table/tabledlg.cxx
index 425ec92..dcbf023 100644
--- a/main/sw/source/ui/table/tabledlg.cxx
+++ b/main/sw/source/ui/table/tabledlg.cxx
@@ -991,11 +991,9 @@
 		sEntry += sIndex;
 		pTextArr[i]->SetText( sEntry );
 //IAccessibility2 Impplementaton 2009-----
-		//added by menghu for SODC_5143,12/12/2006
 		String sColumnWidth = SW_RESSTR( STR_ACCESS_COLUMN_WIDTH);
 		sColumnWidth.SearchAndReplace( DEFINE_CONST_UNICODE("%1"), sIndex );
 		pFieldArr[i]->SetAccessibleName( sColumnWidth );
-		//end of SODC_5143
 //-----IAccessibility2 Impplementaton 2009
 	}
 
diff --git a/main/sw/source/ui/table/tabledlg.hrc b/main/sw/source/ui/table/tabledlg.hrc
index 393446f..acb2bbc 100644
--- a/main/sw/source/ui/table/tabledlg.hrc
+++ b/main/sw/source/ui/table/tabledlg.hrc
@@ -102,6 +102,9 @@
 #define FL_VERT_ORIENT          140
 #define RB_FROM_LEFT		144
 
+//IAccessibility2 Impplementaton 2009-----
+#define STR_COLUMN_WIDTH	145
+//-----IAccessibility2 Impplementaton 2009
 #define FT_VERTORIENT       150
 #define LB_VERTORIENT       151
 
diff --git a/main/sw/source/ui/uiview/pview.cxx b/main/sw/source/ui/uiview/pview.cxx
index bfd53d2..5837986 100644
--- a/main/sw/source/ui/uiview/pview.cxx
+++ b/main/sw/source/ui/uiview/pview.cxx
@@ -240,8 +240,11 @@
 
 SwPagePreViewWin::~SwPagePreViewWin()
 {
-    if( mpViewShell )
-        delete mpViewShell;
+	//IAccessibility2 Implementation 2009-----
+	// Remove to the deconstruction of SwPagePreView.
+	//if( mpViewShell)
+	//	delete mpViewShell;
+	//-----IAccessibility2 Implementation 2009
 }
 
 /*--------------------------------------------------------------------
@@ -716,46 +719,46 @@
                                 SwPagePreViewWin::MV_PAGE_UP :
                                 SwPagePreViewWin::MV_PAGE_DOWN;
             if ( ChgPage( eMvMode, sal_True ) )
-                aViewWin.Invalidate();
+                pViewWin->Invalidate();
         }
         else
         {
             SwTwips nScrollAmount;
             sal_uInt16 nNewSelectedPageNum = 0;
-            const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+            const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
             if( _bPgUp )
             {
                 if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() )
                 {
                     nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( -1 );
-                    if ( (aViewWin.SelectedPage() - nVisPages) > 0 )
-                        nNewSelectedPageNum = aViewWin.SelectedPage() - nVisPages;
+                    if ( (pViewWin->SelectedPage() - nVisPages) > 0 )
+                        nNewSelectedPageNum = pViewWin->SelectedPage() - nVisPages;
                     else
                         nNewSelectedPageNum = 1;
                 }
                 else
-                    nScrollAmount = - Min( aViewWin.GetOutputSize().Height(),
-                                           aViewWin.GetPaintedPreviewDocRect().Top() );
+                    nScrollAmount = - Min( pViewWin->GetOutputSize().Height(),
+                                           pViewWin->GetPaintedPreviewDocRect().Top() );
             }
             else
             {
                 if ( pPagePrevwLay->DoesPreviewLayoutRowsFitIntoWindow() )
                 {
                     nScrollAmount = pPagePrevwLay->GetWinPagesScrollAmount( 1 );
-                    if ( (aViewWin.SelectedPage() + nVisPages) <= mnPageCount )
-                        nNewSelectedPageNum = aViewWin.SelectedPage() + nVisPages;
+                    if ( (pViewWin->SelectedPage() + nVisPages) <= mnPageCount )
+                        nNewSelectedPageNum = pViewWin->SelectedPage() + nVisPages;
                     else
                         nNewSelectedPageNum = mnPageCount;
                 }
                 else
-                    nScrollAmount = Min( aViewWin.GetOutputSize().Height(),
+                    nScrollAmount = Min( pViewWin->GetOutputSize().Height(),
                                          ( pPagePrevwLay->GetPrevwDocSize().Height() -
-                                           aViewWin.GetPaintedPreviewDocRect().Bottom() ) );
+                                           pViewWin->GetPaintedPreviewDocRect().Bottom() ) );
             }
-            aViewWin.Scroll( 0, nScrollAmount );
+            pViewWin->Scroll( 0, nScrollAmount );
             if ( nNewSelectedPageNum != 0 )
             {
-                aViewWin.SetSelectedPage( nNewSelectedPageNum );
+                pViewWin->SetSelectedPage( nNewSelectedPageNum );
             }
             ScrollViewSzChg();
 			// OD 24.03.2003 #108282# - additional invalidate page status.
@@ -766,7 +769,7 @@
             };
             SfxBindings& rBindings = GetViewFrame()->GetBindings();
             rBindings.Invalidate( aInval );
-            aViewWin.Invalidate();
+            pViewWin->Invalidate();
         }
     }
 
@@ -801,11 +804,11 @@
                                         SID_ATTR_TABLE_COLUMN)).GetValue();
                 sal_uInt8 nRows = (sal_uInt8)((SfxUInt16Item &)pArgs->Get(
                                         SID_ATTR_TABLE_ROW)).GetValue();
-                aViewWin.CalcWish( nRows, nCols );
+                pViewWin->CalcWish( nRows, nCols );
 
             }
             else
-                SwPreViewZoomDlg( aViewWin ).Execute();
+                SwPreViewZoomDlg( *pViewWin ).Execute();
 
         }
 		break;
@@ -820,7 +823,7 @@
                 ( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview );
 					// cast is not gentleman like, but it's common use in writer and in this case
             }
-            if ( aViewWin.SetBookPreviewMode( bBookPreview ) )
+            if ( pViewWin->SetBookPreviewMode( bBookPreview ) )
             {
                 // book preview mode changed. Thus, adjust scrollbars and
                 // invalidate corresponding states.
@@ -832,13 +835,13 @@
                 };
                 SfxBindings& rBindings = GetViewFrame()->GetBindings();
                 rBindings.Invalidate( aInval );
-                aViewWin.Invalidate();
+                pViewWin->Invalidate();
             }
 
         }
 		break;
         case FN_SHOW_TWO_PAGES:
-			aViewWin.CalcWish( nRow, 2 );
+			pViewWin->CalcWish( nRow, 2 );
 			break;
 
 		case FN_PREVIEW_ZOOM:
@@ -932,7 +935,7 @@
             }
             pPagePrevwLay->CalcStartValuesForSelectedPageMove( nHoriMove, nVertMove,
                                 nNewSelectedPage, nNewStartPage, aNewStartPos );
-            if ( aViewWin.SelectedPage() != nNewSelectedPage )
+            if ( pViewWin->SelectedPage() != nNewSelectedPage )
             {
                 if ( pPagePrevwLay->IsPageVisible( nNewSelectedPage ) )
                 {
@@ -943,8 +946,8 @@
                 }
                 else
                 {
-                    aViewWin.SetSelectedPage( nNewSelectedPage );
-                    aViewWin.SetSttPage( nNewStartPage );
+                    pViewWin->SetSelectedPage( nNewSelectedPage );
+                    pViewWin->SetSttPage( nNewStartPage );
                     int nRet = ChgPage( SwPagePreViewWin::MV_SELPAGE, sal_True );
                     bRefresh = 0 != nRet;
                 }
@@ -972,11 +975,11 @@
         }
         case FN_START_OF_LINE:
         case FN_START_OF_DOCUMENT:
-            aViewWin.SetSelectedPage( 1 );
+            pViewWin->SetSelectedPage( 1 );
 			eMvMode = SwPagePreViewWin::MV_DOC_STT;	bRetVal = sal_True;	goto MOVEPAGE;
         case FN_END_OF_LINE:
         case FN_END_OF_DOCUMENT:
-            aViewWin.SetSelectedPage( mnPageCount );
+            pViewWin->SetSelectedPage( mnPageCount );
             eMvMode = SwPagePreViewWin::MV_DOC_END; bRetVal = sal_True; goto MOVEPAGE;
 MOVEPAGE:
 			{
@@ -992,7 +995,7 @@
 
 		case FN_PRINT_PAGEPREVIEW:
 		{
-			const SwPagePreViewPrtData* pPPVPD = aViewWin.GetViewShell()->GetDoc()->GetPreViewPrtData();
+			const SwPagePreViewPrtData* pPPVPD = pViewWin->GetViewShell()->GetDoc()->GetPreViewPrtData();
 			// die Sache mit der Orientation
 			if(pPPVPD)
 			{
@@ -1001,7 +1004,7 @@
 						!= pPPVPD->GetLandscape())
 					pPrinter->SetOrientation(pPPVPD->GetLandscape() ? ORIENTATION_LANDSCAPE : ORIENTATION_PORTRAIT);
 			}
-			::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False );
+			::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
 			bNormalPrint = sal_False;
 			sal_uInt16 nPrtSlot = SID_PRINTDOC;
 			rReq.SetSlot( nPrtSlot );
@@ -1011,7 +1014,7 @@
 		}
 		case SID_PRINTDOCDIRECT:
 		case SID_PRINTDOC:
-			::SetAppPrintOptions( aViewWin.GetViewShell(), sal_False );
+			::SetAppPrintOptions( pViewWin->GetViewShell(), sal_False );
 			bNormalPrint = sal_True;
 			SfxViewShell::ExecuteSlot( rReq, SfxViewShell::GetInterface() );
 			return;
@@ -1024,7 +1027,7 @@
 			break;
         case FN_INSERT_BREAK:
         {
-            sal_uInt16 nSelPage = aViewWin.SelectedPage();
+            sal_uInt16 nSelPage = pViewWin->SelectedPage();
             //if a dummy page is selected (e.g. a non-existing right/left page)
             //the direct neighbor is used
             if(GetViewShell()->IsDummyPage( nSelPage ) && GetViewShell()->IsDummyPage( --nSelPage ))
@@ -1041,7 +1044,7 @@
 	}
 
 	if( bRefresh )
-		aViewWin.Invalidate();
+		pViewWin->Invalidate();
 }
 
 /*--------------------------------------------------------------------
@@ -1096,7 +1099,7 @@
 		case FN_STAT_PAGE:
 			{
 				String aStr( sPageStr );
-                aViewWin.GetStatusStr( aStr, mnPageCount );
+                pViewWin->GetStatusStr( aStr, mnPageCount );
 				rSet.Put( SfxStringItem( nWhich, aStr) );
 			}
 			break;
@@ -1168,7 +1171,7 @@
 		break;
 
 		case FN_SHOW_TWO_PAGES:
-			if( 2 == aViewWin.GetCol() && nRow == aViewWin.GetRow() )
+			if( 2 == pViewWin->GetCol() && nRow == pViewWin->GetRow() )
 				rSet.DisableItem( nWhich );
 			break;
 
@@ -1294,7 +1297,7 @@
 
 SwPagePreView::SwPagePreView(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
 	SfxViewShell( pViewFrame, SWVIEWFLAGS ),
-	aViewWin( &pViewFrame->GetWindow(), *this ),
+	pViewWin( new SwPagePreViewWin(&(GetViewFrame())->GetWindow(), *this ) ),//IAccessibility2 Implementation 2009
     nNewPage(USHRT_MAX),
 	pHScrollbar(0),
 	pVScrollbar(0),
@@ -1308,7 +1311,7 @@
     mbFormDesignModeToReset( false )
 {
 	SetName(String::CreateFromAscii("PageView" ));
-	SetWindow( &aViewWin );
+	SetWindow( pViewWin );
 	SetHelpId(SW_PAGEPREVIEW);
     _CreateScrollbar( sal_True );
     _CreateScrollbar( sal_False );
@@ -1343,9 +1346,9 @@
 			// setze die akt. Seite als die erste
 			sal_uInt16 nPhysPg, nVirtPg;
 			((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, /*sal_False*/sal_True, sal_False );
-			if( 1 != aViewWin.GetCol() && 1 == nPhysPg )
+			if( 1 != pViewWin->GetCol() && 1 == nPhysPg )
 				--nPhysPg;
-			aViewWin.SetSttPage( nPhysPg );
+			pViewWin->SetSttPage( nPhysPg );
 		}
 	}
 
@@ -1358,13 +1361,13 @@
     }
 
     if( pVS )
-		pNew = new ViewShell( *pVS, &aViewWin, 0, VSHELLFLAG_ISPREVIEW );
+		pNew = new ViewShell( *pVS, pViewWin, 0, VSHELLFLAG_ISPREVIEW );
 	else
 		pNew = new ViewShell(
 				*((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(),
-				&aViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
+				pViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
 
-    aViewWin.SetViewShell( pNew );
+    pViewWin->SetViewShell( pNew );
 	pNew->SetSfxViewShell( this );
 	Init();
 }
@@ -1378,6 +1381,15 @@
  SwPagePreView::~SwPagePreView()
 {
 	SetWindow( 0 );
+	//IAccessibility2 Implementation 2009-----
+	ViewShell* pVShell =  pViewWin->GetViewShell();
+	pVShell->SetWin(0);
+	//pViewWin->Hide();
+	if( pVShell)
+		delete pVShell;
+	delete pViewWin;
+	//pViewWin->Hide();
+	//-----IAccessibility2 Implementation 2009
 
 	delete pScrollFill;
 	delete pHScrollbar;
@@ -1476,17 +1488,17 @@
 
 int SwPagePreView::ChgPage( int eMvMode, int bUpdateScrollbar )
 {
-	Rectangle aPixVisArea( aViewWin.LogicToPixel( aVisArea ) );
-	int bChg = aViewWin.MovePage( eMvMode ) ||
+	Rectangle aPixVisArea( pViewWin->LogicToPixel( aVisArea ) );
+	int bChg = pViewWin->MovePage( eMvMode ) ||
                eMvMode == SwPagePreViewWin::MV_CALC ||
                eMvMode == SwPagePreViewWin::MV_NEWWINSIZE;
-	aVisArea = aViewWin.PixelToLogic( aPixVisArea );
+	aVisArea = pViewWin->PixelToLogic( aPixVisArea );
 
 	if( bChg )
 	{
 		// Statusleiste updaten
 		String aStr( sPageStr );
-        aViewWin.GetStatusStr( aStr, mnPageCount );
+        pViewWin->GetStatusStr( aStr, mnPageCount );
 		SfxBindings& rBindings = GetViewFrame()->GetBindings();
 
 		if( bUpdateScrollbar )
@@ -1518,7 +1530,7 @@
 void SwPagePreView::CalcAndSetBorderPixel( SvBorder &rToFill, sal_Bool /*bInner*/ )
 {
 //	const long nAdd = bInner ? 0 : ScrollBar::GetWindowOverlapPixel();
-	const StyleSettings &rSet = aViewWin.GetSettings().GetStyleSettings();
+	const StyleSettings &rSet = pViewWin->GetSettings().GetStyleSettings();
 	const long nTmp = rSet.GetScrollBarSize();// - nAdd;
     if ( pVScrollbar->IsVisible( sal_False ))
 		rToFill.Right()  = nTmp;
@@ -1538,8 +1550,8 @@
 	CalcAndSetBorderPixel( aBorder, sal_True );
 	Rectangle aRect( rOfst, rSize );
 	aRect += aBorder;
-	ViewResizePixel( aViewWin, aRect.TopLeft(), aRect.GetSize(),
-					aViewWin.GetOutputSizePixel(),
+	ViewResizePixel( *pViewWin, aRect.TopLeft(), aRect.GetSize(),
+					pViewWin->GetOutputSizePixel(),
 					sal_True,
                     *pVScrollbar, *pHScrollbar, pPageUpBtn, pPageDownBtn, 0,
                     *pScrollFill );
@@ -1557,14 +1569,14 @@
 {
 	SvBorder aBorder;
 	CalcAndSetBorderPixel( aBorder, sal_False );
-	ViewResizePixel( aViewWin, rOfst, rSize, aViewWin.GetOutputSizePixel(),
+	ViewResizePixel( *pViewWin, rOfst, rSize, pViewWin->GetOutputSizePixel(),
                         sal_False, *pVScrollbar,
                         *pHScrollbar, pPageUpBtn, pPageDownBtn, 0, *pScrollFill );
 
 	//EditWin niemals einstellen!
 
-	Size aTmpSize( aViewWin.GetOutputSizePixel() );
-	Point aBottomRight( aViewWin.PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
+	Size aTmpSize( pViewWin->GetOutputSizePixel() );
+	Point aBottomRight( pViewWin->PixelToLogic( Point( aTmpSize.Width(), aTmpSize.Height() ) ) );
 	SetVisArea( Rectangle( Point(), aBottomRight ) );
 
 	//Aufruf der DocSzChgd-Methode der Scrollbars ist noetig, da vom maximalen
@@ -1619,15 +1631,15 @@
 	//denn dann wir nicht wirklich gepaintet sondern die Rechtecke werden
 	//lediglich (in Dokumentkoordinaten) vorgemerkt.
     if( GetViewShell()->ActionPend() )
-		aViewWin.Update();
+		pViewWin->Update();
 
 	// setze am View-Win die aktuelle Size
 	aVisArea = aLR;
-	aViewWin.SetWinSize( aLR.GetSize() );
+	pViewWin->SetWinSize( aLR.GetSize() );
     // OD 18.12.2002 #103492# - use new mode
     ChgPage( SwPagePreViewWin::MV_NEWWINSIZE, bUpdateScrollbar );
 
-	aViewWin.Invalidate();
+	pViewWin->Invalidate();
 }
 
 /*--------------------------------------------------------------------
@@ -1647,7 +1659,7 @@
 		// wieviele Seiten scrollen ??
 		String sStateStr(sPageStr);
 		sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
-		if( 1 == aViewWin.GetCol() || !nThmbPos )
+		if( 1 == pViewWin->GetCol() || !nThmbPos )
 			++nThmbPos;
 		sStateStr += String::CreateFromInt32( nThmbPos );
 		Point aPos = pScrollbar->GetParent()->OutputToScreenPixel(
@@ -1691,7 +1703,7 @@
             // wieviele Seiten scrollen ??
             sal_uInt16 nThmbPos = (sal_uInt16)pScrollbar->GetThumbPos();
             // OD 05.12.2002 #103492# - adjust to new preview functionality
-            if( nThmbPos != aViewWin.SelectedPage() )
+            if( nThmbPos != pViewWin->SelectedPage() )
             {
                 // OD 17.01.2003 #103492# - consider case that page <nThmbPos>
                 // is already visible
@@ -1708,8 +1720,8 @@
                     // fit or not.
                     if ( !pPagePrevwLay->DoesPreviewLayoutColsFitIntoWindow() )
                     {
-                        aViewWin.SetSttPage( nThmbPos );
-                        aViewWin.SetSelectedPage( nThmbPos );
+                        pViewWin->SetSttPage( nThmbPos );
+                        pViewWin->SetSelectedPage( nThmbPos );
                         ChgPage( SwPagePreViewWin::MV_SCROLL, sal_False );
                         // OD 20.01.2003 #103492# - update scrollbars
                         ScrollViewSzChg();
@@ -1717,16 +1729,16 @@
                     else
                     {
                         // OD 04.03.2003 #107369# - correct scroll amount
-                        const sal_Int16 nPageDiff = nThmbPos - aViewWin.SelectedPage();
-                        const sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+                        const sal_Int16 nPageDiff = nThmbPos - pViewWin->SelectedPage();
+                        const sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
                         sal_Int16 nWinPagesToScroll = nPageDiff / nVisPages;
                         if ( nPageDiff % nVisPages )
                         {
                             // decrease/increase number of preview pages to scroll
                             nPageDiff < 0 ? --nWinPagesToScroll : ++nWinPagesToScroll;
                         }
-                        aViewWin.SetSelectedPage( nThmbPos );
-                        aViewWin.Scroll( 0, pPagePrevwLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
+                        pViewWin->SetSelectedPage( nThmbPos );
+                        pViewWin->Scroll( 0, pPagePrevwLay->GetWinPagesScrollAmount( nWinPagesToScroll ) );
                     }
                 }
                 // OD 17.01.2003 #103492# - update accessibility
@@ -1741,13 +1753,13 @@
         else
         {
             long nThmbPos = pScrollbar->GetThumbPos();
-            aViewWin.Scroll(0, nThmbPos - aViewWin.GetPaintedPreviewDocRect().Top());
+            pViewWin->Scroll(0, nThmbPos - pViewWin->GetPaintedPreviewDocRect().Top());
         }
 	}
     else
     {
         long nThmbPos = pScrollbar->GetThumbPos();
-        aViewWin.Scroll(nThmbPos - aViewWin.GetPaintedPreviewDocRect().Left(), 0);
+        pViewWin->Scroll(nThmbPos - pViewWin->GetPaintedPreviewDocRect().Left(), 0);
     }
     // OD 24.03.2003 #108282# - additional invalidate page status.
     static sal_uInt16 __READONLY_DATA aInval[] =
@@ -1760,7 +1772,7 @@
     // OD 04.03.2003 #107369# - control invalidation of window
     if ( bInvalidateWin )
     {
-        aViewWin.Invalidate();
+        pViewWin->Invalidate();
     }
     return 0;
 }
@@ -1771,7 +1783,7 @@
 
 Point SwPagePreView::AlignToPixel(const Point &rPt) const
 {
-	return aViewWin.PixelToLogic( aViewWin.LogicToPixel( rPt ) );
+	return pViewWin->PixelToLogic( pViewWin->LogicToPixel( rPt ) );
 }
 
 /*--------------------------------------------------------------------
@@ -1796,7 +1808,7 @@
 		ChgPage( SwPagePreViewWin::MV_CALC, sal_True );
         ScrollDocSzChg();
 
-		aViewWin.Invalidate();
+		pViewWin->Invalidate();
 	}
     // <--
 }
@@ -1816,20 +1828,20 @@
         {
             //vertical scrolling by row
             // OD 04.12.2002 #103492# - adjust to new preview functionality
-            sal_uInt16 nVisPages = aViewWin.GetRow() * aViewWin.GetCol();
+            sal_uInt16 nVisPages = pViewWin->GetRow() * pViewWin->GetCol();
             pVScrollbar->SetVisibleSize( nVisPages );
             // OD 19.02.2003 #107369# - set selected page as scroll bar position,
             // if it is visible.
             SwPagePreviewLayout* pPagePrevwLay = GetViewShell()->PagePreviewLayout();
-            if ( pPagePrevwLay->IsPageVisible( aViewWin.SelectedPage() ) )
+            if ( pPagePrevwLay->IsPageVisible( pViewWin->SelectedPage() ) )
             {
-                pVScrollbar->SetThumbPos( aViewWin.SelectedPage() );
+                pVScrollbar->SetThumbPos( pViewWin->SelectedPage() );
             }
             else
             {
-                pVScrollbar->SetThumbPos( aViewWin.GetSttPage() );
+                pVScrollbar->SetThumbPos( pViewWin->GetSttPage() );
             }
-            pVScrollbar->SetLineSize( aViewWin.GetCol() );
+            pVScrollbar->SetLineSize( pViewWin->GetCol() );
             pVScrollbar->SetPageSize( nVisPages );
             // calculate and set scrollbar range
             Range aScrollbarRange( 1, mnPageCount );
@@ -1841,7 +1853,7 @@
         }
         else //vertical scrolling by pixel
         {
-            const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+            const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
             const Size& rPreviewSize =
                     GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
             pVScrollbar->SetRangeMax(rPreviewSize.Height()) ;
@@ -1854,7 +1866,7 @@
     }
     if(pHScrollbar)
     {
-        const Rectangle& rDocRect = aViewWin.GetPaintedPreviewDocRect();
+        const Rectangle& rDocRect = pViewWin->GetPaintedPreviewDocRect();
         const Size& rPreviewSize =
                 GetViewShell()->PagePreviewLayout()->GetPrevwDocSize();
         long nVisWidth = 0;
@@ -1896,7 +1908,7 @@
 
 SfxPrinter*  SwPagePreView::GetPrinter( sal_Bool bCreate )
 {
-    return aViewWin.GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
+    return pViewWin->GetViewShell()->getIDocumentDeviceAccess()->getPrinter( bCreate );
 }
 
 /*--------------------------------------------------------------------
@@ -1934,7 +1946,7 @@
 			rSh.ChgAllPageSize( aSz );
 		}
 		if( !bNormalPrint )
-			aViewWin.CalcWish( aViewWin.GetRow(), aViewWin.GetCol() );
+			pViewWin->CalcWish( pViewWin->GetRow(), pViewWin->GetCol() );
 		rESh.SetModified();
 		rESh.EndAllAction();
 
@@ -1997,7 +2009,7 @@
 	nYBorder -= (nYBorder - nXBorder) / 2;
 	aMaxSize.Height() -= nYBorder;
 	//mit der max. moeglichen Outputsize guenstigstes Verhaeltnis ausrechnen
-	aViewWin.GetOptimalSize(aMaxSize);
+	pViewWin->GetOptimalSize(aMaxSize);
 	// Border wieder dazuzaehlen
 	aMaxSize.Height() += nYBorder;
 	aMaxSize.Width() += nXBorder;
@@ -2091,7 +2103,10 @@
 	const CommandWheelData* pWData = rCEvt.GetWheelData();
 	if( pWData && COMMAND_WHEEL_ZOOM == pWData->GetMode() )
 	{
-        if(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+	//IAccessibility2 Implementation 2009-----, only the Preference shouldn't control the Zoom, it is better to detect AT tools running. So the bridge can be used here
+        //if(!Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+	if ( !Application::IsAccessibilityEnabled() )
+	//-----IAccessibility2 Implementation 2009
         {
             sal_uInt16 nFactor = GetViewShell()->GetViewOptions()->GetZoom();
             const sal_uInt16 nOffset = 10;
@@ -2112,7 +2127,7 @@
 		bOk = sal_True;
 	}
 	else
-        bOk = aViewWin.HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
+        bOk = pViewWin->HandleScrollCommand( rCEvt, pHScrollbar, pVScrollbar );
 	return bOk;
 }
 
@@ -2124,8 +2139,37 @@
 														// happend already!!!
 
     DBG_ASSERT( GetViewShell() != NULL, "We need a view shell" );
-    return GetViewShell()->CreateAccessiblePreview();
+	//IAccessibility2 Implementation 2009-----
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAcc = GetAccessible( sal_False );
+	if (xAcc.is())
+	{
+		return xAcc;
+	}
+	if (mpViewShell)
+	{	    
+		::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xAccPreview = mpViewShell->CreateAccessiblePreview();
+		SetAccessible(xAccPreview);
+	}
+	return GetAccessible( sal_False );
+	//-----IAccessibility2 Implementation 2009
 }
+//IAccessibility2 Implementation 2009-----
+// MT: Removed Windows::SwitchView() introduced with IA2 CWS.
+// There are other notifications for this when the active view has chnaged, so please update the code to use that event mechanism
+void SwPagePreViewWin::SwitchView()
+{
+#ifdef ACCESSIBLE_LAYOUT
+	if (!Application::IsAccessibilityEnabled())
+	{
+		return ;
+	}
+	if (mpViewShell)
+	{
+		mpViewShell->InvalidateAccessibleFocus();
+	}
+#endif
+}
+//-----IAccessibility2 Implementation 2009
 
 /* -----------------------------06.05.2002 13:18------------------------------
 
@@ -2169,7 +2213,7 @@
         lcl_InvalidateZoomSlots(GetViewFrame()->GetBindings());
         // OD 02.12.2002 #103492#
         // OD 24.09.2003 #i19975# - also consider zoom type
-        aViewWin.AdjustPreviewToNewZoom( nFactor, eType );
+        pViewWin->AdjustPreviewToNewZoom( nFactor, eType );
         ScrollViewSzChg();
     }
 }
diff --git a/main/sw/source/ui/uiview/view.cxx b/main/sw/source/ui/uiview/view.cxx
index e2e413b..5ec338e 100644
--- a/main/sw/source/ui/uiview/view.cxx
+++ b/main/sw/source/ui/uiview/view.cxx
@@ -780,6 +780,9 @@
 	nFormSfxId( USHRT_MAX ),
     nLastPasteDestination( 0xFFFF ),
     nLeftBorderDistance( 0 ),
+    //IAccessibility2 Implementation 2009-----
+	nOldPageNum(0),
+    //-----IAccessibility2 Implementation 2009
     nRightBorderDistance( 0 ),
     bInMailMerge(sal_False),
     bInDtor(sal_False),
diff --git a/main/sw/source/ui/uiview/view2.cxx b/main/sw/source/ui/uiview/view2.cxx
index 3434f49..2de9717 100644
--- a/main/sw/source/ui/uiview/view2.cxx
+++ b/main/sw/source/ui/uiview/view2.cxx
@@ -1179,6 +1179,32 @@
 	SfxWhichIter aIter( rSet );
 	sal_uInt16 nWhich = aIter.FirstWhich();
 	ASSERT( nWhich, "leeres Set");
+	//IAccessibility2 Implementation 2009-----
+	if (Application::IsAccessibilityEnabled())
+	{
+		//get section chang event
+		const SwSection* CurrSect = rShell.GetCurrSection();
+		if( CurrSect )
+		{
+            String sCurrentSectionName = CurrSect->GetSectionName();
+			if(sCurrentSectionName != nOldSectionName)
+			{
+				rShell.FireSectionChangeEvent(2, 1);
+			}
+			nOldSectionName = sCurrentSectionName;
+		}
+		else if ( !(nOldSectionName.Equals(String()))  )
+		{
+			rShell.FireSectionChangeEvent(2, 1);
+			nOldSectionName = String();
+		}
+		//get column change event
+		if(rShell.bColumnChange())
+		{
+			rShell.FireColumnChangeEvent(2, 1);
+		}
+	}
+	//-----IAccessibility2 Implementation 2009
 
 	while( nWhich )
 	{
@@ -1203,7 +1229,15 @@
 				rShell.GetPageNumber( -1, rShell.IsCrsrVisible(), nPage, nLogPage, sDisplay );
 				rSet.Put( SfxStringItem( FN_STAT_PAGE,
 							GetPageStr( nPage, nLogPage, sDisplay) ));
-
+				//IAccessibility2 Implementation 2009-----
+				//if existing page number is not equal to old page number, send out this event.
+				if (nOldPageNum != nLogPage )
+				{
+					if (nOldPageNum != 0)
+						rShell.FirePageChangeEvent(nOldPageNum, nLogPage);
+					nOldPageNum = nLogPage;
+				}
+				//-----IAccessibility2 Implementation 2009
 				sal_uInt16 nCnt = GetWrtShell().GetPageCnt();
 				if (nPageCnt != nCnt)	// Basic benachrichtigen
 				{
diff --git a/main/sw/source/ui/uiview/viewsrch.cxx b/main/sw/source/ui/uiview/viewsrch.cxx
index e3db351..c3e1adc 100644
--- a/main/sw/source/ui/uiview/viewsrch.cxx
+++ b/main/sw/source/ui/uiview/viewsrch.cxx
@@ -213,6 +213,19 @@
 				if( bRet )
 					Scroll(pWrtShell->GetCharRect().SVRect());
 				rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+				//IAccessibility2 Implementation 2009-----
+				if ( Application::IsAccessibilityEnabled() )
+				{
+					const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
+					SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+					if ( pWrp )
+					{					
+						pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
+						pSrchDlg->SetDocWin( (Window*)pEditWin );
+						pSrchDlg->SetSrchFlag();
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
 			}
 			break;
 			case SVX_SEARCHCMD_FIND_ALL:
@@ -228,6 +241,20 @@
 					bFound = sal_False;
 				}
 				rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
+				//IAccessibility2 Implementation 2009-----
+				if ( Application::IsAccessibilityEnabled() )
+				{
+					const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
+					SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+
+					if ( pWrp )
+					{					
+						pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
+						pSrchDlg->SetDocWin( (Window*)pEditWin );
+						pSrchDlg->SetSrchFlag();				
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
 			}
 			break;
 			case SVX_SEARCHCMD_REPLACE:
@@ -279,6 +306,19 @@
 					pSrchItem->SetCommand( nOldCmd );
 					rReq.SetReturnValue(SfxBoolItem(nSlot, bRet));
 				}
+				//IAccessibility2 Implementation 2009-----
+				{					
+					const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
+					SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+				
+					if ( pWrp )
+					{					
+						pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
+						pSrchDlg->SetDocWin( (Window*)pEditWin );
+						pSrchDlg->SetSrchFlag();			
+					}
+				}
+				//-----IAccessibility2 Implementation 2009
 				break;
 
 			case SVX_SEARCHCMD_REPLACE_ALL:
@@ -328,6 +368,17 @@
 						InfoBox( pParentWindow, aText ).Execute();
 					}
 				}
+				//IAccessibility2 Implementation 2009-----
+				const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId();
+				SvxSearchDialogWrapper *pWrp = (SvxSearchDialogWrapper*)GetViewFrame()->GetChildWindow(nId);
+			
+				if ( pWrp )
+				{					
+					pSrchDlg = (SvxSearchDialog*)(pWrp->GetWindow());
+					pSrchDlg->SetDocWin( (Window*)pEditWin );
+					pSrchDlg->SetSrchFlag();				
+				}
+				//-----IAccessibility2 Implementation 2009
 				break;
 			}
 
diff --git a/main/sw/source/ui/utlui/content.cxx b/main/sw/source/ui/utlui/content.cxx
index 4d112f8..4fea35a 100644
--- a/main/sw/source/ui/utlui/content.cxx
+++ b/main/sw/source/ui/utlui/content.cxx
@@ -85,7 +85,15 @@
 #include <numrule.hxx>
 #include <swundo.hxx>
 #include <ndtxt.hxx>
+//IAccessibility2 Implementation 2009-----
+//#include <ndgrf.hxx>
+#include <fmtcntnt.hxx>
 #include <PostItMgr.hxx>
+//#include <../../core/inc/flyfrm.hxx>
+//#include <../../core/inc/cntfrm.hxx>
+//#include <ndnotxt.hxx>
+//-----IAccessibility2 Implementation 2009
+//#include <postit.hxx>
 #include <postithelper.hxx>
 #include <redline.hxx>
 #include <docary.hxx>
@@ -890,7 +898,8 @@
 		bIsLastReadOnly(sal_False),
 		bIsOutlineMoveable(sal_True),
 		bViewHasChanged(sal_False),
-		bIsImageListInitialized(sal_False)
+		bIsImageListInitialized(sal_False),
+		bIsKeySpace(sal_False) //IAccessibility2 Implementation 2009
 {
 	sal_uInt16 i;
 
@@ -927,6 +936,179 @@
 	bIsInDrag = sal_False;
 }
 
+//IAccessibility2 Implementation 2009-----
+String SwContentTree::GetEntryAltText( SvLBoxEntry* pEntry ) const
+{
+	if( pEntry == NULL)
+		return String();
+
+	SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+	if( pCnt == NULL || pCnt->GetParent() == NULL)
+		return String();
+	
+	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+	SdrObject* pTemp;
+	
+	switch(nJumpType)
+	{
+		case CONTENT_TYPE_DRAWOBJECT:
+			{
+				SdrView* pDrawView = pActiveShell->GetDrawView();
+				if (pDrawView)
+				{
+                    SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                    SdrPage* pPage = pDrawModel->GetPage(0);
+                    const sal_uInt32 nCount = pPage->GetObjCount();
+					for( sal_uInt32 i=0; i< nCount; i++ )
+					{
+						pTemp = pPage->GetObj(i);						
+						sal_uInt16 nCmpId;		
+						switch( pTemp->GetObjIdentifier() )
+						{
+						case OBJ_GRUP:
+						case OBJ_TEXT:
+						case OBJ_TEXTEXT:
+						case OBJ_wegFITTEXT:
+						case OBJ_LINE:
+						case OBJ_RECT:
+							//caoxueqin added custom shape
+						case OBJ_CUSTOMSHAPE:
+							//end 2005/08/05
+						case OBJ_CIRC:
+						case OBJ_SECT:
+						case OBJ_CARC:
+						case OBJ_CCUT:
+						case OBJ_POLY:
+						case OBJ_PLIN:
+						case OBJ_PATHLINE:
+						case OBJ_PATHFILL:
+						case OBJ_FREELINE:
+						case OBJ_FREEFILL:
+						case OBJ_PATHPOLY:
+						case OBJ_PATHPLIN:
+						case OBJ_CAPTION:
+							nCmpId = OBJ_GRUP;
+							break;
+						default:
+							nCmpId = pTemp->GetObjIdentifier();
+						}
+						if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
+						{
+							return pTemp->GetTitle();
+						}
+						//Commented End
+					}
+				}
+			}
+			break;		
+		case CONTENT_TYPE_GRAPHIC   :
+			{
+				if( pActiveShell && pActiveShell->GetDoc() )
+				{
+					const SwFlyFrmFmt* pFrmFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+					if( pFrmFmt )
+					{
+//                        SwNodeIndex aIdx( *(pFrmFmt->GetCntnt().GetCntntIdx()), 1 );
+//                        const SwGrfNode* pGrfNd = aIdx.GetNode().GetGrfNode();
+//                        if( pGrfNd )
+//                            return pGrfNd->GetAlternateText(); 
+                        return pFrmFmt->GetObjTitle();
+					}
+				}
+			}
+			break;
+		case CONTENT_TYPE_OLE       :
+		case CONTENT_TYPE_FRAME     :
+			{
+				//Can't find the GetAlternateText function. Need to verify again.
+				const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+				if( pFlyFmt )
+					return pFlyFmt->/*GetAlternateText*/GetName();
+			}
+			break;
+	}
+	return String();
+}
+
+String SwContentTree::GetEntryLongDescription( SvLBoxEntry* pEntry ) const
+{
+	if( pEntry == NULL)
+		return String();
+
+	SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+	if( pCnt == NULL || pCnt->GetParent() == NULL)
+		return String();
+
+	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+	SdrObject* pTemp;
+	
+	switch(nJumpType)
+	{
+		case CONTENT_TYPE_DRAWOBJECT:
+			{
+				SdrView* pDrawView = pActiveShell->GetDrawView();
+				if (pDrawView)
+				{
+                    SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                    SdrPage* pPage = pDrawModel->GetPage(0);
+					sal_uInt32 nCount = pPage->GetObjCount();
+					for( sal_uInt32 i=0; i< nCount; i++ )
+					{
+						pTemp = pPage->GetObj(i);						
+						sal_uInt16 nCmpId;		
+						switch( pTemp->GetObjIdentifier() )
+						{
+						case OBJ_GRUP:
+						case OBJ_TEXT:
+						case OBJ_TEXTEXT:
+						case OBJ_wegFITTEXT:
+						case OBJ_LINE:
+						case OBJ_RECT:
+							//caoxueqin added custom shape
+						case OBJ_CUSTOMSHAPE:
+							//end 2005/08/05
+						case OBJ_CIRC:
+						case OBJ_SECT:
+						case OBJ_CARC:
+						case OBJ_CCUT:
+						case OBJ_POLY:
+						case OBJ_PLIN:
+						case OBJ_PATHLINE:
+						case OBJ_PATHFILL:
+						case OBJ_FREELINE:
+						case OBJ_FREEFILL:
+						case OBJ_PATHPOLY:
+						case OBJ_PATHPLIN:
+						case OBJ_CAPTION:
+							nCmpId = OBJ_GRUP;
+							break;
+						default:
+							nCmpId = pTemp->GetObjIdentifier();
+						}
+						if(nCmpId == OBJ_GRUP /*pTemp->ISA(SdrObjGroup)*/ && pTemp->GetName() == pCnt->GetName())
+						{
+							return pTemp->GetDescription();
+						}
+						//Commented End
+					}
+				}
+			}
+			break;		
+		case CONTENT_TYPE_GRAPHIC   :
+		case CONTENT_TYPE_OLE       :
+		case CONTENT_TYPE_FRAME     :
+			{
+				//Can't find the function "GetLongDescription". Need to verify again.
+				const SwFlyFrmFmt* pFlyFmt = pActiveShell->GetDoc()->FindFlyByName( pCnt->GetName(), 0);
+				if( pFlyFmt )
+					return pFlyFmt->GetDescription();				
+			}
+			break;
+	}
+	return String();
+}
+
+//-----IAccessibility2 Implementation 2009
 /***************************************************************************
 	Drag&Drop methods
 ***************************************************************************/
@@ -1210,10 +1392,32 @@
 					String sEntry = pCnt->GetName();
 					if(!sEntry.Len())
 						sEntry = sSpace;
-                    InsertEntry(sEntry, pParent,
+					SvLBoxEntry* pChild = InsertEntry(sEntry, pParent,
 							sal_False, LIST_APPEND, (void*)pCnt);
-				}
+					//IAccessibility2 Implementation 2009-----
+					//Solution: If object is marked , the corresponding entry is set true ,
+					//else the corresponding entry is set false .
+					//==================================================
+					SdrObject * pObj = GetDrawingObjectsByContent(pCnt);
+					if(pChild)
+					      pChild->SetMarked(sal_False);
+					if(pObj)
+					{
+						SdrView* pDrawView = pActiveShell->GetDrawView();
+						SdrPageView* pPV = pDrawView->/*GetPageViewPvNum*/GetSdrPageView(/*0*/);
+						if( pPV )
+						{
+							sal_Bool Marked = pDrawView->IsObjMarked(pObj);
+							if(Marked)
+							{
+								//sEntry += String::CreateFromAscii(" *");
+								pChild->SetMarked(sal_True);
+							}
 
+						}
+					}
+					//-----IAccessibility2 Implementation 2009
+				}
 			}
 		}
 	}
@@ -1222,6 +1426,41 @@
 	Beschreibung:	Expand - Zustand fuer Inhaltstypen merken
 ***************************************************************************/
 
+//IAccessibility2 Implementation 2009-----
+//Solution: Get drawing Objects by content .
+SdrObject* SwContentTree::GetDrawingObjectsByContent(const SwContent *pCnt)
+{
+	SdrObject *pRetObj = NULL;
+	sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+	switch(nJumpType)
+	{
+		case CONTENT_TYPE_DRAWOBJECT:
+		{
+			SdrView* pDrawView = pActiveShell->GetDrawView();
+			if (pDrawView)
+			{
+                SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                SdrPage* pPage = pDrawModel->GetPage(0);
+				sal_uInt32 nCount = pPage->GetObjCount();
+				
+				for( sal_uInt32 i=0; i< nCount; i++ )
+				{
+					SdrObject* pTemp = pPage->GetObj(i);
+					if( pTemp->GetName() == pCnt->GetName())
+					{
+						pRetObj = pTemp;
+						break;
+					}
+				}
+			}
+			break;
+		}
+		default:
+			pRetObj = NULL;
+	}
+	return pRetObj;
+}
+//-----IAccessibility2 Implementation 2009
 
 sal_Bool  SwContentTree::Expand( SvLBoxEntry* pParent )
 {
@@ -2221,6 +2460,15 @@
 		{
 			FindActiveTypeAndRemoveUserData();
 			Display(sal_True);
+			//IAccessibility2 Implementation 2009-----
+			//Solution: Set focus
+			if( bIsKeySpace )
+			{
+				HideFocus();
+				ShowFocus( oldRectangle);
+				bIsKeySpace = sal_False;
+			}
+			//-----IAccessibility2 Implementation 2009
 		}
 	}
 	else if(!pView && bIsActive && !bIsIdleClear)
@@ -2443,6 +2691,128 @@
             GrabFocus();
         }
 	}
+	//IAccessibility2 Implementation 2009-----
+	//Solution: Make KEY_SPACE has same function as DoubleClick ,
+	//and realize multi-selection .
+	else if(aCode.GetCode() == KEY_SPACE && 0 == aCode.GetModifier())
+	{
+		
+		SvLBoxEntry* pEntry = GetCurEntry();
+		if( GetChildCount( pEntry ) == 0 )
+			bIsKeySpace = sal_True;
+		Point tempPoint = GetEntryPosition( pEntry );//Change from "GetEntryPos" to "GetEntryPosition" for acc migration
+		oldRectangle = GetFocusRect( pEntry,tempPoint.Y() );
+		
+		if(pEntry)
+		{
+			if(bIsActive || bIsConstant)
+			{
+				if(bIsConstant)
+				{
+					pActiveShell->GetView().GetViewFrame()->GetWindow().ToTop();
+				}
+
+				SwContent* pCnt = (SwContent*)pEntry->GetUserData();
+
+				sal_Bool bSel = sal_False;
+				sal_uInt16 nJumpType = pCnt->GetParent()->GetType();
+				switch(nJumpType)
+				{
+					case CONTENT_TYPE_DRAWOBJECT:
+					{
+						SdrView* pDrawView = pActiveShell->GetDrawView();
+						if (pDrawView)
+						{
+							pDrawView->SdrEndTextEdit();//Change from "EndTextEdit" to "SdrEndTextEdit" for acc migration
+							
+                            SdrModel* pDrawModel = pActiveShell->GetDoc()->GetDrawModel();
+                            SdrPage* pPage = pDrawModel->GetPage(0);
+							sal_uInt32 nCount = pPage->GetObjCount();
+							sal_Bool hasObjectMarked = sal_False;
+
+							SdrObject* pObject = NULL;
+							pObject = GetDrawingObjectsByContent( pCnt );
+							if( pObject )
+							{
+								SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
+								if( pPV )
+								{
+									sal_Bool bUnMark = pDrawView->IsObjMarked(pObject);
+									pDrawView->MarkObj( pObject, pPV, bUnMark);
+									
+								}
+							}
+							for( sal_uInt32 i=0; i< nCount; i++ )
+							{
+								SdrObject* pTemp = pPage->GetObj(i);
+								sal_uInt16 nCmpId;
+								sal_Bool bMark = pDrawView->IsObjMarked(pTemp);
+								switch( pTemp->GetObjIdentifier() )
+								{
+									case OBJ_GRUP:
+									case OBJ_TEXT:
+									case OBJ_TEXTEXT:
+									case OBJ_wegFITTEXT:
+									case OBJ_LINE:
+									case OBJ_RECT:
+									case OBJ_CIRC:
+									case OBJ_SECT:
+									case OBJ_CARC:
+									case OBJ_CCUT:
+									case OBJ_POLY:
+									case OBJ_PLIN:
+									case OBJ_PATHLINE:
+									case OBJ_PATHFILL:
+									case OBJ_FREELINE:
+									case OBJ_FREEFILL:
+									case OBJ_PATHPOLY:
+									case OBJ_PATHPLIN:
+									case OBJ_CAPTION:
+									case OBJ_CUSTOMSHAPE:
+										nCmpId = OBJ_GRUP;
+										if( bMark )
+											hasObjectMarked = sal_True;
+										break;
+									default:
+										nCmpId = pTemp->GetObjIdentifier();
+										//IAccessibility2 Implementation 2009-----
+										if ( bMark )
+										{
+											SdrPageView* pPV = pDrawView->GetSdrPageView/*GetPageViewPvNum*/(/*0*/);
+											if (pPV)
+											{
+												pDrawView->MarkObj(pTemp, pPV, sal_True);
+											}
+										}
+										//-----IAccessibility2 Implementation 2009
+								}
+								//mod end							
+							}
+							if ( pActiveShell && !hasObjectMarked )
+							{
+								SwEditWin& pEditWindow = 
+									pActiveShell->GetView().GetEditWin();
+								if( &pEditWindow )
+								{
+									KeyCode tempKeycode( KEY_ESCAPE );
+									KeyEvent rKEvt( 0 , tempKeycode );
+									((Window*)&pEditWindow)->KeyInput( rKEvt );
+									
+								}
+								//rView.GetEditWin().GrabFocus();
+							}
+						}
+					}
+					break;
+				}
+				
+								
+				bViewHasChanged = sal_True;
+			}
+		}		
+
+	}	
+	//-----IAccessibility2 Implementation 2009
 	else
 		SvTreeListBox::KeyInput(rEvent);
 
@@ -3205,7 +3575,27 @@
 		rDev.DrawText( rPos, GetText() );
 		rDev.SetFont( aOldFont );
 	}
-	else
+	//IAccessibility2 Implementation 2009-----
+	// IA2 CWS. MT: Removed for now (also in SvLBoxEntry) - only used in Sw/Sd/ScContentLBoxString, they should decide if they need this
+	/*
+	else if (pEntry->IsMarked())
+	{
+			rDev.DrawText( rPos, GetText() );
+			XubString str;
+			str = XubString::CreateFromAscii("*");
+			Point rPosStar(rPos.X()-6,rPos.Y());
+			Font aOldFont( rDev.GetFont());
+			Font aFont(aOldFont);
+			Color aCol( aOldFont.GetColor() );
+			aCol.DecreaseLuminance( 200 );
+			aFont.SetColor( aCol );
+			rDev.SetFont( aFont );
+			rDev.DrawText( rPosStar, str);
+			rDev.SetFont( aOldFont );
+	}
+	//-----IAccessibility2 Implementation 2009
+	*/
+	else 
 		SvLBoxString::Paint( rPos, rDev, nFlags, pEntry);
 }
 /* -----------------------------06.05.2002 10:20------------------------------
@@ -3225,3 +3615,18 @@
 }
 
 
+//IAccessibility2 Implementation 2009-----
+sal_Int32  SwContentTree::GetEntryRealChildsNum( SvLBoxEntry* pParent ) const
+{
+	// ist es ein Inhaltstyp?
+	if(lcl_IsContentType(pParent))
+	{
+		if(!pParent->HasChilds())
+		{
+			SwContentType* pCntType = (SwContentType*)pParent->GetUserData();
+			return pCntType->GetMemberCount();
+		}
+	}
+	return 0;
+}
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/ui/utlui/navipi.hrc b/main/sw/source/ui/utlui/navipi.hrc
index db0c4a5..f2dd9a9 100644
--- a/main/sw/source/ui/utlui/navipi.hrc
+++ b/main/sw/source/ui/utlui/navipi.hrc
@@ -84,3 +84,8 @@
 #define ST_POSTIT_SHOW				(ST_GLOBAL_CONTEXT_FIRST +35)
 #define ST_POSTIT_HIDE				(ST_GLOBAL_CONTEXT_FIRST +36)
 #define ST_POSTIT_DELETE			(ST_GLOBAL_CONTEXT_FIRST +37)
+
+//IAccessibility2 Implementation 2009-----
+#define ST_TL_GLOBAL			ST_GLOBAL_CONTEXT_FIRST +38
+#define ST_TL_CONTENT			ST_GLOBAL_CONTEXT_FIRST +39
+//-----IAccessibility2 Implementation 2009
diff --git a/main/sw/source/ui/wrtsh/select.cxx b/main/sw/source/ui/wrtsh/select.cxx
index 77c0e68..43333c9 100644
--- a/main/sw/source/ui/wrtsh/select.cxx
+++ b/main/sw/source/ui/wrtsh/select.cxx
@@ -46,6 +46,11 @@
 #include <swdtflvr.hxx>
 #include <crsskip.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#ifndef _DOC_HXX
+#include <doc.hxx>
+#endif
+//-----IAccessibility2 Implementation 2009
 #if OSL_DEBUG_LEVEL > 1
 #include <pam.hxx>
 #endif
@@ -166,6 +171,14 @@
         }
         SttSelect();
         GoEnd(sal_True, &bMoveTable);
+
+		//IAccessibility2 Implementation 2009-----
+		SwDoc *pDoc = GetDoc();
+		if ( pDoc )
+		{
+			pDoc->SetPrepareSelAll();
+		}
+		//-----IAccessibility2 Implementation 2009
         if( pStartPos )
         {
             pTmpCrsr = getShellCrsr( false );
diff --git a/main/toolkit/inc/toolkit/awt/vclxwindows.hxx b/main/toolkit/inc/toolkit/awt/vclxwindows.hxx
index 1140dd7..da10876 100644
--- a/main/toolkit/inc/toolkit/awt/vclxwindows.hxx
+++ b/main/toolkit/inc/toolkit/awt/vclxwindows.hxx
@@ -876,6 +876,10 @@
 class TOOLKIT_DLLPUBLIC VCLXDateField :	public ::com::sun::star::awt::XDateField,
 						public VCLXFormattedSpinField
 {
+//IAccessibility2 Impplementaton 2009-----
+protected:
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+//-----IAccessibility2 Impplementaton 2009
 public:
 					VCLXDateField();
 					~VCLXDateField();
@@ -922,6 +926,10 @@
 class VCLXTimeField :	public ::com::sun::star::awt::XTimeField,
 						public VCLXFormattedSpinField
 {
+//IAccessibility2 Impplementaton 2009-----
+protected:
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > CreateAccessibleContext();
+//-----IAccessibility2 Impplementaton 2009
 public:
 					VCLXTimeField();
 					~VCLXTimeField();
diff --git a/main/toolkit/source/awt/vclxaccessiblecomponent.cxx b/main/toolkit/source/awt/vclxaccessiblecomponent.cxx
index aeacca3..3c92c83 100644
--- a/main/toolkit/source/awt/vclxaccessiblecomponent.cxx
+++ b/main/toolkit/source/awt/vclxaccessiblecomponent.cxx
@@ -37,6 +37,10 @@
 #include <toolkit/awt/vclxfont.hxx>
 #include <vcl/dialog.hxx>
 #include <vcl/window.hxx>
+//IAccessibility2 Implementation 2009-----
+//Solution:Need methods in Edit.
+#include <vcl/edit.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <tools/debug.hxx>
 #include <unotools/accessiblestatesethelper.hxx>
 #include <unotools/accessiblerelationsethelper.hxx>
@@ -441,7 +445,9 @@
 	Window* pWindow = GetWindow();
 	if ( pWindow )
 	{
+//IAccessibility2 Implementation 2009-----
 		Window *pLabeledBy = pWindow->GetAccessibleRelationLabeledBy();
+//-----IAccessibility2 Implementation 2009
 		if ( pLabeledBy && pLabeledBy != pWindow )
 		{
 			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
@@ -456,6 +462,20 @@
 			aSequence[0] = pLabelFor->GetAccessible();
 			rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::LABEL_FOR, aSequence ) );
 		}
+//IAccessibility2 Implementation 2009-----
+		Window* pMemberOf = pWindow->GetAccessibleRelationMemberOf();	
+		if ( pMemberOf && pMemberOf != pWindow )
+		{
+			uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+			aSequence[0] = pMemberOf->GetAccessible();
+			rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+		}
+		uno::Sequence< uno::Reference< uno::XInterface > > aFlowToSequence = pWindow->GetAccFlowToSequence();
+		if( aFlowToSequence.getLength() > 0 )
+		{
+			rRelationSet.AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::CONTENT_FLOWS_TO, aFlowToSequence ) );		
+		}
+//-----IAccessibility2 Implementation 2009
 	}
 }
 
@@ -504,13 +524,50 @@
 
 		if ( pWindow->GetStyle() & WB_SIZEABLE )
 			rStateSet.AddState( accessibility::AccessibleStateType::RESIZABLE );
-
+//IAccessibility2 Implementation 2009-----
+		// 6. frame doesn't have MOVABLE state
+		// 10. for password text, where is the sensitive state? 
+		if( ( getAccessibleRole() == accessibility::AccessibleRole::FRAME ||getAccessibleRole() == accessibility::AccessibleRole::DIALOG )&& pWindow->GetStyle() & WB_MOVEABLE )
+			rStateSet.AddState( accessibility::AccessibleStateType::MOVEABLE );
+//-----IAccessibility2 Implementation 2009
         if( pWindow->IsDialog() )
         {
             Dialog *pDlg = static_cast< Dialog* >( pWindow );
             if( pDlg->IsInExecute() )
 			    rStateSet.AddState( accessibility::AccessibleStateType::MODAL );
         }
+//IAccessibility2 Implementation 2009-----
+        //Solution:If a combobox or list's edit child isn't read-only,EDITABLE state
+        //         should be set.
+		if( pWindow && pWindow->GetType() == WINDOW_COMBOBOX )
+		{
+			if( !( pWindow->GetStyle() & WB_READONLY) ||  
+			    !((Edit*)pWindow)->IsReadOnly() )
+					rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );	
+		}
+		
+		Window* pChild = pWindow->GetWindow( WINDOW_FIRSTCHILD );
+		
+		while( pWindow && pChild )
+		{
+			Window* pWinTemp = pChild->GetWindow( WINDOW_FIRSTCHILD );
+			if( pWinTemp && pWinTemp->GetType() == WINDOW_EDIT )
+			{
+				if( !( pWinTemp->GetStyle() & WB_READONLY) || 
+					!((Edit*)pWinTemp)->IsReadOnly() )
+					rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );
+				break;	
+			}
+			if( pChild->GetType() == WINDOW_EDIT )
+			{
+				if( !( pChild->GetStyle() & WB_READONLY) || 
+					!((Edit*)pChild)->IsReadOnly())
+					rStateSet.AddState( accessibility::AccessibleStateType::EDITABLE );
+				break;	
+			}
+			pChild = pChild->GetWindow( WINDOW_NEXT );
+		}
+//-----IAccessibility2 Implementation 2009
 	}
 	else
 	{
@@ -846,6 +903,11 @@
 			else
 				aFont = pWindow->GetFont();
 			nColor = aFont.GetColor().GetColor();
+//IAccessibility2 Implementation 2009-----
+// COL_AUTO is not very meaningful for AT
+			if ( nColor == (sal_Int32)COL_AUTO)
+				nColor = pWindow->GetTextColor().GetColor();
+//-----IAccessibility2 Implementation 2009
 		}
 	}
 
diff --git a/main/toolkit/source/awt/vclxtoolkit.cxx b/main/toolkit/source/awt/vclxtoolkit.cxx
index d5cf1bb..b597553 100644
--- a/main/toolkit/source/awt/vclxtoolkit.cxx
+++ b/main/toolkit/source/awt/vclxtoolkit.cxx
@@ -632,6 +632,11 @@
 
 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer > VCLXToolkit::createWindow( const ::com::sun::star::awt::WindowDescriptor& rDescriptor ) throw(::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+	CEnableAccessInterface e;
+#endif
+//-----IAccessibility2 Implementation 2009
     return ImplCreateWindow( rDescriptor, WinBits(0) );
 }
 
diff --git a/main/toolkit/source/awt/vclxwindows.cxx b/main/toolkit/source/awt/vclxwindows.cxx
index 4998ecb..4ff01f3 100644
--- a/main/toolkit/source/awt/vclxwindows.cxx
+++ b/main/toolkit/source/awt/vclxwindows.cxx
@@ -4505,6 +4505,19 @@
 {
 }
 
+//IAccessibility2 Implementation 2009-----
+//change the window type here to match the role
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXDateField::CreateAccessibleContext()
+{
+	Window* pWindow = GetWindow();
+	if ( pWindow )
+	{
+		pWindow->SetType( WINDOW_DATEFIELD );
+	}
+	return getAccessibleFactory().createAccessibleContext( this );
+}
+//-----IAccessibility2 Implementation 2009
+
 // ::com::sun::star::uno::XInterface
 ::com::sun::star::uno::Any VCLXDateField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
 {
@@ -4846,6 +4859,18 @@
 VCLXTimeField::~VCLXTimeField()
 {
 }
+//IAccessibility2 Implementation 2009-----
+//change the window type here to match the role
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleContext > VCLXTimeField::CreateAccessibleContext()
+{
+	Window* pWindow = GetWindow();
+	if ( pWindow )
+	{
+		pWindow->SetType( WINDOW_TIMEFIELD );
+	}
+	return getAccessibleFactory().createAccessibleContext( this );
+}
+//-----IAccessibility2 Implementation 2009
 
 // ::com::sun::star::uno::XInterface
 ::com::sun::star::uno::Any VCLXTimeField::queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException)
diff --git a/main/vcl/inc/ilstbox.hxx b/main/vcl/inc/ilstbox.hxx
index cfb46fa..c7859d2 100644
--- a/main/vcl/inc/ilstbox.hxx
+++ b/main/vcl/inc/ilstbox.hxx
@@ -250,6 +250,10 @@
 	Link			maDoubleClickHdl;
 	Link			maUserDrawHdl;
 	Link			maMRUChangedHdl;
+//IAccessibility2 Implementation 2009-----
+	Link			maFocusHdl;
+	Link			maListItemSelectHdl;
+//-----IAccessibility2 Implementation 2009
 
     ::vcl::QuickSelectionEngine maQuickSelectionEngine;
 
@@ -263,7 +267,10 @@
 	virtual void	GetFocus();
 	virtual void	LoseFocus();
 
-	sal_Bool			SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
+	//IAccessibility2 Implementation 2009-----
+	//sal_Bool			SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False );
+	sal_Bool			SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift = sal_False, sal_Bool bCtrl = sal_False, sal_Bool bSelectPosChange = sal_False );
+	//-----IAccessibility2 Implementation 2009
 	void			ImplPaint( sal_uInt16 nPos, sal_Bool bErase = sal_False, bool bLayout = false );
     void			ImplDoPaint( const Rectangle& rRect, bool bLayout = false );
 	void			ImplCalcMetrics();
@@ -360,8 +367,14 @@
 	const Link& 	GetUserDrawHdl() const				{ return maUserDrawHdl; }
 	void			SetMRUChangedHdl( const Link& rLink )	{ maMRUChangedHdl = rLink; }
 	const Link& 	GetMRUChangedHdl() const				{ return maMRUChangedHdl; }
+//IAccessibility2 Implementation 2009-----
+	void			SetFocusHdl( const Link& rLink )	{ maFocusHdl = rLink ; }
+	const Link& 	GetFocusHdl() const				{ return maFocusHdl; }
 
-	bool            IsSelectionChanged() const { return mbSelectionChanged; }
+	void			SetListItemSelectHdl( const Link& rLink )	{ maListItemSelectHdl = rLink ; }
+	const Link& 	GetListItemSelectHdl() const				{ return maListItemSelectHdl; }
+//-----IAccessibility2 Implementation 2009
+	bool			IsSelectionChanged() const { return mbSelectionChanged; }
 	sal_uInt16			GetSelectModifier() const { return mnSelectModifier; }
 
 	void			EnableSort( bool b ) { mbSort = b; }
@@ -497,6 +510,12 @@
 	void			SetUserDrawHdl( const Link& rLink )	{ maLBWindow.SetUserDrawHdl( rLink ); }
 	const Link& 	GetUserDrawHdl() const				{ return maLBWindow.GetUserDrawHdl(); }
 
+//IAccessibility2 Implementation 2009-----
+	void			SetFocusHdl( const Link& rLink )	{ maLBWindow.SetFocusHdl( rLink ); }
+	const Link& 	GetFocusHdl() const				{ return maLBWindow.GetFocusHdl(); }
+	void			SetListItemSelectHdl( const Link& rLink )	{ maLBWindow.SetListItemSelectHdl( rLink ); }
+	const Link& 	GetListItemSelectHdl() const	{ return maLBWindow.GetListItemSelectHdl(); }
+//-----IAccessibility2 Implementation 2009
 	void			SetSelectionChangedHdl( const Link& rLnk )	{ maLBWindow.GetEntryList()->SetSelectionChangedHdl( rLnk ); }
 	void			SetCallSelectionChangedHdl( sal_Bool bCall )	{ maLBWindow.GetEntryList()->SetCallSelectionChangedHdl( bCall ); }
 	sal_Bool			IsSelectionChanged() const 					{ return maLBWindow.IsSelectionChanged(); }
diff --git a/main/vcl/inc/svdata.hxx b/main/vcl/inc/svdata.hxx
index 8ba7ccd..03f509f 100644
--- a/main/vcl/inc/svdata.hxx
+++ b/main/vcl/inc/svdata.hxx
@@ -182,6 +182,9 @@
      */
     ImeStatusWindowMode meShowImeStatusWindow;
 
+//IAccessibility2 Implementation 2009-----
+	long m_bEnableAccessInterface;
+//-----IAccessibility2 Implementation 2009
                             DECL_STATIC_LINK( ImplSVAppData, ImplQuitMsg, void* );
                            
 };
diff --git a/main/vcl/inc/vcl/combobox.hxx b/main/vcl/inc/vcl/combobox.hxx
index e757ef0..9c62caf 100644
--- a/main/vcl/inc/vcl/combobox.hxx
+++ b/main/vcl/inc/vcl/combobox.hxx
@@ -67,6 +67,9 @@
     DECL_DLLPRIVATE_LINK(   ImplSelectionChangedHdl, void* );
     DECL_DLLPRIVATE_LINK(   ImplUserDrawHdl, UserDrawEvent* );
     DECL_DLLPRIVATE_LINK(   ImplAutocompleteHdl, Edit* );
+    //IAccessibility2 Implementation 2009-----
+    DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
+    //-----IAccessibility2 Implementation 2009
 
 protected:
     using Window::ImplInit;
@@ -182,7 +185,9 @@
     XubString       GetMRUEntries( xub_Unicode cSep = ';' ) const;
     void            SetMaxMRUCount( sal_uInt16 n );
     sal_uInt16          GetMaxMRUCount() const;
-
+//IAccessibility2 Implementation 2009-----
+    sal_uInt16 	GetMRUCount() const;
+//-----IAccessibility2 Implementation 2009
     void            SetEntryData( sal_uInt16 nPos, void* pNewData );
     void*           GetEntryData( sal_uInt16 nPos ) const;
 
@@ -222,6 +227,9 @@
      */
     using Control::GetIndexForPoint;
     long GetIndexForPoint( const Point& rPoint, sal_uInt16& rPos ) const;
+//IAccessibility2 Implementation 2009-----
+  	void  SetMpSubEditAccessibleName(String &aName);
+//-----IAccessibility2 Implementation 2009
 };
 
 #endif  // _COMBOBOX_HXX
diff --git a/main/vcl/inc/vcl/lstbox.hxx b/main/vcl/inc/vcl/lstbox.hxx
index f936f87..a8d4e20 100644
--- a/main/vcl/inc/vcl/lstbox.hxx
+++ b/main/vcl/inc/vcl/lstbox.hxx
@@ -67,7 +67,10 @@
 	DECL_DLLPRIVATE_LINK(  ImplPopupModeEndHdl, void* );
 	DECL_DLLPRIVATE_LINK(  ImplSelectionChangedHdl, void* );
 	DECL_DLLPRIVATE_LINK(  ImplUserDrawHdl, UserDrawEvent* );
-
+//IAccessibility2 Implementation 2009-----
+					DECL_DLLPRIVATE_LINK( ImplFocusHdl, void* );					
+					DECL_DLLPRIVATE_LINK( ImplListItemSelectHdl , void* );
+//-----IAccessibility2 Implementation 2009
 protected:
     using Window::ImplInit;
 	SAL_DLLPRIVATE void    ImplInit( Window* pParent, WinBits nStyle );
@@ -217,7 +220,9 @@
 	XubString		GetMRUEntries( xub_Unicode cSep = ';' ) const;
 	void			SetMaxMRUCount( sal_uInt16 n );
 	sal_uInt16			GetMaxMRUCount() const;
-
+//IAccessibility2 Implementation 2009-----
+	sal_uInt16 			GetMRUCount() const;
+//-----IAccessibility2 Implementation 2009
     sal_uInt16			GetDisplayLineCount() const;
 
 	void			EnableMirroring();
diff --git a/main/vcl/inc/vcl/menu.hxx b/main/vcl/inc/vcl/menu.hxx
index a47d174..411649b 100644
--- a/main/vcl/inc/vcl/menu.hxx
+++ b/main/vcl/inc/vcl/menu.hxx
@@ -151,7 +151,9 @@
 	sal_uInt16				nMenuFlags;
 	sal_uInt16				nDefaultItem;		// Id vom Default-Item
 	sal_uInt16				nSelectedId;
-
+//IAccessibility2 Implementation 2009-----
+	sal_uInt16				nHighlightedItem;
+//-----IAccessibility2 Implementation 2009
 	// Fuer Ausgabe:
 	sal_uInt16				nCheckPos;
 	sal_uInt16				nImagePos;
@@ -242,7 +244,14 @@
 	sal_uInt16				GetItemPos( sal_uInt16 nItemId ) const;
 	MenuItemType		GetItemType( sal_uInt16 nPos ) const;
 	sal_uInt16				GetCurItemId() const;
+//IAccessibility2 Implementation 2009-----
+	void 					SetHightlightItem( sal_uInt16 nHighlightedItem );
+	sal_uInt16 				GetHighlightItem() const;
 
+	XubString			GetItemAccKeyStrFromPos(sal_uInt16 nPos ) const ;
+
+	sal_Bool				IsTemporaryItemFromPos(sal_uInt16 nPos ) const;
+//-----IAccessibility2 Implementation 2009
 	void				SetDefaultItem( sal_uInt16 nItemId )	{ nDefaultItem = nItemId; }
 	sal_uInt16				GetDefaultItem() const				{ return nDefaultItem; }
 
@@ -371,6 +380,9 @@
 
 	void				SetAccessibleDescription( sal_uInt16 nItemId, const XubString& rStr );
 	XubString			GetAccessibleDescription( sal_uInt16 nItemId ) const;
+//IAccessibility2 Implementation 2009
+	Menu* GetStartedFromMenu(){ return pStartedFrom ;}
+//-----IAccessibility2 Implementation 2009
     
     // returns whether the item a position nItemPos is highlighted or not.
     bool  IsHighlighted( sal_uInt16 nItemPos ) const;
diff --git a/main/vcl/inc/vcl/svapp.hxx b/main/vcl/inc/vcl/svapp.hxx
index 06f498d..3c21c4a 100644
--- a/main/vcl/inc/vcl/svapp.hxx
+++ b/main/vcl/inc/vcl/svapp.hxx
@@ -448,6 +448,10 @@
     
     static void                 ShowNativeErrorBox(const String& sTitle  ,
                                                    const String& sMessage);
+//IAccessibility2 Implementation 2009-----
+	static bool					EnableAccessInterface(bool bEnable);
+	static bool					IsEnableAccessInterface();
+//-----IAccessibility2 Implementation 2009
 
     // IME Status Window Control:
 
@@ -514,4 +518,27 @@
     PostUserEvent( Link() );
 }
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+VCL_DLLPUBLIC sal_Bool HasAtHook();
+VCL_DLLPUBLIC bool IsWNTInitAccessBridge();
+bool WNTEnableAccessInterface(bool bEnable);
+
+class VCL_DLLPUBLIC CEnableAccessInterface
+{
+public:
+	CEnableAccessInterface(bool bEnable = false)
+	{
+		m_bIsEnableAccessInterface = Application::IsEnableAccessInterface();
+		Application::EnableAccessInterface(bEnable);
+	}
+	~CEnableAccessInterface()
+	{
+		Application::EnableAccessInterface(m_bIsEnableAccessInterface);
+	}
+private:
+	bool m_bIsEnableAccessInterface;
+};
+#endif
+//-----IAccessibility2 Implementation 2009
 #endif // _APP_HXX
diff --git a/main/vcl/inc/vcl/vclevent.hxx b/main/vcl/inc/vcl/vclevent.hxx
index e623734..f5f5cb7 100644
--- a/main/vcl/inc/vcl/vclevent.hxx
+++ b/main/vcl/inc/vcl/vclevent.hxx
@@ -154,6 +154,10 @@
 #define VCLEVENT_ITEM_COLLAPSED             1175
 // <--
 #define VCLEVENT_DROPDOWN_PRE_OPEN          1176
+//IAccessibility2 Implementation 2009-----
+#define VCLEVENT_LISTBOX_FOCUSITEMCHANGED	1180
+// #define VCLEVENT_EDIT_CARETCHANGED  		xxxx	// IA2 CWS. MT: VCL only has selection API - difference for selection_changed vs. caret_changed is handled in accessibility wrapper since OOo 3.2
+//-----IAccessibility2 Implementation 2009
 
 // VclMenuEvent
 #define VCLEVENT_MENU_ACTIVATE              1200
@@ -172,24 +176,39 @@
 #define VCLEVENT_MENU_ITEMCHECKED			1213
 #define VCLEVENT_MENU_ITEMUNCHECKED			1214
 #define VCLEVENT_MENU_ACCESSIBLENAMECHANGED	1215
+//IAccessibility2 Implementation 2009-----
+#define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED  1216
+#define VCLEVENT_TOOLBOX_ITEMUPDATED  1217
+//-----IAccessibility2 Implementation 2009
 
 #define VCLEVENT_MENU_SHOW                  1250
 #define VCLEVENT_MENU_HIDE                  1251
 
 #define VCLEVENT_TOOLBOX_ITEMWINDOWCHANGED  1216
+//IAccessibility2 Implementation 2009-----
+#define VCLEVENT_LISTBOX_TREEEXPAND             1218
+#define VCLEVENT_LISTBOX_TREECOLLAPSE           1219
+#define VCLEVENT_LISTBOX_TREEFOCUS	            1220
+#define VCLEVENT_LISTBOX_TREESELECT	            1221
+#define VCLEVENT_EDIT_CARETCHANGED  1222
+#define VCLEVENT_COMBOBOX_UPDATEVALUE  1223
 
+#define VCLEVENT_LISTBOX_FOCUS             1224
+#define VCLEVENT_LISTBOX_CLEAR             1225
+//-----IAccessibility2 Implementation 2009
 // DockingWindow
-#define VCLEVENT_WINDOW_STARTDOCKING            1217    // pData = DockingData
-#define VCLEVENT_WINDOW_DOCKING                 1218
-#define VCLEVENT_WINDOW_ENDDOCKING              1219    // pData = EndDockingData
-#define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING   1220    // pData = sal_Bool
-#define VCLEVENT_WINDOW_TOGGLEFLOATING          1221
-#define VCLEVENT_WINDOW_ENDPOPUPMODE            1222    // pData = EndPopupModeData
+#define VCLEVENT_WINDOW_STARTDOCKING            1227    // pData = DockingData
+#define VCLEVENT_WINDOW_DOCKING                 1228
+#define VCLEVENT_WINDOW_ENDDOCKING              1229    // pData = EndDockingData
+#define VCLEVENT_WINDOW_PREPARETOGGLEFLOATING   1230    // pData = sal_Bool
+#define VCLEVENT_WINDOW_TOGGLEFLOATING          1231
+#define VCLEVENT_WINDOW_ENDPOPUPMODE            1232    // pData = EndPopupModeData
 
-#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED     1223    // pData = itempos
-#define VCLEVENT_TABLECELL_NAMECHANGED          1224    // pData = struct(Entry, Column, oldText)
-#define VCLEVENT_TABLEROW_SELECT				1225
-
+#define VCLEVENT_TOOLBOX_BUTTONSTATECHANGED     1233    // pData = itempos
+#define VCLEVENT_TABLECELL_NAMECHANGED          1234    // pData = struct(Entry, Column, oldText)
+#define VCLEVENT_TABLEROW_SELECT				1235
+// IAccessible2 implementation 2009
+#define VCLEVENT_LISTBOX_STATEUPDATE			1236
 class VCL_DLLPUBLIC VclSimpleEvent
 {
 private:
diff --git a/main/vcl/inc/vcl/window.hxx b/main/vcl/inc/vcl/window.hxx
index 9d7002c..bc0a10f 100644
--- a/main/vcl/inc/vcl/window.hxx
+++ b/main/vcl/inc/vcl/window.hxx
@@ -629,6 +629,11 @@
     virtual void        DataChanged( const DataChangedEvent& rDCEvt );
     virtual long        PreNotify( NotifyEvent& rNEvt );
     virtual long        Notify( NotifyEvent& rNEvt );
+//IAccessibility2 Implementation 2009-----
+    virtual void        NotifyVCLEvent( sal_uLong nEvent ,void* pData = NULL);
+    virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > GetAccFlowToSequence();
+	virtual void SwitchView() {}
+//-----IAccessibility2 Implementation 2009
     virtual Window*     GetPreferredKeyInputWindow();
 
     /*virtual*/ void    AddEventListener( const Link& rEventListener );
diff --git a/main/vcl/inc/win/g_msaasvc.h b/main/vcl/inc/win/g_msaasvc.h
new file mode 100644
index 0000000..9e119c6
--- /dev/null
+++ b/main/vcl/inc/win/g_msaasvc.h
@@ -0,0 +1,23 @@
+/************************************************************************

+ *

+ * Licensed Materials - Property of IBM.

+ * (C) Copyright IBM Corporation 2003, 2009.  All Rights Reserved.

+ * U.S. Government Users Restricted Rights:

+ * Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

+ *

+ ************************************************************************/

+ 
+/*************************************************************************
+ *
+ *   	
+ * (C) Copyright IBM Corp. 2003, 2005  
+ * The source code for this program is not published or otherwise
+ * divested of its IBM trade secrets, irrespective of what has
+ * been deposited with the U.S. Copyright Office.
+ * All rights reserved
+ *
+*************************************************************************/
+#ifndef _SV_G_MSASSVR_H_
+#define _SV_G_MSASSVR_H_
+extern com::sun::star::accessibility::XMSAAService* g_acc_manager1;
+#endif
diff --git a/main/vcl/source/app/svapp.cxx b/main/vcl/source/app/svapp.cxx
index 2787b52..f831d6a 100644
--- a/main/vcl/source/app/svapp.cxx
+++ b/main/vcl/source/app/svapp.cxx
@@ -24,7 +24,7 @@
 // MARKER(update_precomp.py): autogen include statement, do not remove
 #include "precompiled_vcl.hxx"
 
-//#include "svsys.h"
+#include "svsys.h"
 
 #include "comphelper/processfactory.hxx"
 
@@ -77,6 +77,10 @@
 
 #include <utility>
 
+#ifdef WNT
+#include <tchar.h>
+#endif
+
 using namespace ::com::sun::star::uno;
 
 // keycodes handled internally by VCL
@@ -2045,7 +2049,13 @@
 
 sal_Bool Application::IsAccessibilityEnabled()
 {
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+	return IsWNTInitAccessBridge();
+#else 
     return sal_False;
+#endif 
+//-----IAccessible2 Implementation 2009
 }
 
 sal_Bool InitAccessBridge( sal_Bool bShowCancel, sal_Bool &rCancelled )
@@ -2057,22 +2067,52 @@
     (void) bShowCancel; // unsued
     (void) rCancelled; // unused
 #else
-    bRet = ImplInitAccessBridge( bShowCancel, rCancelled );
-    
-    if( !bRet && bShowCancel && !rCancelled )
-    {
-        // disable accessibility if the user chooses to continue
-        AllSettings aSettings = Application::GetSettings();
-        MiscSettings aMisc = aSettings.GetMiscSettings();
-        aMisc.SetEnableATToolSupport( sal_False );
-        aSettings.SetMiscSettings( aMisc );
-        Application::SetSettings( aSettings );
-    }
+	// Checking HasAtHook() was introduced with IBM's IA2 CWS.
+	if( HasAtHook() )
+	{
+	    bRet = ImplInitAccessBridge( bShowCancel, rCancelled );
+	    
+	    if( !bRet && bShowCancel && !rCancelled )
+	    {
+	        // disable accessibility if the user chooses to continue
+	        AllSettings aSettings = Application::GetSettings();
+	        MiscSettings aMisc = aSettings.GetMiscSettings();
+	        aMisc.SetEnableATToolSupport( sal_False );
+	        aSettings.SetMiscSettings( aMisc );
+	        Application::SetSettings( aSettings );
+	    }
+	}
+	else
+	{
+		bRet = false;
+	}
 #endif // !UNX
 
     return bRet;
 }
 
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+sal_Bool HasAtHook()
+{
+	sal_Int32 bIsRuning=0;
+	// BOOL WINAPI SystemParametersInfo(
+	//	  __in     UINT uiAction,
+	//	  __in     UINT uiParam,
+	//	  __inout  PVOID pvParam,
+	//	  __in     UINT fWinIni
+	//	);
+	// pvParam must be BOOL (defined in MFC as int)
+	// End
+	if(SystemParametersInfo(SPI_GETSCREENREADER,0,&bIsRuning,0))
+	{
+		if( bIsRuning )
+			return sal_True;
+	}
+	return sal_False;
+}
+#endif
+//-----IAccessible2 Implementation 2009
 // MT: AppProperty, AppEvent was in oldsv.cxx, but is still needed...
 // ------------------------------------------------------------------------
 
@@ -2094,6 +2134,21 @@
         delete pHandler;
     pHandler = p;
 }
+//IAccessible2 Implementation 2009-----
+bool Application::EnableAccessInterface(bool bEnable)
+{
+#ifdef WNT
+	return WNTEnableAccessInterface(bEnable);
+#else 
+    bEnable = TRUE; // avoid compiler warning
+    return TRUE;
+#endif 
+}
+bool Application::IsEnableAccessInterface()
+{
+	return ImplGetSVData()->maAppData.m_bEnableAccessInterface;
+}
+//-----IAccessibility2 Implementation 2009
 
 
 
diff --git a/main/vcl/source/app/svdata.cxx b/main/vcl/source/app/svdata.cxx
index 3e1afdd..50cc0d8 100644
--- a/main/vcl/source/app/svdata.cxx
+++ b/main/vcl/source/app/svdata.cxx
@@ -36,6 +36,16 @@
 
 #include "unotools/fontcfg.hxx"
 
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_ACCESSIBLEROLE_HPP_
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#endif
+#endif
+//-----IAccessible2 Implementation 2009
 #include "vos/mutex.hxx"
 
 #include "cppuhelper/implbase1.hxx"
@@ -67,6 +77,13 @@
 #include "com/sun/star/java/JavaDisabledException.hpp"
 
 #include <stdio.h>
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+#include <unotools/processfactory.hxx>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#include <win/g_msaasvc.h>
+#endif
+//-----IAccessible2 Implementation 2009
 
 namespace {
 
@@ -132,6 +149,12 @@
             break;
         }
     }
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+	//Default enable the acc bridge interface
+	pImplSVData->maAppData.m_bEnableAccessInterface =true;
+#endif
+//-----IAccessible2 Implementation 2009
     
     // mark default layout border as unitialized
     pImplSVData->maAppData.mnDefaultLayoutBorder = -1;
@@ -339,7 +362,89 @@
     }
     return ret;
 }
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+void AccessBridgehandleExistingWindow(Window * pWindow, bool bShow)
+{
+    if ( pWindow )
+    {
+        css::uno::Reference< css::accessibility::XAccessible > xAccessible;
+    
+        // Test for combo box - drop down floating windows first
+        Window * pParentWindow = pWindow->GetParent();
 
+        if ( pParentWindow )
+        {
+            try 
+            {
+                // The parent window of a combo box floating window should have the role COMBO_BOX
+                css::uno::Reference< css::accessibility::XAccessible > xParentAccessible(pParentWindow->GetAccessible());
+                if ( xParentAccessible.is() )
+                {
+                    css::uno::Reference< css::accessibility::XAccessibleContext > xParentAC( xParentAccessible->getAccessibleContext() );
+                    if ( xParentAC.is() && (css::accessibility::AccessibleRole::COMBO_BOX == xParentAC->getAccessibleRole()) )
+                    {
+                        // O.k. - this is a combo box floating window corresponding to the child of role LIST of the parent.
+                        // Let's not rely on a specific child order, just search for the child with the role LIST
+                        sal_Int32 nCount = xParentAC->getAccessibleChildCount();
+                        for ( sal_Int32 n = 0; (n < nCount) && !xAccessible.is(); n++)
+                        {
+                            css::uno::Reference< css::accessibility::XAccessible > xChild = xParentAC->getAccessibleChild(n);
+                            if ( xChild.is() )
+                            {
+                                css::uno::Reference< css::accessibility::XAccessibleContext > xChildAC = xChild->getAccessibleContext();
+                                if ( xChildAC.is() && (css::accessibility::AccessibleRole::LIST == xChildAC->getAccessibleRole()) )
+                                {
+                                    xAccessible = xChild;
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+            catch (::com::sun::star::uno::RuntimeException e)
+            {
+                // Ignore show events that throw DisposedExceptions in getAccessibleContext(),
+                // but keep revoking these windows in hide(s).
+                if (bShow)
+                    return;
+            }
+        }
+
+        // We have to rely on the fact that Window::GetAccessible()->getAccessibleContext() returns a valid XAccessibleContext
+        // also for other menus than menubar or toplevel popup window. Otherwise we had to traverse the hierarchy to find the 
+        // context object to this menu floater. This makes the call to Window->IsMenuFloatingWindow() obsolete.
+        if ( ! xAccessible.is() )
+            xAccessible = pWindow->GetAccessible();
+
+		if ( xAccessible.is() && g_acc_manager1 )
+        {
+			g_acc_manager1->handleWindowOpened( (long)(xAccessible.get()));
+        }
+    }
+}
+
+void AccessBridgeupdateOldTopWindows()
+{
+	sal_uInt16 nTopWindowCount = (sal_uInt16)Application::GetTopWindowCount();
+	for (sal_uInt16 i = 0; i < nTopWindowCount; i++)
+	{
+		Window* pTopWindow = Application::GetTopWindow( i );
+        css::uno::Reference< css::accessibility::XAccessible > xAccessible = pTopWindow->GetAccessible();
+        if ( xAccessible.is() )
+        {
+			css::uno::Reference< css::accessibility::XAccessibleContext > xAC(xAccessible->getAccessibleContext());
+            if ( xAC.is())
+            {
+            	short role = xAC->getAccessibleRole();
+            	if(xAC->getAccessibleName().getLength() > 0)
+					AccessBridgehandleExistingWindow(pTopWindow, true);
+            }
+        }
+	}
+}
+#endif
+//-----IAccessible2 Implementation 2009
 
 bool ImplInitAccessBridge(sal_Bool bAllowCancel, sal_Bool &rCancelled)
 {
@@ -371,6 +476,22 @@
 
             if( xFactory.is() )
             {
+//IAccessible2 Implementation 2009-----
+#ifdef WNT
+				pSVData->mxAccessBridge = xFactory->createInstance(
+			               OUString::createFromAscii( "com.sun.star.accessibility.MSAAService" ) ); 
+			    if( pSVData->mxAccessBridge.is() )
+			    {
+			    	css::uno::Reference< css::uno::XInterface > pRManager= pSVData->mxAccessBridge;
+			    	g_acc_manager1 = (css::accessibility::XMSAAService*)(pRManager.get());
+					AccessBridgeupdateOldTopWindows();
+			    }
+			    
+			    if( !pSVData->mxAccessBridge.is() )
+                    bSuccess = false;
+                return bSuccess;
+#endif
+//-----IAccessible2 Implementation 2009
                 css::uno::Reference< XExtendedToolkit > xToolkit = 
                     css::uno::Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
 
diff --git a/main/vcl/source/app/svmain.cxx b/main/vcl/source/app/svmain.cxx
index 7083a97..1e02214 100644
--- a/main/vcl/source/app/svmain.cxx
+++ b/main/vcl/source/app/svmain.cxx
@@ -55,6 +55,11 @@
 #include <process.h>    // for _beginthreadex
 #include <ole2.h>   // for _beginthreadex
 #include <tools/postwin.h>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#include <win/g_msaasvc.h>
+using namespace com::sun::star::accessibility;
+//-----IAccessibility2 Implementation 2009
 #endif
 
 // [ed 5/14/02 Add in explicit check for quartz graphics.  OS X will define
@@ -215,6 +220,12 @@
 	}
 
     DeInitVCL();
+//IAccessibility2 Implementation 2009-----
+	#ifdef WNT
+		if( g_acc_manager1 )
+			g_acc_manager1->release();
+	#endif 
+//-----IAccessibility2 Implementation 2009
     return bInit;
 }
 
diff --git a/main/vcl/source/control/combobox.cxx b/main/vcl/source/control/combobox.cxx
index 03dc3f8..85be67f 100644
--- a/main/vcl/source/control/combobox.cxx
+++ b/main/vcl/source/control/combobox.cxx
@@ -215,6 +215,9 @@
 	mpImplLB->SetDoubleClickHdl( LINK( this, ComboBox, ImplDoubleClickHdl ) );
 	mpImplLB->SetUserDrawHdl( LINK( this, ComboBox, ImplUserDrawHdl ) );
 	mpImplLB->SetSelectionChangedHdl( LINK( this, ComboBox, ImplSelectionChangedHdl ) );
+//IAccessibility2 Implementation 2009-----
+	mpImplLB->SetListItemSelectHdl( LINK( this, ComboBox, ImplListItemSelectHdl ) );
+//-----IAccessibility2 Implementation 2009
 	mpImplLB->Show();
 
 	if ( mpFloatWin )
@@ -273,7 +276,13 @@
 {
 	return mpSubEdit->GetAutocompleteHdl().IsSet();
 }
-
+//IAccessibility2 Implementation 2009-----
+void  ComboBox::SetMpSubEditAccessibleName(String &aName)
+{
+	if(mpSubEdit!=NULL)
+        mpSubEdit->SetAccessibleName(aName);
+}              
+//-----IAccessibility2 Implementation 2009
 // -----------------------------------------------------------------------
 
 IMPL_LINK( ComboBox, ImplClickBtnHdl, void*, EMPTYARG )
@@ -468,7 +477,13 @@
 
 	return 0;
 }
-
+//IAccessibility2 Implementation 2009-----
+IMPL_LINK( ComboBox, ImplListItemSelectHdl,  void*, EMPTYARG )
+{
+    ImplCallEventListeners( VCLEVENT_LISTBOX_SELECT );
+	return 1;
+}
+//-----IAccessibility2 Implementation 2009
 // -----------------------------------------------------------------------
 
 IMPL_LINK( ComboBox, ImplCancelHdl, void*, EMPTYARG )
@@ -1420,6 +1435,12 @@
 	return mpImplLB->GetMaxMRUCount();
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_uInt16 ComboBox::GetMRUCount() const
+{
+	return mpImplLB->GetEntryList()->GetMRUCount();
+}
+//-----IAccessibility2 Implementation 2009
 // -----------------------------------------------------------------------
 
 sal_uInt16 ComboBox::GetDisplayLineCount() const
diff --git a/main/vcl/source/control/edit.cxx b/main/vcl/source/control/edit.cxx
index 7cc9e13..98ea1cd 100644
--- a/main/vcl/source/control/edit.cxx
+++ b/main/vcl/source/control/edit.cxx
@@ -2498,8 +2498,10 @@
             return;
 
         // #i13677# notify edit listeners about caret position change
-        ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
-
+//IAccessibility2 Implementation 2009-----
+        //ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
+        ImplCallEventListeners( VCLEVENT_EDIT_CARETCHANGED );
+//-----IAccessibility2 Implementation 2009
         // FIXME: this is currently only on aqua
         // check for other platforms that need similar handling
         if( ImplGetSVData()->maNWFData.mbNoFocusRects &&
@@ -2654,15 +2656,37 @@
 			if ( aNew != maSelection )
 			{
                 ImplClearLayoutData();
+//IAccessibility2 Implementation 2009-----
+				Selection aTemp = maSelection;
+//-----IAccessibility2 Implementation 2009
 				maSelection = aNew;
 
 				if ( bPaint && ( aOld.Len() || aNew.Len() || IsPaintTransparent() ) )
                     ImplInvalidateOrRepaint( 0, maText.Len() );
 				ImplShowCursor();
-				if ( mbIsSubEdit )
-					((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
-				else
-					ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
+//IAccessibility2 Implementation 2009-----
+				sal_Bool bCaret = sal_False, bSelection = sal_False;
+				long nB=aNew.Max(), nA=aNew.Min(),oB=aTemp.Max(), oA=aTemp.Min();
+				long nGap = nB-nA, oGap = oB-oA;
+				if (nB != oB)
+					bCaret = sal_True;
+				if (nGap != 0 || oGap != 0)
+					bSelection = sal_True;
+				if (bCaret)
+				{
+					if ( mbIsSubEdit )
+						((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_EDIT_CARETCHANGED );
+					else
+						ImplCallEventListeners( VCLEVENT_EDIT_CARETCHANGED );
+				}
+				if (bSelection)
+				{
+					if ( mbIsSubEdit )
+						((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
+					else
+						ImplCallEventListeners( VCLEVENT_EDIT_SELECTIONCHANGED );
+				}
+//-----IAccessibility2 Implementation 2009
                 // #103511# notify combobox listeners of deselection
                 if( !maSelection && GetParent() && GetParent()->GetType() == WINDOW_COMBOBOX )
                     ((Edit*)GetParent())->ImplCallEventListeners( VCLEVENT_COMBOBOX_DESELECT );
diff --git a/main/vcl/source/control/ilstbox.cxx b/main/vcl/source/control/ilstbox.cxx
index e0714a6..749f74c 100644
--- a/main/vcl/source/control/ilstbox.cxx
+++ b/main/vcl/source/control/ilstbox.cxx
@@ -917,7 +917,11 @@
 
 				mnCurrentPos = nSelect;
 				mbTrackingSelect = true;
-				SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() );
+				//IAccessibility2 Impplementaton 2009-----
+				sal_Bool bCurPosChange = (mnCurrentPos != nSelect);
+				//SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() );
+				SelectEntries( nSelect, LET_MBDOWN, rMEvt.IsShift(), rMEvt.IsMod1() ,bCurPosChange);
+				//-----IAccessibility2 Impplementaton 2009
 				mbTrackingSelect = false;
 				if ( mbGrabFocus )
 					GrabFocus();
@@ -988,6 +992,14 @@
 			                ImplCallSelect();
 			                mbTravelSelect = false;
                         }
+//IAccessibility2 Implementation 2009----
+						// When list box selection change by mouse move, notity  
+						// VCLEVENT_LISTBOX_SELECT vcl event.
+						else
+						{
+							maListItemSelectHdl.Call(NULL);
+						}
+//----IAccessibility2 Implementation 2009
 		            }
 					mbTrackingSelect = false;
 				}
@@ -1075,7 +1087,7 @@
 
 // -----------------------------------------------------------------------
 
-sal_Bool ImplListBoxWindow::SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift, sal_Bool bCtrl )
+sal_Bool ImplListBoxWindow::SelectEntries( sal_uInt16 nSelect, LB_EVENT_TYPE eLET, sal_Bool bShift, sal_Bool bCtrl, sal_Bool bSelectPosChange /*=FALSE*/ )
 {
 	sal_Bool bFocusChanged = sal_False;
 	sal_Bool bSelectionChanged = sal_False;
@@ -1220,6 +1232,12 @@
             maFocusRect.SetSize( aSz );
 			if( HasFocus() )
 				ImplShowFocusRect();
+//IAccessibility2 Implementation 2009----
+			if (bSelectPosChange)
+			{
+				maFocusHdl.Call(reinterpret_cast<void*>(nSelect));
+			}
+//----IAccessibility2 Implementation 2009
 		}
         ImplClearLayoutData();
 	}
@@ -1682,8 +1700,12 @@
 		DBG_ASSERT( !mpEntryList->IsEntryPosSelected( nSelect ) || mbMulti, "ImplListBox: Selecting same Entry" );
 	    if( nSelect >= mpEntryList->GetEntryCount() )
             nSelect = mpEntryList->GetEntryCount()-1;
+//IAccessibility2 Implementation 2009-----
+		sal_Bool bCurPosChange = (mnCurrentPos != nSelect);
 		mnCurrentPos = nSelect;
-		if ( SelectEntries( nSelect, eLET, bShift, bCtrl ) )
+		//if ( SelectEntries( nSelect, eLET, bShift, bCtrl ) )
+		if(SelectEntries( nSelect, eLET, bShift, bCtrl ,bCurPosChange))
+//-----IAccessibility2 Implementation 2009
 		{
 			mbTravelSelect = true;
 			mnSelectModifier = rKEvt.GetKeyCode().GetModifier();
@@ -2158,7 +2180,10 @@
 {
     const ImplEntryType* pEntry = mpEntryList->GetEntryPtr( nItem );
     Size aSz( GetSizePixel().Width(), pEntry ? pEntry->mnHeight : GetEntryHeight() );
-    long nY = mpEntryList->GetAddedHeight( nItem, GetTopEntry() ) - mpEntryList->GetAddedHeight( GetTopEntry() );
+    //long nY = mpEntryList->GetAddedHeight( nItem, GetTopEntry() ) - mpEntryList->GetAddedHeight( GetTopEntry() );
+	//IAccessibility2 Impplementaton 2009-----
+    long nY = mpEntryList->GetAddedHeight( nItem, GetTopEntry() ) + GetEntryList()->GetMRUCount()*GetEntryHeight();
+	//-----IAccessibility2 Impplementaton 2009
     Rectangle aRect( Point( 0, nY ), aSz );
     return aRect;
 }
diff --git a/main/vcl/source/control/lstbox.cxx b/main/vcl/source/control/lstbox.cxx
index 0f5ea6d..f44c06a 100644
--- a/main/vcl/source/control/lstbox.cxx
+++ b/main/vcl/source/control/lstbox.cxx
@@ -170,6 +170,10 @@
 	mpImplLB->SetCancelHdl( LINK( this, ListBox, ImplCancelHdl ) );
 	mpImplLB->SetDoubleClickHdl( LINK( this, ListBox, ImplDoubleClickHdl ) );
 	mpImplLB->SetUserDrawHdl( LINK( this, ListBox, ImplUserDrawHdl ) );
+//IAccessibility2 Implementation 2009-----
+	mpImplLB->SetFocusHdl( LINK( this, ListBox, ImplFocusHdl ) );
+	mpImplLB->SetListItemSelectHdl( LINK( this, ListBox, ImplListItemSelectHdl ) );
+//-----IAccessibility2 Implementation 2009
 	mpImplLB->SetPosPixel( Point() );
     mpImplLB->SetEdgeBlending(GetEdgeBlending());
 	mpImplLB->Show();
@@ -249,6 +253,18 @@
 
 	return 1;
 }
+//IAccessibility2 Implementation 2009-----
+IMPL_LINK( ListBox, ImplFocusHdl, void *, nPos )
+{
+    ImplCallEventListeners( VCLEVENT_LISTBOX_FOCUS , nPos);
+	return 1;
+}
+IMPL_LINK( ListBox, ImplListItemSelectHdl, void*, EMPTYARG )
+{
+    ImplCallEventListeners( VCLEVENT_LISTBOX_SELECT );
+	return 1;
+}
+//-----IAccessibility2 Implementation 2009
 
 // -----------------------------------------------------------------------
 
@@ -1060,6 +1076,8 @@
 		mpImplWin->SetImage( aImage );
 		mpImplWin->Invalidate();
 	}
+	// IAccessible2 implementation 2009
+	NotifyVCLEvent( VCLEVENT_LISTBOX_STATEUPDATE);
 }
 
 // -----------------------------------------------------------------------
@@ -1204,7 +1222,21 @@
 void ListBox::SelectEntryPos( sal_uInt16 nPos, sal_Bool bSelect )
 {
 	if ( nPos < mpImplLB->GetEntryList()->GetEntryCount() )
+	{
+		// IAccessible2 implementation 2009
+		sal_uInt16 oldSelectCount = GetSelectEntryCount(), newSelectCount = 0, nCurrentPos = mpImplLB->GetCurrentPos();
 		mpImplLB->SelectEntry( nPos + mpImplLB->GetEntryList()->GetMRUCount(), bSelect );
+		newSelectCount = GetSelectEntryCount();
+		if (oldSelectCount == 0 && newSelectCount > 0)
+			NotifyVCLEvent( VCLEVENT_LISTBOX_STATEUPDATE);
+		//Only when bSelect == true, send both Selection & Focus events
+		if (nCurrentPos != nPos && bSelect)
+		{
+			ImplCallEventListeners( VCLEVENT_LISTBOX_SELECT, reinterpret_cast<void*>(nPos));
+			if (HasFocus())
+				ImplCallEventListeners( VCLEVENT_LISTBOX_FOCUS, reinterpret_cast<void*>(nPos));
+		}
+	}
 }
 
 // -----------------------------------------------------------------------
@@ -1605,6 +1637,12 @@
 {
 	return mpImplLB->GetMaxMRUCount();
 }
+//IAccessibility2 Implementation 2009-----
+sal_uInt16 ListBox::GetMRUCount() const
+{
+	return mpImplLB->GetEntryList()->GetMRUCount();
+}
+//-----IAccessibility2 Implementation 2009
 
 // -----------------------------------------------------------------------
 
diff --git a/main/vcl/source/control/morebtn.cxx b/main/vcl/source/control/morebtn.cxx
index 3f8f707..799e08c 100644
--- a/main/vcl/source/control/morebtn.cxx
+++ b/main/vcl/source/control/morebtn.cxx
@@ -155,7 +155,7 @@
 
 	// Hier den Click-Handler rufen, damit vorher die Controls initialisiert
 	// werden koennen
-	PushButton::Click();
+	//PushButton::Click(); // IAccessibility2 Implementation 2009
 
 	// Je nach Status die Fenster updaten
 	if ( mbState )
@@ -197,6 +197,9 @@
 			pWindow = mpMBData->mpItemList->Next();
 		}
 	}
+//IAccessibility2 Implementation 2009-----
+	PushButton::Click();
+//-----IAccessibility2 Implementation 2009
 }
 
 // -----------------------------------------------------------------------
diff --git a/main/vcl/source/control/tabctrl.cxx b/main/vcl/source/control/tabctrl.cxx
index f48df80..6b8bdfb 100644
--- a/main/vcl/source/control/tabctrl.cxx
+++ b/main/vcl/source/control/tabctrl.cxx
@@ -619,6 +619,9 @@
         }
 
         pPage->ActivatePage();
+//IAccessibility2 Implementation 2009-----
+		pPage->Show();
+//-----IAccessibility2 Implementation 2009
 
         if ( pOldPage && pOldPage->HasChildPathFocus() )
         {
@@ -630,7 +633,9 @@
                 GrabFocus();
         }
 
-        pPage->Show();
+//IAccessibility2 Implementation 2009-----
+        // pPage->Show(); 
+//-----IAccessibility2 Implementation 2009
     }
 
     if ( pOldPage )
diff --git a/main/vcl/source/window/btndlg.cxx b/main/vcl/source/window/btndlg.cxx
index 3945b92..bfeaa2b 100644
--- a/main/vcl/source/window/btndlg.cxx
+++ b/main/vcl/source/window/btndlg.cxx
@@ -289,6 +289,15 @@
 	if ( nType == STATE_CHANGE_INITSHOW )
 	{
 		ImplPosControls();
+//IAccessibility2 Implementation 2009-----
+		ImplBtnDlgItem* pItem = mpItemList->First();
+		while ( pItem )
+		{
+			if ( pItem->mpPushButton && pItem->mbOwnButton )
+				pItem->mpPushButton->SetZOrder(0, WINDOW_ZORDER_LAST);
+			pItem = mpItemList->Next();
+		}
+//-----IAccessibility2 Implementation 2009
 
 		// Focus evt. auf den entsprechenden Button setzen
 		if ( mnFocusButtonId != BUTTONDIALOG_BUTTON_NOTFOUND )
diff --git a/main/vcl/source/window/dlgctrl.cxx b/main/vcl/source/window/dlgctrl.cxx
index 6f54de8..82348ba 100644
--- a/main/vcl/source/window/dlgctrl.cxx
+++ b/main/vcl/source/window/dlgctrl.cxx
@@ -835,7 +835,18 @@
                 if ( nStyle & WB_GROUP )
                     break;
 
-                if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
+//IAccessibility2 Implementation 2009-----
+				//Solution:Pure window shouldn't get window after controls such as buttons. 
+                //if ( pWindow->IsVisible() && pWindow->IsEnabled() && pWindow->IsInputEnabled() )
+				if ( pWindow->IsVisible() && pWindow->IsEnabled() && 
+					 pWindow->IsInputEnabled() && ( 
+									pWindow->GetType() != WINDOW_WINDOW &&
+									pWindow->GetType() != WINDOW_SYSWINDOW &&
+									pWindow->GetType() != WINDOW_WORKWINDOW &&
+									pWindow->GetType() != WINDOW_CONTROL
+								   )
+	   )
+//-----IAccessibility2 Implementation 2009
                 {
                     pWindow->ImplControlFocus( GETFOCUS_CURSOR | GETFOCUS_BACKWARD );
                     return sal_True;
diff --git a/main/vcl/source/window/menu.cxx b/main/vcl/source/window/menu.cxx
index db03d56..81d8047 100644
--- a/main/vcl/source/window/menu.cxx
+++ b/main/vcl/source/window/menu.cxx
@@ -1573,6 +1573,36 @@
 {
     return nSelectedId;
 }
+//IAccessibility2 Implementation 2009
+void Menu::SetHightlightItem( sal_uInt16 nHighlightedItem )
+{
+	this->nHighlightedItem = nHighlightedItem;
+}
+sal_uInt16 Menu::GetHighlightItem() const
+{
+	return nHighlightedItem;
+}
+
+
+XubString Menu::GetItemAccKeyStrFromPos(sal_uInt16 nPos) const 
+{
+    MenuItemData* pData = pItemList->GetDataFromPos( nPos );
+	if (pData)
+	{
+		return pData->aAccelKey.GetName();
+	}
+	return XubString();
+}
+
+sal_Bool Menu::IsTemporaryItemFromPos(sal_uInt16 nPos ) const
+{
+    MenuItemData* pData = pItemList->GetDataFromPos( nPos );
+	if (pData)
+	{
+		return pData->bIsTemporary;
+	}
+	return sal_False;
+}
 
 void Menu::SetItemBits( sal_uInt16 nItemId, MenuItemBits nBits )
 {
@@ -3728,7 +3758,12 @@
             String aTmpEntryText( ResId( SV_RESID_STRING_NOSELECTIONPOSSIBLE, *pResMgr ) );
             MenuItemData* pData = pItemList->Insert(
                 0xFFFF, MENUITEM_STRING, 0, aTmpEntryText, Image(), NULL, 0xFFFF );
+//IAccessibility2 Implementation 2009-----
+		sal_uInt16          nmPos;
+		pData = pItemList->GetData( pData->nId, nmPos );
                 pData->bIsTemporary = sal_True;
+		ImplCallEventListeners(VCLEVENT_MENU_SUBMENUCHANGED,nmPos);
+//-----IAccessibility2 Implementation 2009
         }
     }
     else if ( Application::GetSettings().GetStyleSettings().GetAutoMnemonic() && !( nMenuFlags & MENU_FLAG_NOAUTOMNEMONICS ) )
@@ -4005,7 +4040,9 @@
         // otherwise the entry will not be read when the menu is opened again
         if( nHighlightedItem != ITEMPOS_INVALID )
             pMenu->ImplCallEventListeners( VCLEVENT_MENU_DEHIGHLIGHT, nHighlightedItem );
-    
+//IAccessibility2 Implementation 2009-----
+	pMenu->SetHightlightItem(ITEMPOS_INVALID);
+//-----IAccessibility2 Implementation 2009
         if( !bKeyInput && pMenu && pMenu->pStartedFrom && !pMenu->pStartedFrom->bIsMenuBar )
         {
             // #102461# remove highlight in parent
@@ -4676,6 +4713,9 @@
             }
         }
         HighlightItem( nHighlightedItem, sal_True );
+//IAccessibility2 Implementation 2009-----
+	pMenu->SetHightlightItem(nHighlightedItem);
+//-----IAccessibility2 Implementation 2009
         pMenu->ImplCallHighlight( nHighlightedItem );
     }
     else
@@ -4977,6 +5017,10 @@
                     MenuFloatingWindow* pFloat = ((PopupMenu*)pMenu->pStartedFrom)->ImplGetFloatingWindow();
                     pFloat->GrabFocus();
                     pFloat->KillActivePopup();
+//IAccessibility2 Implementation 2009-----
+  		    sal_uInt16 highlightItem = pFloat->GetHighlightedItem();
+		    pFloat->ChangeHighlightItem(highlightItem, sal_False);
+//-----IAccessibility2 Implementation 2009
                 }
             }
         }
@@ -5566,6 +5610,9 @@
     nHighlightedItem = (sal_uInt16)n;
     DBG_ASSERT( ( nHighlightedItem == ITEMPOS_INVALID ) || pMenu->ImplIsVisible( nHighlightedItem ), "ChangeHighlightItem: Not visible!" );
     HighlightItem( nHighlightedItem, sal_True );
+//IAccessibility2 Implementation 2009-----
+    pMenu->SetHightlightItem(nHighlightedItem);
+//-----IAccessibility2 Implementation 2009
     pMenu->ImplCallHighlight( nHighlightedItem );
 
     if( mbAutoPopup )
diff --git a/main/vcl/source/window/toolbox.cxx b/main/vcl/source/window/toolbox.cxx
index eb3807c..f960996 100644
--- a/main/vcl/source/window/toolbox.cxx
+++ b/main/vcl/source/window/toolbox.cxx
@@ -6065,6 +6065,11 @@
                 mnCurPos = aPos;
             ImplShowFocus();
 
+//IAccessibility2 Implementation 2009-----
+			if( pItem->mpWindow )
+				pItem->mpWindow->GrabFocus();
+			if( pItem != pOldItem )
+//-----IAccessibility2 Implementation 2009
             ImplCallEventListeners( VCLEVENT_TOOLBOX_HIGHLIGHT );
 		}
 	}
diff --git a/main/vcl/source/window/toolbox2.cxx b/main/vcl/source/window/toolbox2.cxx
index d200de5..68d77b7 100644
--- a/main/vcl/source/window/toolbox2.cxx
+++ b/main/vcl/source/window/toolbox2.cxx
@@ -1737,7 +1737,11 @@
             ImplCallEventListeners( VCLEVENT_TOOLBOX_BUTTONSTATECHANGED, reinterpret_cast< void* >( nPos ) );
 
             // Notify
-		    ImplCallEventListeners( VCLEVENT_TOOLBOX_CLICK, reinterpret_cast< void* >( nPos ) );
+//IAccessibility2 Implementation 2009-----
+		    //Solution:Call accessivle listener to notify state_changed event
+		    ImplCallEventListeners( VCLEVENT_TOOLBOX_ITEMUPDATED,reinterpret_cast< void* >(nPos) );
+		    //ImplCallEventListeners( VCLEVENT_TOOLBOX_CLICK, reinterpret_cast< void* >( nPos ) );
+//-----IAccessibility2 Implementation 2009
 		}
 	}
 }
diff --git a/main/vcl/source/window/window.cxx b/main/vcl/source/window/window.cxx
index cf45c0a..294c22b 100644
--- a/main/vcl/source/window/window.cxx
+++ b/main/vcl/source/window/window.cxx
@@ -5397,6 +5397,15 @@
     return nRet;
 }
 
+// IAccessible2 implementation, 2009
+void Window::NotifyVCLEvent( sal_uLong nEvent ,void* pData /*= NULL*/)
+{
+	ImplCallEventListeners( nEvent ,pData);
+}
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > > Window::GetAccFlowToSequence()
+{
+	return ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >();
+}
 // -----------------------------------------------------------------------
 
 void Window::ImplCallEventListeners( sal_uLong nEvent, void* pData )
@@ -9097,10 +9106,11 @@
             case WINDOW_CANCELBUTTON:
             case WINDOW_HELPBUTTON:
             case WINDOW_IMAGEBUTTON:
-            case WINDOW_MENUBUTTON:
+            //case WINDOW_MENUBUTTON:
             case WINDOW_MOREBUTTON:
             case WINDOW_SPINBUTTON:
             case WINDOW_BUTTON: nRole = accessibility::AccessibleRole::PUSH_BUTTON; break;
+            case WINDOW_MENUBUTTON: nRole = accessibility::AccessibleRole::BUTTON_MENU; break;
 
             case WINDOW_PATHDIALOG: nRole = accessibility::AccessibleRole::DIRECTORY_PANE; break;
             case WINDOW_FILEDIALOG: nRole = accessibility::AccessibleRole::FILE_CHOOSER; break;
@@ -9115,10 +9125,15 @@
             case WINDOW_MULTILINEEDIT: nRole = accessibility::AccessibleRole::SCROLL_PANE; break;
 
             case WINDOW_PATTERNFIELD:
+//IAccessibility2 Impplementaton 2009-----
+            // Need to set the role of those window control to spinbox
+            /*
             case WINDOW_NUMERICFIELD:
             case WINDOW_METRICFIELD:
             case WINDOW_CURRENCYFIELD:
             case WINDOW_LONGCURRENCYFIELD:
+            */
+//-----IAccessibility2 Impplementaton 2009
             case WINDOW_EDIT: nRole = ( GetStyle() & WB_PASSWORD ) ? (accessibility::AccessibleRole::PASSWORD_TEXT) : (accessibility::AccessibleRole::TEXT); break;
 
             case WINDOW_PATTERNBOX:
@@ -9135,7 +9150,17 @@
 
             case WINDOW_FIXEDTEXT: nRole = accessibility::AccessibleRole::LABEL; break;
             case WINDOW_FIXEDBORDER:
-            case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
+				nRole = accessibility::AccessibleRole::SEPARATOR; break;
+	    //IAccessibility2 Impplementaton 2009-----
+            case WINDOW_FIXEDLINE: 
+				{	if( GetText().Len() > 0 )
+						nRole = accessibility::AccessibleRole::LABEL; 
+					else
+						nRole = accessibility::AccessibleRole::SEPARATOR; 
+					break;
+				}
+            //case WINDOW_FIXEDLINE: nRole = accessibility::AccessibleRole::SEPARATOR; break;
+	    //-----IAccessibility2 Impplementaton 2009
             case WINDOW_FIXEDBITMAP:
             case WINDOW_FIXEDIMAGE: nRole = accessibility::AccessibleRole::ICON; break;
             case WINDOW_GROUPBOX: nRole = accessibility::AccessibleRole::GROUP_BOX; break;
@@ -9150,6 +9175,13 @@
             case WINDOW_DATEFIELD:
             case WINDOW_TIMEFIELD: nRole = accessibility::AccessibleRole::DATE_EDITOR; break;
 
+//IAccessibility2 Impplementaton 2009-----
+            // Need to set the role of those window control to spinbox
+            case WINDOW_NUMERICFIELD:
+            case WINDOW_METRICFIELD:
+            case WINDOW_CURRENCYFIELD:
+            case WINDOW_LONGCURRENCYFIELD:
+//-----IAccessibility2 Impplementaton 2009
             case WINDOW_SPINFIELD: nRole = accessibility::AccessibleRole::SPIN_BOX; break;
 
             case WINDOW_TOOLBOX: nRole = accessibility::AccessibleRole::TOOL_BAR; break;
@@ -9201,8 +9233,12 @@
    if ( !mpWindowImpl->mpAccessibleInfos )
         mpWindowImpl->mpAccessibleInfos = new ImplAccessibleInfos;
 
+//IAccessibility2 Implementation 2009-----
+	String oldName = GetAccessibleName();
     delete mpWindowImpl->mpAccessibleInfos->pAccessibleName;
     mpWindowImpl->mpAccessibleInfos->pAccessibleName = new String( rName );
+    ImplCallEventListeners( VCLEVENT_WINDOW_FRAMETITLECHANGED, &oldName );	
+//-----IAccessibility2 Implementation 2009
 }
 
 String Window::GetAccessibleName() const
@@ -9247,6 +9283,12 @@
                 if ( pLabel && pLabel != this )
                     aAccessibleName = pLabel->GetText();
             }
+		//IAccessibility2 Implementation 2009-----
+		if ( !aAccessibleName.Len() )
+	        {
+	            aAccessibleName = GetQuickHelpText();
+	        }
+		//-----IAccessibility2 Implementation 2009
             break;
 
             case WINDOW_IMAGEBUTTON:
@@ -9260,6 +9302,16 @@
                 }
             break;
 
+//IAccessibility2 Implementation 2009-----
+			case WINDOW_TOOLBOX:
+				aAccessibleName = GetText();
+				if( aAccessibleName.Len() == 0 )
+					aAccessibleName =XubString( RTL_CONSTASCII_USTRINGPARAM( "Tool Bar"  ) );
+				break;
+			case WINDOW_MOREBUTTON:
+				aAccessibleName = mpWindowImpl->maText;
+				break;
+//-----IAccessibility2 Implementation 2009
             default:
                 aAccessibleName = GetText();
                 break;
diff --git a/main/vcl/win/source/window/salframe.cxx b/main/vcl/win/source/window/salframe.cxx
index 08cbf36..a33db48 100644
--- a/main/vcl/win/source/window/salframe.cxx
+++ b/main/vcl/win/source/window/salframe.cxx
@@ -92,6 +92,16 @@
 using ::std::max;
 #endif
 
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+#include <oleacc.h>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+#ifndef _WIN32_WCE
+#define WM_GETOBJECT                    0x003D
+#endif
+#include <win/g_msaasvc.h>
+#endif
+//-----IAccessibility2 Implementation 2009
 #include <com/sun/star/uno/Exception.hdl>
 
 #include <time.h>
@@ -153,7 +163,12 @@
 #define Uni_SupplementaryPlanesStart    0x10000
 
 // =======================================================================
-
+//IAccessibility2 Implementation 2009-----
+#ifdef WNT
+using namespace ::com::sun::star::accessibility;
+XMSAAService* g_acc_manager1 = NULL;
+#endif
+//-----IAccessibility2 Implementation 2009
 static void UpdateFrameGeometry( HWND hWnd, WinSalFrame* pFrame );
 static void SetMaximizedFrameGeometry( HWND hWnd, WinSalFrame* pFrame, RECT* pParentRect = NULL );
 
@@ -6178,6 +6193,62 @@
         case WM_IME_NOTIFY:
             ImplHandleIMENotify( hWnd, wParam );
             break;
+
+//IAccessibility2 implementation 2009-----
+#ifdef WNT
+		case WM_GETOBJECT:
+			{
+				if (!Application::IsEnableAccessInterface())
+				{
+					break;
+				}
+				else
+				{
+					// IA2 should be enabled automatically
+					AllSettings aSettings = Application::GetSettings();
+					MiscSettings aMisc = aSettings.GetMiscSettings();
+					aMisc.SetEnableATToolSupport( sal_True );
+					aSettings.SetMiscSettings( aMisc );
+					Application::SetSettings( aSettings );
+
+					if (Application::GetSettings().GetMiscSettings().GetEnableATToolSupport())
+					{
+						// Make sure to launch Accessibiliity only the following criterias are satisfied to avoid RFT interrupts regular acc processing
+						if (g_acc_manager1 == NULL)
+						{
+							sal_Bool bCancelled;
+							InitAccessBridge(sal_False,bCancelled);
+							if( bCancelled )
+								break;
+						}
+						if (g_acc_manager1 != NULL)
+						{
+							// MT: mhOnSetTitleWnd not set to reasonable value anywhere...
+							/*
+							sal_Bool bSkipSetTitleClient = sal_False;
+							SalFrame* pFrame = GetWindowPtr( hWnd );
+							if(pFrame)
+							{
+							bSkipSetTitleClient = (lParam == OBJID_CLIENT && hWnd == ((WinSalFrame*)pFrame)->mhOnSetTitleWnd);
+							}
+							*/
+							if ( (lParam == OBJID_CLIENT ) /* && !bSkipSetTitleClient */ )
+							{
+								long RetResult = g_acc_manager1->getAccObjectPtr((long)hWnd, lParam, wParam);
+								if(RetResult != 0)
+								{
+									rDef = FALSE;					
+									return (HRESULT)RetResult;
+								}
+							}
+						}
+					}
+				}
+				break;
+			}
+#endif			
+//-----IAccessibility2 implementation 2009
+
         case WM_APPCOMMAND:
             if( ImplHandleAppCommand( hWnd, lParam ) )
             {                
@@ -6398,3 +6469,25 @@
 
 // -----------------------------------------------------------------------
 
+//IAccessibility2 implementation 2009-----
+#ifdef WNT
+bool IsWNTInitAccessBridge()
+{
+	return NULL != g_acc_manager1;
+}
+#endif
+#ifdef WNT
+bool WNTEnableAccessInterface(bool bEnable)
+{
+    ImplSVData* pSVData = ImplGetSVData();
+
+	BOOL bPreVal = pSVData->maAppData.m_bEnableAccessInterface; 
+	long nEnable= bEnable;
+	::InterlockedExchange(
+		(LPLONG)&(pSVData->maAppData.m_bEnableAccessInterface),
+		nEnable);
+	
+	return bPreVal;
+}
+#endif
+//-----IAccessibility2 implementation 2009
diff --git a/main/winaccessibility/inc/AccComponentEventListener.hxx b/main/winaccessibility/inc/AccComponentEventListener.hxx
new file mode 100644
index 0000000..6eb81d7
--- /dev/null
+++ b/main/winaccessibility/inc/AccComponentEventListener.hxx
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCCOMPONENTEVENTLISTENER_HXX
+#define __ACCCOMPONENTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+/**
+ * AccComponentEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by component controls. The accessible roles are: CHECK_BOX, ICON, LABEL, 
+ * MENU_ITEM, PUSH_BUTTON, RADIO_BUTTON, SCROLL_BAR, SEPARATOR, TOGGLE_BUTTON, TOOL_TIP, SPIN_BOX. 
+ * It defines the procedure of specific event handling related with components and provides 
+ * the detailed support for some related methods. 
+ */
+class AccComponentEventListener: public AccEventListener
+{
+private:
+    static FILE *output, *output2, *output3, *outacc;//used for debugging
+public:
+    AccComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccComponentEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for value changed event
+    virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+
+    //for action changed event
+    virtual void SAL_CALL handleActionChangedEvent();
+
+    //for text changed event
+    virtual void SAL_CALL handleTextChangedEvent(Any oldValue, Any newValue);
+
+    //for caret changed event
+    virtual void SAL_CALL handleCaretChangedEvent(Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+    virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+                                                     );
+    virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+    void handleSelectionChangedEvent();
+
+    //add TEXT_SELECTION_CHANGED event
+    void handleTextSelectionChangedEvent();
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccContainerEventListener.hxx b/main/winaccessibility/inc/AccContainerEventListener.hxx
new file mode 100644
index 0000000..cc4353d
--- /dev/null
+++ b/main/winaccessibility/inc/AccContainerEventListener.hxx
@@ -0,0 +1,98 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCCONTAINEREVENTLISTENERHXX
+#define __ACCCONTAINEREVENTLISTENERHXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccContainerEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by container controls. The accessible roles are: CANVAS, COMBO_BOX, DOCUMENT, 
+ * EMBEDDED_OBJECT, END_NOTE, FILLER, FOOTNOTE, FOOTER, GRAPHIC, HEADER, LAYERED_PANE, 
+ * MENU_BAR, POPUP_MENU, OPTION_PANE, PAGE_TAB, PAGE_TAB_LIST, PANEL, SCROLL_PANE, SPLIT_PANE, 
+ * STATUS_BAR, TABLE_CELL, TEXT_FRAME, TOOL_BAR, VIEW_PORT.
+ * It defines the procedure of specific event handling related with containsers and provides 
+ * the detailed support for some related methods.  
+ */
+class AccContainerEventListener: public AccEventListener
+{
+public:
+    AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccContainerEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent(Any oldValue, Any newValue);
+
+    //for selection changed event
+    virtual void SAL_CALL handleSelectionChangedEvent(const Any &oldValue, const Any &newValue);
+
+    //for all children changed event
+    virtual void SAL_CALL handleAllChildrenChangedEvent();
+
+    //for text changed event
+    virtual void SAL_CALL handleTextChangedEvent(Any oldValue, Any newValue);
+    virtual void SAL_CALL handleStateChangedEvent(Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    //for value changed event
+    virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+
+    //state changed
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+    virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+                                                     );
+    virtual void SAL_CALL fireStateFocusdChange(bool enable);
+    virtual bool SAL_CALL IsEditable(Reference<com::sun::star::accessibility::XAccessibleContext> xContext);
+
+    // update all children's state
+    void SAL_CALL UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible );
+
+    bool NotifyChildEvent(short nWinEvent,const Any &Value);
+
+    virtual void handleSelectionChangedAddEvent(const Any &oldValue, const Any &newValue);
+    virtual void handleSelectionChangedRemoveEvent(const Any &oldValue, const Any &newValue);
+    virtual void handleSelectionChangedWithinEvent(const Any &oldValue, const Any &newValue);
+
+    virtual void handlePageChangedEvent (const Any &oldValue, const Any &newValue);
+
+    virtual void handleSectionChangedEvent (const Any &oldValue, const Any &newValue);
+    virtual void handleColumnChangedEvent (const Any &oldValue, const Any &newValue);
+	//IAccessibility2 Implementation 2009-----
+	//for name changed event
+    virtual void SAL_CALL handleNameChangedEvent(Any name);
+	//-----IAccessibility2 Implementation 2009
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx b/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx
new file mode 100644
index 0000000..eb1e393
--- /dev/null
+++ b/main/winaccessibility/inc/AccDescendantManagerEventListener.hxx
@@ -0,0 +1,64 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCDESCENDANTMANAGEREVENTLISTENER_HXX
+#define __ACCDESCENDANTMANAGEREVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccDescendantManagerEventListener is inherited from AccComponentEventListener. It handles 
+ * the evnets generated by active descendant controls. They are: TREE, LIST, and TABLE. 
+ * It defines the procedure of specific event handling related with active descendant components 
+ * and provides the detailed support for some related methods. 
+ */
+class AccDescendantManagerEventListener: public AccComponentEventListener
+{
+protected:
+    ::com::sun::star::accessibility::XAccessible* pActiveDescendant;
+public:
+    AccDescendantManagerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccDescendantManagerEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for selection changed event
+    virtual void SAL_CALL handleSelectionChangedEvent(Any oldValue, Any newValue);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+    virtual void SAL_CALL handleChildChangedNoFocusEvent(Any oldValue, Any newValue);
+
+    bool NotifyChildEvent(short nWinEvent,const Any &Value);
+
+    virtual void handleSelectionChangedAddEvent(const Any &oldValue, const Any &newValue);
+    virtual void handleSelectionChangedRemoveEvent(const Any &oldValue, const Any &newValue);
+    virtual void handleSelectionChangedWithinEvent(const Any &oldValue, const Any &newValue);
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccDialogEventListener.hxx b/main/winaccessibility/inc/AccDialogEventListener.hxx
new file mode 100644
index 0000000..4d59552
--- /dev/null
+++ b/main/winaccessibility/inc/AccDialogEventListener.hxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCDIALOGEVENTLISTENER_HXX
+#define __ACCDIALOGEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccDialogEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by Dialogs. The accessible role is: DIALOG.
+ * It defines the procedure of specific event handling related with dialogs and provides 
+ * the detailed support for some related methods.  
+ */
+class AccDialogEventListener: public AccEventListener
+{
+public:
+    AccDialogEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccDialogEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    //state changed
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+    //virtual void SAL_CALL fireStatePropertyChange(short state, bool set);
+    //virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccEventListener.hxx b/main/winaccessibility/inc/AccEventListener.hxx
new file mode 100644
index 0000000..3ceb62e
--- /dev/null
+++ b/main/winaccessibility/inc/AccEventListener.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCEVENTLISTENER_HXX
+#define __ACCEVENTLISTENER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <cppuhelper/weak.hxx>
+#include <vos/mutex.hxx>
+
+class AccObjectManagerAgent;
+using namespace ::com::sun::star::uno;
+/**
+ * AccEventListener is the general event listener for all controls. It defines the
+ * procedure of all the event handling and provides the basic support for some simple
+ * methods. 
+ */
+class AccEventListener:
+            public com::sun::star::accessibility::XAccessibleEventListener,
+            public ::cppu::OWeakObject
+{
+private:
+    oslInterlockedCount m_refcount;
+protected:
+    //accessible owner's pointer
+    com::sun::star::accessibility::XAccessible* pAccessible;
+    //agent pointer for objects' manager
+    AccObjectManagerAgent* pAgent;
+    //disposed state indicator
+    bool  m_isDisposed;
+    mutable ::vos::OMutex aRemoveMutex;
+public:
+    AccEventListener( com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for name changed event
+    virtual void SAL_CALL handleNameChangedEvent(Any name);
+
+    //for description changed event
+    virtual void SAL_CALL handleDescriptionChangedEvent(Any desc);
+
+    //for state changed event
+    virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+    virtual void SAL_CALL fireStatePropertyChange(short state, bool set
+                                                     );
+    virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for interface
+    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL acquire() throw ();
+    virtual void SAL_CALL release() throw ();
+    //get the accessible role of pAccessible
+    virtual short SAL_CALL getRole();
+    //get the accessible parent's role
+    virtual short SAL_CALL getParentRole();
+public:
+    void removeMeFromBroadcaster();
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccFrameEventListener.hxx b/main/winaccessibility/inc/AccFrameEventListener.hxx
new file mode 100644
index 0000000..72aac97
--- /dev/null
+++ b/main/winaccessibility/inc/AccFrameEventListener.hxx
@@ -0,0 +1,63 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCFRAMEEVENTLISTENER_HXX
+#define __ACCFRAMEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccFrameEventListener is inherited from AccEventListener. It handles the evnets
+ * generated by Dialogs. The accessible roles are: FRAME and ROOT_PANE.
+ * It defines the procedure of specific event handling related with frames and provides 
+ * the detailed support for some related methods.  
+ */
+class AccFrameEventListener: public AccEventListener
+{
+public:
+    AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccFrameEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent(Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    //state changed
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+    //virtual void SAL_CALL fireStatePropertyChange(short state, bool set);
+    //virtual void SAL_CALL fireStateFocusdChange(bool enable);
+
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccListEventListener.hxx b/main/winaccessibility/inc/AccListEventListener.hxx
new file mode 100644
index 0000000..fe73b64
--- /dev/null
+++ b/main/winaccessibility/inc/AccListEventListener.hxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCLISTEVENTLISTENER_HXX
+#define __ACCLISTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccListEventListener is inherited from AccDescendantManagerEventListener. It handles 
+ * the evnets generated by tree controls. The accessible role is: LIST.
+ * It defines the procedure of specific event handling related with list components 
+ * and provides the detailed support for some related methods. 
+ */
+class AccListEventListener: public AccDescendantManagerEventListener
+{
+private:
+    bool shouldDeleteChild;
+public:
+    AccListEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccListEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+    //for active descendant changed event
+    virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+    //for value changed event
+    virtual void SAL_CALL handleValueChangedEvent(Any oldValue, Any newValue);
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccMenuEventListener.hxx b/main/winaccessibility/inc/AccMenuEventListener.hxx
new file mode 100644
index 0000000..ca91857
--- /dev/null
+++ b/main/winaccessibility/inc/AccMenuEventListener.hxx
@@ -0,0 +1,57 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCMENUEVENTLISTENER_HXX
+#define __ACCMENUEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccMenuEventListener is inherited from AccComponentEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: MENU
+ * It defines the procedure of specific event handling related with menus and provides 
+ * the detailed support for some related methods.  
+ */
+class AccMenuEventListener: public AccComponentEventListener
+{
+public:
+    AccMenuEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccMenuEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+    //for selection changed event
+    virtual void SAL_CALL handleSelectionChangedEvent();
+
+    //for state changed event
+    virtual void SAL_CALL fireStatePropertyChange(short state, bool set );
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccObject.hxx b/main/winaccessibility/inc/AccObject.hxx
new file mode 100644
index 0000000..d56f96a
--- /dev/null
+++ b/main/winaccessibility/inc/AccObject.hxx
@@ -0,0 +1,130 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef __ACCOBJECT_HXX
+#define __ACCOBJECT_HXX
+
+#include <vector>
+#include <map>
+#include <oleacc.h>
+#include <windows.h>
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+
+#include "accHelper.hxx"
+#include  "UAccCOM.h"
+
+class AccEventListener;
+class AccObjectManagerAgent;
+class AccObject;
+
+typedef std::map< const long, AccObject*,ltstr4 > IAccSelectionList;
+typedef std::vector<AccObject *> IAccChildList;
+
+
+class AccObject
+{
+private:
+
+    short				m_accRole;
+    long				m_resID;
+    HWND				m_pParantID;
+    sal_Bool				m_bShouldDestroy; //avoid access COM interface when acc object is deleted
+    IMAccessible*		m_pIMAcc;
+    AccObject*			m_pParentObj;
+    IAccChildList		m_childrenList;
+    AccEventListener*	m_accListener;
+    IAccSelectionList	m_selectionList;
+
+    ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > m_xAccRef;
+    ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleAction > m_xAccActionRef;
+    ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > m_xAccContextRef;
+
+    sal_Bool ImplInitilizeCreateObj();//create COM object
+
+    void UpdateActionDesc();
+    void UpdateRole();
+
+    DWORD GetMSAAStateFromUNO(short xState);//translate state from UNO to MSAA value
+    ::com::sun::star::accessibility::XAccessibleSelection* GetXAccessibleSelection();
+    void GetExpandedState(sal_Bool* isExpandable, sal_Bool* isExpanded);
+    ::rtl::OUString GetMAccessibleValueFromAny(::com::sun::star::uno::Any pAny);
+
+public:
+
+    AccObject ( ::com::sun::star::accessibility::XAccessible* pXAcc = NULL,AccObjectManagerAgent* pAgent = NULL ,AccEventListener* accListener=NULL);
+    virtual ~AccObject();
+
+    sal_Bool UpdateAccessibleInfoFromUnoToMSAA(  ); //implement accessible information mapping
+    void UpdateDefaultAction();
+
+    IMAccessible*  GetIMAccessible();	//return COM interface in acc object
+    ::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible > GetXAccessible();
+
+    void SetResID(long id);//ResID means ChildID in MSAA
+    long GetResID();
+
+
+    void SetParentHWND(HWND hWnd);//need to set top window handle when send event to AT
+    HWND GetParentHWND();
+
+    void SetListener( AccEventListener* Listener );
+    AccEventListener* getListener();
+
+    void SetParentObj(AccObject* pParentAccObj);
+    AccObject* GetParentObj();
+
+    void InsertChild( AccObject* pChild,short pos = LAST_CHILD);
+    void DeleteChild( AccObject* pChild );
+    AccObject* NextChild();
+
+    void NotifyDestroy(sal_Bool ifDelete);
+    sal_Bool  ifShouldDestroy();
+
+    void  DecreaseState(short xState );//call COM interface DecreaseState method
+    void  IncreaseState( short xState );//call COM interface IncreaseState method
+
+    void  SetName( com::sun::star::uno::Any newName);
+    void  SetValue( com::sun::star::uno::Any pAny );
+    void  SetDescription( com::sun::star::uno::Any newDesc );
+    void  SetRole( short Role );
+
+    short GetRole() const;
+
+    void  UpdateState();
+    void  UpdateName();
+    void  UpdateValue();
+    void  UpdateAction();
+    void  UpdateDescription();
+    void  UpdateValidWindow();
+    void  UpdateLocation();
+
+    void  setFocus();
+    void  unsetFocus();
+
+    void  AddSelect(long index, AccObject* accObj);
+    IAccSelectionList& GetSelection();
+    void  setLocalizedResourceString();
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccObjectContainerEventListener.hxx b/main/winaccessibility/inc/AccObjectContainerEventListener.hxx
new file mode 100644
index 0000000..4b9565a
--- /dev/null
+++ b/main/winaccessibility/inc/AccObjectContainerEventListener.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef _ACCOBJECTCONTAINEREVENTLISTENER_HXX
+#define _ACCOBJECTCONTAINEREVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccContainerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccObjectContainerEventListener is inherited from AccContainerEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: SHAPE
+ * It defines the procedure of specific event handling related with shapes and provides 
+ * the detailed support for some related methods.  
+ */
+class AccObjectContainerEventListener: public AccContainerEventListener
+{
+public:
+    AccObjectContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccObjectContainerEventListener();
+
+    //overwrite handleStateChangedEvent()
+    virtual void SAL_CALL handleStateChangedEvent (Any oldValue, Any newValue);
+    //for visible data changed event, for shapes, the visiabledatachanged should be mapped to LOCATION_CHANGED
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccObjectManagerAgent.hxx b/main/winaccessibility/inc/AccObjectManagerAgent.hxx
new file mode 100644
index 0000000..0a9741e
--- /dev/null
+++ b/main/winaccessibility/inc/AccObjectManagerAgent.hxx
@@ -0,0 +1,102 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+
+#ifndef __ACCOBJECTMANAGERAGENT_HXX
+#define __ACCOBJECTMANAGERAGENT_HXX

+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+
+struct IMAccessible;
+struct IAccessible;
+class AccObjectWinManager;
+
+/****************************************************************
+AccObjectMangerAgent is used for manaing AccObjects,which encapsulates
+platform differences,and call AccObjectWinManager for Windows platform. To do for
+Linux platform
+*****************************************************************/
+class AccObjectManagerAgent
+{
+private:
+
+    AccObjectWinManager* pWinManager;
+
+public:
+
+    AccObjectManagerAgent();
+    virtual ~AccObjectManagerAgent();
+
+    virtual unsigned char InsertAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+                                        com::sun::star::accessibility::XAccessible* pParentXAcc,
+                                        long pWnd=0);
+    virtual void GetIAccessibleFromResID(long childID,IMAccessible**);
+    virtual unsigned char GetIAccessibleFromXAccessible(com::sun::star::accessibility::XAccessible* pXAcc, IAccessible** ppIA);
+
+    virtual void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+    virtual IMAccessible*  GetIMAccByXAcc(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    unsigned char NotifyAccEvent( short pEvent = 0, com::sun::star::accessibility::XAccessible* pXAcc = 0 );
+
+    unsigned char InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+                                        long pWnd=0);
+    void DeleteChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  DecreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+    void  IncreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+    void  UpdateState( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  UpdateLocation( com::sun::star::accessibility::XAccessible* pXAcc,
+                          long Top = 0,long left = 0,long width = 0,long height = 0 );
+    void  UpdateAction( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc );
+    void  UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any );
+
+    void  UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc,	com::sun::star::uno::Any newName);
+    void  UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc);
+
+    void  UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc,	com::sun::star::uno::Any newDesc );
+    void  UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void NotifyDestroy(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    com::sun::star::accessibility::XAccessible* GetParentXAccessible(
+        com::sun::star::accessibility::XAccessible* pXAcc );
+    short GetParentRole(com::sun::star::accessibility::XAccessible* pXAcc );
+    unsigned short IsContainer(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    void SaveTopWindowHandle(long hWnd, com::sun::star::accessibility::XAccessible* pXAcc);
+
+    void UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    short GetRole(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    com::sun::star::accessibility::XAccessible* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible* pXAcc );
+    bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc);
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccObjectWinManager.hxx b/main/winaccessibility/inc/AccObjectWinManager.hxx
new file mode 100644
index 0000000..3ae13c7
--- /dev/null
+++ b/main/winaccessibility/inc/AccObjectWinManager.hxx
@@ -0,0 +1,177 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef __ACCOBJECTWINMANAGER_HXX
+#define __ACCOBJECTWINMANAGER_HXX
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLE_HPP_
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#endif
+#include <map>
+#include <windows.h>
+#include <vos/mutex.hxx>
+#include <vcl/dllapi.h>
+#include "ResIDGenerator.hxx"
+#include "UAccCOM2.h"
+
+class ResIDGenerator;
+class AccObjectManagerAgent;
+class AccEventListener;
+class AccObject;
+
+/*******************************************************************
+AccObjectWinManager complete the functions:
+1. Insert, delete,query,update Acc objects
+2. Create, delete,fire AccEventLister, the lifecycle of AccEventListener is as same as 
+   Acc Object
+ 3.Return COM interface for AT,by the call back in salframe
+ 4.Pass accessible information to Acc objects
+ *******************************************************************/
+class AccObjectWinManager
+{
+    friend class AccObjectManagerAgent;
+
+private:
+    struct ltstr1
+    {
+        bool operator()(const void*  s1, const void*  s2) const
+        {
+            return long(s1)<long(s2);
+        }
+    };
+    struct ltstr2
+    {
+        bool operator()(const HWND  s1, const HWND  s2) const
+        {
+            return long(s1)<long(s2);
+        }
+    };
+    struct ltstr3
+    {
+        bool operator()(const long  s1, const long  s2) const
+        {
+            return long(s1)<long(s2);
+        }
+    };
+    typedef std::map< void*, AccObject,ltstr1 > XIdToAccObjHash;
+    typedef std::map< HWND,void*,ltstr2 > XHWNDToXAccHash;
+    typedef std::map< const long, AccObject*,ltstr3 > XResIdToAccObjHash;
+
+    typedef std::map< const long, com::sun::star::accessibility::XAccessible*,ltstr3 > XHWNDToDocumentHash;
+
+
+    //XAccessible to AccObject
+    XIdToAccObjHash  XIdAccList;
+
+    //HWND to All XAccessible pointer
+    XHWNDToXAccHash  HwndXAcc;
+
+    //id_Child to AccObject
+    XResIdToAccObjHash XResIdAccList;
+
+    //for file name support
+    XHWNDToDocumentHash XHWNDDocList;
+
+    com::sun::star::accessibility::XAccessible* oldFocus;
+
+    AccObjectManagerAgent*	 pAgent;
+    static AccObjectWinManager* me;
+    ResIDGenerator ResIdGen;
+    mutable ::vos::OMutex aDeleteMutex;
+    mutable ::vos::OMutex aNotifyMutex;
+    mutable ::vos::OMutex maATInterfaceMutex;
+
+    AccObjectWinManager(AccObjectManagerAgent* Agent=NULL);
+
+private:
+    long ImpleGenerateResID();
+    AccObject* GetAccObjByXAcc( com::sun::star::accessibility::XAccessible* pXAcc);
+
+    com::sun::star::accessibility::XAccessible* GetXAccByAccObj(AccObject* pAccObj);
+
+    AccObject* GetTopWindowAccObj(HWND hWnd);
+
+    com::sun::star::accessibility::XAccessible* GetAccDocByHWND( long pWnd );
+
+    void       DeleteAccListener( AccObject* pAccObj );
+    void       InsertAccChildNode(AccObject* pCurObj,AccObject* pParentObj,HWND pWnd);
+    void       DeleteAccChildNode(AccObject* pChild);
+    void       DeleteFromHwndXAcc(com::sun::star::accessibility::XAccessible* pXAcc );
+    int  UpdateAccSelection(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    AccEventListener* createAccEventListener(com::sun::star::accessibility::XAccessible* pXAcc, AccObjectManagerAgent* Agent);
+public:
+    virtual ~AccObjectWinManager();
+    sal_Bool InsertAccObj( com::sun::star::accessibility::XAccessible* pXAcc,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWnd);
+    sal_Bool InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,HWND pWnd=0);
+    void DeleteAccObj( com::sun::star::accessibility::XAccessible* pXAcc );
+    void DeleteChildrenAccObj(com::sun::star::accessibility::XAccessible* pAccObj);
+
+    static  AccObjectWinManager* CreateAccObjectWinManagerInstance(AccObjectManagerAgent* Agent);
+
+    sal_Bool NotifyAccEvent( com::sun::star::accessibility::XAccessible* pXAcc,short state = 0 );
+
+    long Get_ToATInterface( HWND hWnd, long lParam, long wParam);
+
+    void  DecreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+    void  IncreaseState( com::sun::star::accessibility::XAccessible* pXAcc,unsigned short pState );
+    void  UpdateState( com::sun::star::accessibility::XAccessible* pXAcc );
+    void  SetLocation( com::sun::star::accessibility::XAccessible* pXAcc,
+                       long Top = 0,long left = 0,long width = 0,long height = 0);
+
+    void  SetValue( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any pAny );
+    void  UpdateValue( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  SetAccName( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newName);
+    void  UpdateAccName( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  SetDescription( com::sun::star::accessibility::XAccessible* pXAcc, com::sun::star::uno::Any newDesc );
+    void UpdateDescription( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void  SetRole( com::sun::star::accessibility::XAccessible* pXAcc, long Role );
+
+    void  UpdateAccFocus( com::sun::star::accessibility::XAccessible* newFocus );
+    void  UpdateAction( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    sal_Bool IsContainer( com::sun::star::accessibility::XAccessible* pAccessible );
+
+    IMAccessible* GetIMAccByXAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+    IMAccessible* GetIAccessibleFromResID(long resID);
+
+    void NotifyDestroy( com::sun::star::accessibility::XAccessible* pXAcc );
+    com::sun::star::accessibility::XAccessible* GetParentXAccessible( com::sun::star::accessibility::XAccessible* pXAcc );
+    short GetParentRole( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    void SaveTopWindowHandle(HWND hWnd, com::sun::star::accessibility::XAccessible* pXAcc);
+
+    void UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    bool IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    short GetRole(com::sun::star::accessibility::XAccessible* pXAcc);
+
+    com::sun::star::accessibility::XAccessible* GetAccDocByAccTopWin( com::sun::star::accessibility::XAccessible* pXAcc );
+    bool IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc );
+
+    bool IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pAccessible);
+
+};
+#endif
diff --git a/main/winaccessibility/inc/AccParagraphEventListener.hxx b/main/winaccessibility/inc/AccParagraphEventListener.hxx
new file mode 100644
index 0000000..35158e6
--- /dev/null
+++ b/main/winaccessibility/inc/AccParagraphEventListener.hxx
@@ -0,0 +1,62 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCPARAGRAPHEVENTLISTENER_HXX
+#define __ACCPARAGRAPHEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccContainerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccParagraphEventListener is inherited from AccContainerEventListener. It handles the evnets
+ * generated by container controls. The accessible roles are: PARAGRAPH and HEADING.
+ * It defines the procedure of specific event handling related with text containsers and provides 
+ * the detailed support for some related methods.  
+ */
+class AccParagraphEventListener: public AccContainerEventListener
+{
+public:
+    AccParagraphEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccParagraphEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for caret changed event
+    virtual void SAL_CALL handleCaretChangedEvent(Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+
+    //add TEXT_SELECTION_CHANGED event
+    void handleTextSelectionChangedEvent();
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccResource.hxx b/main/winaccessibility/inc/AccResource.hxx
new file mode 100644
index 0000000..eff064f
--- /dev/null
+++ b/main/winaccessibility/inc/AccResource.hxx
@@ -0,0 +1,69 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef _ACCRESOURCE_HXX
+#define _ACCRESOURCE_HXX
+
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+class SimpleResMgr;
+
+#define ACC_RES_STRING(id) ResourceManager::loadString(id)
+
+//==================================================================
+//= ResourceManager
+//= handling ressources within the FormLayer library
+//==================================================================
+class ResourceManager
+{
+    static SimpleResMgr*	m_pImpl;
+
+private:
+    // no instantiation allowed
+    ResourceManager()
+    { }
+    ~ResourceManager()
+    { }
+
+    // we'll instantiate one static member of the following class, which, in it's dtor,
+    // ensures that m_pImpl will be deleted
+    class EnsureDelete
+    {
+    public:
+        EnsureDelete()
+        { }
+        ~EnsureDelete();
+    };
+    friend class EnsureDelete;
+
+protected:
+    static void ensureImplExists();
+
+public:
+    /** loads the string with the specified resource id from the FormLayer resource file
+    */
+    static ::rtl::OUString loadString(sal_uInt16 _nResId);
+};
+
+
+#endif
diff --git a/main/winaccessibility/inc/AccTableEventListener.hxx b/main/winaccessibility/inc/AccTableEventListener.hxx
new file mode 100644
index 0000000..17a87ff
--- /dev/null
+++ b/main/winaccessibility/inc/AccTableEventListener.hxx
@@ -0,0 +1,53 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef __ACCTABLEEVENTLISTENER_HXX
+#define __ACCTABLEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTableEventListener is inherited from AccDescendantManagerEventListener. It handles 
+ * the evnets generated by tree controls. The accessible role is: TABLE.
+ * It defines the procedure of specific event handling related with table components 
+ * and provides the detailed support for some related methods. 
+ */
+class AccTableEventListener: public AccDescendantManagerEventListener
+{
+public:
+    AccTableEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccTableEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+    //for active descendant changed event
+    virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+
+	void SAL_CALL handleTableModelChangeEvent(Any newValue);
+
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccTextComponentEventListener.hxx b/main/winaccessibility/inc/AccTextComponentEventListener.hxx
new file mode 100644
index 0000000..2415755
--- /dev/null
+++ b/main/winaccessibility/inc/AccTextComponentEventListener.hxx
@@ -0,0 +1,48 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCTEXTCOMPONENTEVENTLISTENER_HXX
+#define __ACCTEXTCOMPONENTEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccComponentEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTextComponentEventListener is inherited from AccComponentEventListener. It handles the evnets
+ * generated by container controls. The accessible role is: TEXT 
+ * It defines the procedure of specific event handling related with text components and provides 
+ * the detailed support for some related methods.  
+ */
+class AccTextComponentEventListener: public AccComponentEventListener
+{
+public:
+    AccTextComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccTextComponentEventListener();
+
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccTopWindowListener.hxx b/main/winaccessibility/inc/AccTopWindowListener.hxx
new file mode 100644
index 0000000..1da8537
--- /dev/null
+++ b/main/winaccessibility/inc/AccTopWindowListener.hxx
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+
+#ifndef __ACCTOPWINDOWLISTENER_HXX
+#define __ACCTOPWINDOWLISTENER_HXX

+
+#include <com/sun/star/awt/XTopWindowListener.hpp>
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <cppuhelper/weak.hxx>
+
+#include  "AccObjectManagerAgent.hxx"
+

+/**
+ * AccEventListener is the general event listener for all top windows. The top windows defined
+ * in UNO are: FRAME, WINDOW, DIALOG, MENU, TOOLTIP.
+ * It implements the methods of XTopWindowListener and the most important method is windowOpened().
+ * In this method, all the accessible objects (including COM object and Uno objects) are created and
+ * cached into bridge managers, and they are monitored by listeners for later accessible evnet handling.
+ */
+class AccTopWindowListener:
+            public com::sun::star::awt::XTopWindowListener,
+            public ::cppu::OWeakObject
+
+{
+private:
+    AccObjectManagerAgent accManagerAgent;
+    oslInterlockedCount m_refcount;
+public:
+    AccTopWindowListener();
+    virtual ~AccTopWindowListener();
+    virtual void SAL_CALL windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowMinimized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowNormalized( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowActivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL windowDeactivated( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
+    virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException);
+    virtual void SAL_CALL acquire(  ) throw ();
+    virtual void SAL_CALL release(  ) throw ();
+    virtual void AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible,com::sun::star::accessibility::XAccessible* pParentXAcc,HWND pWND );
+    //for On-Demand load.
+    virtual void handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible );
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccTreeEventListener.hxx b/main/winaccessibility/inc/AccTreeEventListener.hxx
new file mode 100644
index 0000000..d58887e
--- /dev/null
+++ b/main/winaccessibility/inc/AccTreeEventListener.hxx
@@ -0,0 +1,50 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCTREEEVENTLISTENER_HXX
+#define __ACCTREEEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccDescendantManagerEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+
+/**
+ * AccTreeEventListener is inherited from AccDescendantManagerEventListener. It handles 
+ * the evnets generated by tree controls. The accessible role is: TREE.
+ * It defines the procedure of specific event handling related with tree components 
+ * and provides the detailed support for some related methods. 
+ */
+class AccTreeEventListener: public AccDescendantManagerEventListener
+{
+public:
+    AccTreeEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccTreeEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+    //for active descendant changed event
+    virtual void SAL_CALL handleActiveDescendantChangedEvent(Any oldValue, Any newValue);
+};
+
+#endif
diff --git a/main/winaccessibility/inc/AccWindowEventListener.hxx b/main/winaccessibility/inc/AccWindowEventListener.hxx
new file mode 100644
index 0000000..e11a3c1
--- /dev/null
+++ b/main/winaccessibility/inc/AccWindowEventListener.hxx
@@ -0,0 +1,60 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+ 

+#ifndef __ACCWINDOWEVENTLISTENER_HXX
+#define __ACCWINDOWEVENTLISTENER_HXX
+
+#include <stdio.h>
+#include "AccEventListener.hxx"
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+
+using namespace ::com::sun::star::uno;
+/**
+ * AccWindowEventListener is inherited from AccEventListener. It handles the events
+ * generated by Dialogs. The accessible role is: WINDOW.
+ * It defines the procedure of specific event handling related with windows and provides 
+ * the detailed support for some related methods.  
+ */
+class AccWindowEventListener: public AccEventListener
+{
+public:
+    AccWindowEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent);
+    virtual ~AccWindowEventListener();
+
+    //AccessibleEventListener
+    virtual void SAL_CALL notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException);
+
+    //for child changed event
+    virtual void SAL_CALL handleChildChangedEvent (Any oldValue, Any newValue);
+
+    //for visible data changed event
+    virtual void SAL_CALL handleVisibleDataChangedEvent();
+
+    //for bound rect changed event
+    virtual void SAL_CALL handleBoundrectChangedEvent();
+
+    //state changed
+    virtual void SAL_CALL setComponentState(short state, bool enable);
+
+};
+
+#endif
diff --git a/main/winaccessibility/inc/ResIDGenerator.hxx b/main/winaccessibility/inc/ResIDGenerator.hxx
new file mode 100644
index 0000000..c10281e
--- /dev/null
+++ b/main/winaccessibility/inc/ResIDGenerator.hxx
@@ -0,0 +1,56 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+ 

+#ifndef __RESIDGENERATOR_HXX
+#define __RESIDGENERATOR_HXX
+
+#define PRIMARY_RESID 0x00000001
+#include <deque>
+
+//ResID i.e. MSAA child ID,
+//this class is responsible for generating a child ID
+class ResIDGenerator
+{
+private:
+
+    long min;
+    long max;
+    std::deque<long> subList;
+
+public:
+
+    ResIDGenerator( long minNum = PRIMARY_RESID,long maxNum = PRIMARY_RESID);
+    long GenerateNewResID();
+    void SetSub(long number)
+    {
+        subList.push_back(number);
+    };
+    virtual ~ResIDGenerator();
+
+};
+
+inline ResIDGenerator::ResIDGenerator( long minNum ,long maxNum )
+{
+    min = minNum;
+    max = maxNum;
+}
+

+#endif
diff --git a/main/winaccessibility/inc/UAccCOM2.h b/main/winaccessibility/inc/UAccCOM2.h
new file mode 100644
index 0000000..bfad6a8
--- /dev/null
+++ b/main/winaccessibility/inc/UAccCOM2.h
@@ -0,0 +1,30 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#ifndef __UACCCOM2_H
+#define __UACCCOM2_H
+
+// Just a wrapper header for disabling this warning....
+
+#pragma warning( disable: 4917 )  /* a GUID can only be associated with a class, interface or namespace */
+#include "UAccCOM.h"
+
+#endif
diff --git a/main/winaccessibility/inc/accHelper.hxx b/main/winaccessibility/inc/accHelper.hxx
new file mode 100644
index 0000000..939ffb9
--- /dev/null
+++ b/main/winaccessibility/inc/accHelper.hxx
@@ -0,0 +1,145 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCHELPER_HXX
+#define __ACCHELPER_HXX
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>

+
+#include "UAccCOM2.h"
+
+enum DIRECTION
+{
+    FIRST_CHILD=0,
+    LAST_CHILD=-1,
+    BEFORE_CHILD=1 ,
+    AFTER_CHILD=2
+};
+
+#define CHILDID_SELF			 0
+#define UNO_MSAA_UNMAPPING		 0x00000000
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+//Role mapping table,left side is UNO role, right side is MSAA role
+const short ROLE_TABLE[][2] =
+    {
+        {UNKNOWN,				   IA2_ROLE_UNKNOWN},
+        {ALERT ,                   ROLE_SYSTEM_DIALOG},
+        {COLUMN_HEADER ,           ROLE_SYSTEM_COLUMNHEADER},
+        //{CANVAS ,                  ROLE_SYSTEM_CLIENT},
+        {CANVAS ,                  IA2_ROLE_CANVAS},
+        {CHECK_BOX ,               ROLE_SYSTEM_CHECKBUTTON},
+        {CHECK_MENU_ITEM ,         IA2_ROLE_CHECK_MENU_ITEM},
+        {COLOR_CHOOSER,			   IA2_ROLE_COLOR_CHOOSER},
+        {COMBO_BOX ,               ROLE_SYSTEM_COMBOBOX},
+        {DATE_EDITOR ,             IA2_ROLE_DATE_EDITOR},
+        {DESKTOP_ICON ,			   IA2_ROLE_DESKTOP_ICON},
+        {DESKTOP_PANE,             IA2_ROLE_DESKTOP_PANE},
+        {DIRECTORY_PANE,           IA2_ROLE_DIRECTORY_PANE},
+        {DIALOG,                   ROLE_SYSTEM_DIALOG},
+        {DOCUMENT,                 ROLE_SYSTEM_DOCUMENT},
+        {EMBEDDED_OBJECT ,		   IA2_ROLE_EMBEDDED_OBJECT },
+        {END_NOTE ,				   IA2_ROLE_ENDNOTE },
+        {FILE_CHOOSER ,			   IA2_ROLE_FILE_CHOOSER },
+        {FILLER,                   ROLE_SYSTEM_WHITESPACE},
+        {FONT_CHOOSER,			   IA2_ROLE_FONT_CHOOSER},
+        {FOOTER,				   IA2_ROLE_FOOTER},
+        {FOOTNOTE,				   IA2_ROLE_FOOTNOTE},
+        //{FRAME,					   IA2_ROLE_FRAME},
+        {FRAME,					   ROLE_SYSTEM_DIALOG},
+        {GLASS_PANE ,              IA2_ROLE_GLASS_PANE},
+        {GRAPHIC ,                 ROLE_SYSTEM_GRAPHIC},
+        {GROUP_BOX,                ROLE_SYSTEM_GROUPING},
+        {HEADER	,				   IA2_ROLE_HEADER},
+        {HEADING ,                 IA2_ROLE_HEADING},
+        {HYPER_LINK ,              ROLE_SYSTEM_TEXT},
+        {ICON ,                    IA2_ROLE_ICON},
+        {INTERNAL_FRAME,           IA2_ROLE_INTERNAL_FRAME},
+        {LABEL,                    ROLE_SYSTEM_STATICTEXT},
+        {LAYERED_PANE ,            IA2_ROLE_LAYERED_PANE},
+        {LIST ,                    ROLE_SYSTEM_LIST},
+        {LIST_ITEM ,               ROLE_SYSTEM_LISTITEM},
+        //{MENU ,                    ROLE_SYSTEM_MENUPOPUP},
+        {MENU,                ROLE_SYSTEM_MENUITEM},
+        {MENU_BAR,                 ROLE_SYSTEM_MENUBAR},
+        {MENU_ITEM,                ROLE_SYSTEM_MENUITEM},
+        {OPTION_PANE ,             IA2_ROLE_OPTION_PANE},
+        {PAGE_TAB,                 ROLE_SYSTEM_PAGETAB},
+        {PAGE_TAB_LIST,            ROLE_SYSTEM_PAGETABLIST},
+        {PANEL,                    IA2_ROLE_OPTION_PANE},
+        {PARAGRAPH,                IA2_ROLE_PARAGRAPH},
+        {PASSWORD_TEXT,            ROLE_SYSTEM_TEXT},
+        {POPUP_MENU,               ROLE_SYSTEM_MENUPOPUP},
+        {PUSH_BUTTON,              ROLE_SYSTEM_PUSHBUTTON},
+        {PROGRESS_BAR,             ROLE_SYSTEM_PROGRESSBAR},
+        {RADIO_BUTTON,             ROLE_SYSTEM_RADIOBUTTON},
+        {RADIO_MENU_ITEM,     	   IA2_ROLE_RADIO_MENU_ITEM},
+        {ROW_HEADER ,              ROLE_SYSTEM_ROWHEADER},
+        {ROOT_PANE,                IA2_ROLE_ROOT_PANE},
+        {SCROLL_BAR ,              ROLE_SYSTEM_SCROLLBAR},
+        {SCROLL_PANE ,             IA2_ROLE_SCROLL_PANE},
+        {SHAPE,					   IA2_ROLE_SHAPE},
+        {SEPARATOR ,               ROLE_SYSTEM_SEPARATOR},
+        {SLIDER ,                  ROLE_SYSTEM_SLIDER},
+        {SPIN_BOX ,                ROLE_SYSTEM_SPINBUTTON},
+        {SPLIT_PANE,               IA2_ROLE_SPLIT_PANE},
+        {STATUS_BAR,               ROLE_SYSTEM_STATUSBAR},
+        {TABLE,                    ROLE_SYSTEM_TABLE},
+        {TABLE_CELL ,              ROLE_SYSTEM_CELL},
+        {TEXT,                     ROLE_SYSTEM_TEXT},
+        {TEXT_FRAME ,			   IA2_ROLE_TEXT_FRAME},
+        //for change toggle button to push button for jaws
+        {TOGGLE_BUTTON,            ROLE_SYSTEM_PUSHBUTTON},
+
+        {TOOL_BAR,                 ROLE_SYSTEM_TOOLBAR},
+        {TOOL_TIP,                 ROLE_SYSTEM_TOOLTIP},
+        {TREE ,                    ROLE_SYSTEM_OUTLINE},
+        {VIEW_PORT ,			   IA2_ROLE_VIEW_PORT},
+        {WINDOW,                   ROLE_SYSTEM_WINDOW},

+		{BUTTON_DROPDOWN,  ROLE_SYSTEM_BUTTONDROPDOWN},

+		{BUTTON_MENU,			  ROLE_SYSTEM_BUTTONMENU},

+		{CAPTION,					IA2_ROLE_CAPTION},

+		{CHART,						IA2_ROLE_SHAPE},

+		{EDIT_BAR,					IA2_ROLE_EDITBAR},

+		{FORM,						IA2_ROLE_FORM},

+		{IMAGE_MAP ,			  IA2_ROLE_IMAGE_MAP},

+		{NOTE,						IA2_ROLE_NOTE},

+		{PAGE,						IA2_ROLE_PAGE},

+		{RULER ,				  IA2_ROLE_RULER},

+		{SECTION,					IA2_ROLE_SECTION},
+        {TREE_ITEM ,              ROLE_SYSTEM_OUTLINEITEM},

+		{TREE_TABLE,				ROLE_SYSTEM_OUTLINE}
+    };
+
+struct ltstr4
+{
+    bool operator()(const long  s1, const long  s2) const
+    {
+        return long(s1)<long(s2);
+    }
+};
+
+#endif
diff --git a/main/winaccessibility/inc/act.hxx b/main/winaccessibility/inc/act.hxx
new file mode 100644
index 0000000..ecf899a
--- /dev/null
+++ b/main/winaccessibility/inc/act.hxx
@@ -0,0 +1,90 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCACT_HXX
+#define __ACCACT_HXX
+
+#include <windows.h>
+#include <tchar.h>
+

+

+static bool IsXPOrLater()

+{

+	OSVERSIONINFO osvi;

+

+	ZeroMemory(&osvi, sizeof(OSVERSIONINFO));

+

+	osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);

+

+	GetVersionEx(&osvi);

+	return ((osvi.dwMajorVersion > 5) ||

+		((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1)));

+}
+

+static HANDLE pActCtx = INVALID_HANDLE_VALUE;

+static ULONG_PTR lpCookie;

+
+static bool ActivateActContext()
+{
+	if(!IsXPOrLater())
+		return false;
+
+	ACTCTX actctx; 

+

+	ZeroMemory(&actctx, sizeof(actctx)); 

+

+	actctx.cbSize = sizeof(actctx); 

+

+	TCHAR szDllDirPath[1024];

+	::GetCurrentDirectory(1024,szDllDirPath);

+	LPTSTR szDllPath = szDllDirPath;

+	lstrcat(szDllPath, _T("\\UAccCOM.dll"));

+

+	actctx.lpSource = szDllPath;

+	actctx.lpResourceName = MAKEINTRESOURCE(97);

+	actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID;

+

+	HANDLE pActCtx = CreateActCtx(&actctx); 

+

+	if(pActCtx != INVALID_HANDLE_VALUE) 

+	{

+		if(ActivateActCtx(pActCtx, &lpCookie))

+		{

+			return true;

+		}		
+	}
+	pActCtx = INVALID_HANDLE_VALUE;
+	lpCookie = 0;
+	return false;
+}
+
+static void DeactivateActContext()
+{
+	if(!IsXPOrLater())
+		return;
+
+	if(lpCookie)
+		DeactivateActCtx(0, lpCookie); 
+
+	if(pActCtx!=INVALID_HANDLE_VALUE)
+		ReleaseActCtx(pActCtx);
+}
+#endif
\ No newline at end of file
diff --git a/main/winaccessibility/inc/g_msacc.hxx b/main/winaccessibility/inc/g_msacc.hxx
new file mode 100644
index 0000000..11b69b3
--- /dev/null
+++ b/main/winaccessibility/inc/g_msacc.hxx
@@ -0,0 +1,27 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+ 

+#ifndef __G_MSACC_HXX
+#define __G_MSACC_HXX
+
+extern AccTopWindowListener* g_pTop;
+
+#endif
diff --git a/main/winaccessibility/inc/unomsaaevent.hxx b/main/winaccessibility/inc/unomsaaevent.hxx
new file mode 100644
index 0000000..68b5afd
--- /dev/null
+++ b/main/winaccessibility/inc/unomsaaevent.hxx
@@ -0,0 +1,110 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+ 

+#ifndef __UNOMSAAEVENT_HXX
+#define __UNOMSAAEVENT_HXX
+
+//STATE_CHANGED with get FOCUSED -> EVENT_OBJECT_FOCUS
+const short UM_EVENT_STATE_FOCUSED = 0 ;
+
+//STATE_CHANGED --> EVENT_OBJECT_STATECHANGE
+const short UM_EVENT_STATE_CHECKED  = 1 ;
+const short UM_EVENT_STATE_ARMED    = 2 ;
+const short UM_EVENT_STATE_PRESSED  = 3 ;
+const short UM_EVENT_STATE_SELECTED = 4 ;
+const short UM_EVENT_STATE_SHOWING  = 5 ;
+
+//if acc role is MENU_BAR, STATE_CHANGED with get FOCUSED -> EVENT_SYSTEM_MENUSTART
+const short UM_EVENT_MENU_START = 6 ;
+
+//if acc role is MENU_BAR, STATE_CHANGED with lose FOCUSED -> EVENT_SYSTEM_MENUEND
+const short UM_EVENT_MENU_END = 7 ;
+
+//if acc role is POPUP_MENU, STATE_CHANGED with get FOCUSED -> EVENT_SYSTEM_MENUPOPUPSTART
+const short UM_EVENT_MENUPOPUPSTART = 8 ;
+
+//if acc role is POPUP_MENU, STATE_CHANGED with lose FOCUSED -> EVENT_SYSTEM_MENUPOPUPEND
+const short UM_EVENT_MENUPOPUPEND = 9 ;
+
+//SELECTION_CHANGED -> EVENT_OBJECT_SELECTION
+const short UM_EVENT_SELECTION_CHANGED = 10 ;
+
+//INVALIDATE_ALL_CHILDREN --> EVENT_OBJECT_SHOW
+const short UM_EVENT_INVALIDATE_ALL_CHILDREN = 11 ;
+
+//VALUE_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_OBJECT_VALUECHANGE = 12 ;
+
+//NAME_CHANGED --> EVENT_OBJECT_NAMECHANGE
+const short UM_EVENT_OBJECT_NAMECHANGE = 13 ;
+
+//DESCRIPTION_CHANGED --> EVENT_OBJECT_DESCRIPTIONCHANGE
+const short UM_EVENT_OBJECT_DESCRIPTIONCHANGE = 14 ;
+
+//ACTION_CHANGED --> EVENT_OBJECT_DEFACTIONCHANGE
+const short UM_EVENT_OBJECT_DEFACTIONCHANGE = 15 ;
+
+//CARET_CHANGED --> EVENT_OBJECT_LOCATIONCHANGED
+const short UM_EVENT_OBJECT_CARETCHANGE = 16 ;
+
+//TEXT_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_OBJECT_TEXTCHANGE = 17 ;
+
+//ACTIVE_DESCENDANT_CHANGED --> EVENT_OBJECT_FOCUS
+const short UM_EVENT_ACTIVE_DESCENDANT_CHANGED = 18 ;
+
+//BOUNDRECT_CHANGED --> EVENT_OBJECT_LOCATIONCHANGE
+const short UM_EVENT_BOUNDRECT_CHANGED = 19 ;
+
+//VISIBLE_DATA_CHANGED --> EVENT_OBJECT_VALUECHANGE
+const short UM_EVENT_VISIBLE_DATA_CHANGED = 20 ;
+
+//to enable SHOW on dialogs, windows, frames
+const short UM_EVENT_SHOW = 21 ;
+
+const short UM_EVENT_STATE_BUSY = 22 ;
+
+const short UM_EVENT_TABLE_CAPTION_CHANGED = 24;
+const short UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED = 25;
+const short UM_EVENT_TABLE_COLUMN_HEADER_CHANGED = 26;
+const short UM_EVENT_TABLE_MODEL_CHANGED = 27;
+const short UM_EVENT_TABLE_ROW_HEADER_CHANGED = 28;
+const short UM_EVENT_TABLE_SUMMARY_CHANGED = 29;
+const short UM_EVENT_OBJECT_REORDER = 30;
+const short UM_EVENT_PAGE_CHANGED =31;
+const short UM_EVENT_CHILD_ADDED =32;
+const short UM_EVENT_CHILD_REMOVED =33;
+const short UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED =    34;
+const short UM_EVENT_SELECTION_CHANGED_ADD = 35 ;
+const short UM_EVENT_SELECTION_CHANGED_REMOVE = 36 ;
+const short UM_EVENT_SELECTION_CHANGED_WITHIN = 37 ;
+
+//support for PAGE_CHANGED event
+const short UM_EVENT_OBJECT_PAGECHANGED = 38;
+
+//to add TEXT_SELECTION_CHANGED event
+const short UM_EVENT_TEXT_SELECTION_CHANGED = 39;
+
+//for section change and column chang event
+const short UM_EVENT_SECTION_CHANGED = 40;
+const short UM_EVENT_COLUMN_CHANGED = 41;
+
+#endif
diff --git a/main/winaccessibility/prj/build.lst b/main/winaccessibility/prj/build.lst
new file mode 100644
index 0000000..e189abd
--- /dev/null
+++ b/main/winaccessibility/prj/build.lst
@@ -0,0 +1,5 @@
+wa	winaccessibility	:	vcl toolkit NULL
+wa	winaccessibility							usr1	-	w	wa_mkout NULL
+wa	winaccessibility\source\UAccComIDL			nmake	-	w	wa_UAccComIDL NULL
+wa	winaccessibility\source\UAccCOM				nmake	-	w	wa_UAccCOM wa_UAccComIDL.w NULL
+wa	winaccessibility\source\service				nmake	-	w	wa_service wa_UAccCOM.w NULL
diff --git a/main/winaccessibility/prj/d.lst b/main/winaccessibility/prj/d.lst
new file mode 100644
index 0000000..d810df4
--- /dev/null
+++ b/main/winaccessibility/prj/d.lst
@@ -0,0 +1,9 @@
+mkdir: %_DEST%\inc%_EXT%\winaccessibility
+mkdir: %_DEST%\inc%_EXT%\winaccessibility\UAccCOM
+
+..\%__SRC%\bin\*.dll %_DEST%\bin%_EXT%\*.dll
+..\%__SRC%\misc\winaccessibility.component %_DEST%\xml%_EXT%\winaccessibility.component
+
+#..\%__SRC%\inc\*.hxx %_DEST%\inc%_EXT%\winaccessibility\*.hxx
+#..\%__SRC%\inc\UAccCOM\*.h %_DEST%\inc%_EXT%\winaccessibility\UAccCOM\*.h
+#..\%__SRC%\inc\UAccCOM\*.c %_DEST%\inc%_EXT%\winaccessibility\UAccCOM\*.c
diff --git a/main/winaccessibility/source/UAccCOM/AccAction.cpp b/main/winaccessibility/source/UAccCOM/AccAction.cpp
new file mode 100644
index 0000000..aa0a32f
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccAction.cpp
@@ -0,0 +1,120 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+/**
+ * AccAction.cpp : Implementation of CAccAction
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccAction.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * Returns the number of action.
+ *
+ * @param    nActions    the number of action.
+ */
+STDMETHODIMP CAccAction::nActions(/*[out,retval]*/long* nActions)
+{
+    
+    return CAccActionBase::nActions(nActions);
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param    actionIndex    the index of action.
+ */
+STDMETHODIMP CAccAction::doAction(/* [in] */ long actionIndex)
+{
+    
+    return CAccActionBase::doAction(actionIndex);
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param    actionIndex    the index of action.
+ * @param    description    the description string of the specified action.
+ */
+STDMETHODIMP CAccAction::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+    
+    return CAccActionBase::get_description(actionIndex, description);
+}
+
+STDMETHODIMP CAccAction::get_name( long actionIndex, BSTR __RPC_FAR *name)
+{
+    
+    return CAccActionBase::get_name(actionIndex, name);
+}
+
+STDMETHODIMP CAccAction::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName)
+{
+    
+    return CAccActionBase::get_localizedName(actionIndex, localizedName);
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action 
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param    actionIndex    the index of action.
+ * @param    nMaxBinding    the max number of key binding.
+ * @param    keyBinding     the key binding array.
+ * @param    nBinding       the actual number of key binding returned.
+ */
+STDMETHODIMP CAccAction::get_keyBinding(
+    /* [in] */ long actionIndex,
+    /* [in] */ long nMaxBinding,
+    /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+    /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+    
+    return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding,	keyBinding, nBinding);
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccAction::put_XInterface(long pXInterface)
+{
+    
+    return CAccActionBase::put_XInterface(pXInterface);
+}
+/**
+   * Put UNO interface.
+   * @param pXSubInterface XAccessibleHyperlink interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccAction::put_XSubInterface(long pXSubInterface)
+{
+    
+
+    pRXAct = (XAccessibleAction*)pXSubInterface;
+
+    return S_OK;
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccAction.h b/main/winaccessibility/source/UAccCOM/AccAction.h
new file mode 100644
index 0000000..b98e7d5
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccAction.h
@@ -0,0 +1,105 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCACTION_H_
+#define __ACCACTION_H_
+
+#include "resource.h"       // main symbols
+#include "AccActionBase.h"
+
+/**
+ * CAccAction implements IAccessibleAction interface.
+ */
+class ATL_NO_VTABLE CAccAction :
+            public CComObjectRoot,
+            public CComCoClass<CAccAction, &CLSID_AccAction>,
+            public IAccessibleAction,
+            public CAccActionBase
+{
+public:
+    CAccAction()
+    {
+        
+    }
+    ~CAccAction()
+    {
+        
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_ACCACTION)
+
+    BEGIN_COM_MAP(CAccAction)
+    COM_INTERFACE_ENTRY(IAccessibleAction)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccAction*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    // IAccessibleAction
+public:
+    // IAccessibleAction
+
+    // Returns the number of action.
+    STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+    // Performs specified action on the object.
+    STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+    // Gets description of specified action.
+    STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+    // added , 2006/06/28, for driver 07/11
+    // get the action name
+    STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+    // get the localized action name
+    STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+    // Returns key binding object (if any) associated with specified action
+    // key binding is string.
+    // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+    STDMETHOD(get_keyBinding)(
+        /* [in] */ long actionIndex,
+        /* [in] */ long nMaxBinding,
+        /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+        /* [retval][out] */ long __RPC_FAR *nBinding);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+};
+
+#endif //__ACCACTION_H_
diff --git a/main/winaccessibility/source/UAccCOM/AccAction.rgs b/main/winaccessibility/source/UAccCOM/AccAction.rgs
new file mode 100644
index 0000000..7b51e7b
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccAction.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+	UAccCOM.AccAction.1 = s 'AccAction Class'
+	{
+		CLSID = s '{AA49F20E-BB4E-400D-A5B0-6F5B7B770227}'
+	}
+	UAccCOM.AccAction = s 'AccAction Class'
+	{
+		CLSID = s '{AA49F20E-BB4E-400D-A5B0-6F5B7B770227}'
+		CurVer = s 'UAccCOM.AccAction.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {AA49F20E-BB4E-400D-A5B0-6F5B7B770227} = s 'AccAction Class'
+		{
+			ProgID = s 'UAccCOM.AccAction.1'
+			VersionIndependentProgID = s 'UAccCOM.AccAction'
+			ForceRemove 'Programmable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+			'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccActionBase.cpp b/main/winaccessibility/source/UAccCOM/AccActionBase.cpp
new file mode 100644
index 0000000..4079e77
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccActionBase.cpp
@@ -0,0 +1,416 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccActionBase.cpp: implementation of the CAccActionBase class.
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+
+#include "AccActionBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+#include "AccessibleKeyStroke.h"
+
+#ifndef __ACCCOMMON_H_
+#include "acccommon.h"
+#endif
+
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CAccActionBase::CAccActionBase()
+{}
+
+CAccActionBase::~CAccActionBase()
+{}
+
+/**
+ * Helper function used for getting default action by UNO role.
+ *
+ * @param    pRContext    UNO context interface pointer.
+ * @param    pRet         the corresponding string to be returned.
+ */
+void GetDfActionByUNORole(XAccessibleContext* pRContext, BSTR* pRet)
+{
+    // #CHECK#
+    if(pRContext == NULL || pRet == NULL)
+    {
+        return;
+    }
+
+    long Role = pRContext->getAccessibleRole();
+
+    switch(Role)
+    {
+    case PUSH_BUTTON:
+        *pRet = ::SysAllocString(PRESS);
+        break;
+    case RADIO_BUTTON:
+    case MENU_ITEM:
+    case LIST_ITEM:
+        *pRet = ::SysAllocString(SELECT);
+        break;
+    case CHECK_BOX:
+        {
+            Reference< XAccessibleStateSet > pRState = pRContext->getAccessibleStateSet();
+            if( !pRState.is() )
+            {
+                return;
+            }
+
+            Sequence<short> pStates = pRState->getStates();
+            int count = pStates.getLength();
+            *pRet = ::SysAllocString(CHECK);
+            for( int iIndex = 0;iIndex < count;iIndex++ )
+            {
+                if( pStates[iIndex] == AccessibleStateType::CHECKED )
+                {
+                    SAFE_SYSFREESTRING(*pRet);
+                    *pRet = ::SysAllocString(UNCHECK);
+                    break;
+                }
+            }
+            break;
+        }
+    }
+}
+
+/**
+ * Returns the number of action.
+ *
+ * @param    nActions    the number of action.
+ */
+STDMETHODIMP CAccActionBase::nActions(/*[out,retval]*/long* nActions)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if( pRXAct.is() && nActions != NULL )
+    {
+        *nActions = GetXInterface()->getAccessibleActionCount();
+        return S_OK;
+    }
+    *nActions = 0;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param    actionIndex    the index of action.
+ */
+STDMETHODIMP CAccActionBase::doAction(/* [in] */ long actionIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if( pRXAct.is() )
+    {
+        return GetXInterface()->doAccessibleAction( actionIndex )?S_OK:E_FAIL;
+    }
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param    actionIndex    the index of action.
+ * @param    description    the description string of the specified action.
+ */
+STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(description == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXAct.is())
+        return E_FAIL;
+
+    ::rtl::OUString ouStr = GetXInterface()->getAccessibleActionDescription(actionIndex);
+    // #CHECK#
+
+    SAFE_SYSFREESTRING(*description);
+    *description = SysAllocString((OLECHAR*)ouStr.getStr());
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccActionBase::get_name( long, BSTR __RPC_FAR *)
+{
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccActionBase::get_localizedName( long, BSTR __RPC_FAR *)
+{
+    return E_NOTIMPL;
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action 
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param    actionIndex    the index of action.
+ * @param    nMaxBinding    the max number of key binding.
+ * @param    keyBinding     the key binding array.
+ * @param    nBinding       the actual number of key binding returned.
+ */
+STDMETHODIMP CAccActionBase::get_keyBinding(
+    /* [in] */ long actionIndex,
+    /* [in] */ long,
+    /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+    /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if( !keyBinding || !nBinding)
+        return E_INVALIDARG;
+
+    if( !pRXAct.is() )
+        return E_FAIL;
+
+    Reference< XAccessibleKeyBinding > binding = GetXInterface()->getAccessibleActionKeyBinding(actionIndex);
+    if( !binding.is() )
+        return E_FAIL;
+
+    long nCount = (binding.get())->getAccessibleKeyBindingCount();
+
+    OLECHAR wString[64];
+
+    *keyBinding = (BSTR*)::CoTaskMemAlloc(nCount*sizeof(BSTR));
+
+    // #CHECK Memory Allocation#
+    if(*keyBinding == NULL)
+        return E_FAIL;
+
+    for( int index = 0;index < nCount;index++ )
+    {
+        memset(wString,0,sizeof(wString));
+        GetkeyBindingStrByXkeyBinding( (binding.get())->getAccessibleKeyBinding(index), wString );
+
+        (*keyBinding)[index] = SysAllocString(wString);
+    }
+
+    *nBinding = nCount;
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccActionBase::put_XInterface(long pXInterface)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+        return E_FAIL;
+
+    Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXAct = NULL;
+    else
+        pRXAct = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Helper function used for converting keybinding to string.
+ *
+ * @param    keySet    the key stroke sequence.
+ * @param    pString   the output keybinding string.
+ */
+void CAccActionBase::GetkeyBindingStrByXkeyBinding( const Sequence< KeyStroke > &keySet, OLECHAR* pString )
+{
+    // #CHECK#
+    if(pString == NULL)
+        return;
+
+    for( int iIndex = 0;iIndex < keySet.getLength();iIndex++ )
+    {
+        KeyStroke stroke = keySet[iIndex];
+        OLECHAR wString[64] = {NULL};
+        if(iIndex>0)
+            wcscat( wString, OLESTR("  ") );
+        if((stroke.Modifiers & MODIFIER_SHIFT) == MODIFIER_SHIFT)
+            wcscat( wString, OLESTR("Shift+") );
+        if((stroke.Modifiers & MODIFIER_CTRL) == MODIFIER_CTRL)
+            wcscat( wString, OLESTR("Ctrl+") );
+        if((stroke.Modifiers & MODIFIER_ALT) == MODIFIER_ALT)
+            wcscat( wString, OLESTR("Alt+") );
+        if(stroke.KeyCode)
+        {
+            OLECHAR* pChar = getOLECHARFromKeyCode(stroke.KeyCode);
+            if(pChar != NULL)
+                wcscat( wString, pChar );
+            else if (stroke.KeyCode <= 255)
+            {
+                OLECHAR pChar[4] = {NULL};
+                swprintf( pChar, L"%c", stroke.KeyCode);
+                wcscat( wString, pChar);
+            }
+            else
+            {
+                OLECHAR pChar[4] = {NULL};
+                swprintf( pChar, L"%d", stroke.KeyCode);
+                wcscat( wString, pChar);
+            }
+        }
+
+        wcscat( pString, wString);
+    }
+}
+
+/**
+ * Helper function used for converting key code to ole string.
+ *
+ * @param    key    the key code.
+ */
+OLECHAR* CAccActionBase::getOLECHARFromKeyCode(long key)
+{
+    static struct keyMap
+    {
+        int keyCode;
+        OLECHAR* key;
+    }
+    map[] =
+        {
+            {MODIFIER_SHIFT, L"SHIFT" },
+            {MODIFIER_CTRL, L"CTRL" },
+            {MODIFIER_ALT, L"ALT" },
+            CODEENTRY(NUM0),CODEENTRY(NUM1),CODEENTRY(NUM2),CODEENTRY(NUM3),CODEENTRY(NUM4),CODEENTRY(NUM5),
+            CODEENTRY(NUM6),CODEENTRY(NUM7),CODEENTRY(NUM8),CODEENTRY(NUM9),
+            CODEENTRY(A),CODEENTRY(B),CODEENTRY(C),CODEENTRY(D),CODEENTRY(E),CODEENTRY(F),
+            CODEENTRY(G),CODEENTRY(H),CODEENTRY(I),CODEENTRY(J),CODEENTRY(K),CODEENTRY(L),
+            CODEENTRY(M),CODEENTRY(N),CODEENTRY(O),CODEENTRY(P),CODEENTRY(Q),CODEENTRY(R),
+            CODEENTRY(S),CODEENTRY(T),CODEENTRY(U),CODEENTRY(V),CODEENTRY(W),CODEENTRY(X),
+            CODEENTRY(Y),CODEENTRY(Z),
+            CODEENTRY(F1),CODEENTRY(F2),CODEENTRY(F3),CODEENTRY(F4),CODEENTRY(F5),CODEENTRY(F6),
+            CODEENTRY(F7),CODEENTRY(F8),CODEENTRY(F9),CODEENTRY(F10),CODEENTRY(F11),CODEENTRY(F12),
+            CODEENTRY(F13),CODEENTRY(F14),CODEENTRY(F15),CODEENTRY(F16),CODEENTRY(F17),CODEENTRY(F18),
+            CODEENTRY(F19),CODEENTRY(F20),CODEENTRY(F21),CODEENTRY(F22),CODEENTRY(F23),CODEENTRY(F24),
+            CODEENTRY(F25),CODEENTRY(F26),
+
+            { KEYCODE_DOWN, L"DOWN" },
+            { KEYCODE_UP, L"UP" },
+            { KEYCODE_LEFT, L"LEFT" },
+            { KEYCODE_RIGHT, L"RIGHT" },
+            { KEYCODE_HOME, L"HOME" },
+            { KEYCODE_END, L"END" },
+            { KEYCODE_PAGEUP, L"PAGEUP" },
+            { KEYCODE_PAGEDOWN, L"PAGEDOWN" },
+            { KEYCODE_RETURN, L"RETURN" },
+            { KEYCODE_ESCAPE, L"ESCAPE" },
+            { KEYCODE_TAB, L"TAB" },
+            { KEYCODE_BACKSPACE, L"BACKSPACE" },
+            { KEYCODE_SPACE, L"SPACE" },
+            { KEYCODE_INSERT, L"INSERT" },
+            { KEYCODE_DELETE, L"DELETE" },
+            { KEYCODE_ADD, L"ADD" },
+            { KEYCODE_SUBTRACT, L"SUBTRACT" },
+            { KEYCODE_MULTIPLY, L"MULTIPLY" },
+            { KEYCODE_DIVIDE, L"DIVIDE" },
+            { KEYCODE_POINT, L"POINT" },
+            { KEYCODE_COMMA, L"COMMA" },
+            { KEYCODE_LESS, L"LESS" },
+            { KEYCODE_GREATER, L"GREATER" },
+            { KEYCODE_EQUAL, L"EQUAL" },
+            { KEYCODE_OPEN, L"OPEN" },
+            { KEYCODE_CUT, L"CUT" },
+            { KEYCODE_COPY, L"COPY" },
+            { KEYCODE_PASTE, L"PASTE" },
+            { KEYCODE_UNDO, L"UNDO" },
+            { KEYCODE_REPEAT, L"REPEAT" },
+            { KEYCODE_FIND, L"FIND" },
+            { KEYCODE_PROPERTIES, L"PROPERTIES" },
+            { KEYCODE_FRONT, L"FRONT" },
+            { KEYCODE_CONTEXTMENU, L"CONTEXTMENU" },
+            { KEYCODE_HELP, L"HELP" },
+        };
+    static long nCount = countof(map);
+
+    long min = 0;
+    long max = nCount-1;
+    long mid = nCount/2;
+    while(min<max)
+    {
+        if(key<map[mid].keyCode)
+            max = mid-1;
+        else if(key>map[mid].keyCode)
+            min = mid+1;
+        else
+            break;
+        mid = (min+max)/2;
+    }
+
+    if(key == map[mid].keyCode)
+    {
+        return map[mid].key;
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
diff --git a/main/winaccessibility/source/UAccCOM/AccActionBase.h b/main/winaccessibility/source/UAccCOM/AccActionBase.h
new file mode 100644
index 0000000..986a9dc
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccActionBase.h
@@ -0,0 +1,92 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+//////////////////////////////////////////////////////////////////////
+// AccActionBase.h: interface for the CAccActionBase class.
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_)
+#define AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccActionBase  : public CUNOXWrapper
+{
+public:
+    CAccActionBase();
+    virtual ~CAccActionBase();
+
+    // IAccessibleAction
+public:
+    // IAccessibleAction
+
+    // Returns the number of action.
+    STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+    // Performs specified action on the object.
+    STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+    // Gets description of specified action.
+    STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+    // added , 2006/06/28, for driver 07/11
+    // get the action name
+    STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+    // get the localized action Name
+    STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+    // Returns key binding object (if any) associated with specified action
+    // key binding is string.
+    // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+    STDMETHOD(get_keyBinding)(
+        /* [in] */ long actionIndex,
+        /* [in] */ long nMaxBinding,
+        /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+        /* [retval][out] */ long __RPC_FAR *nBinding);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+    static void GetkeyBindingStrByXkeyBinding( const com::sun::star::uno::Sequence< com::sun::star::awt::KeyStroke > &keySet, OLECHAR* pString );
+
+protected:
+
+    static OLECHAR* getOLECHARFromKeyCode(long key);
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleAction> pRXAct;
+
+private:
+    inline com::sun::star::accessibility::XAccessibleAction* GetXInterface()
+    {
+        return pRXAct.get();
+    }
+};
+
+#endif // !defined(AFX_ACCACTIONBASE_H__F87FAD24_D66E_4D22_9B24_3304A303DC84__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccComponent.cpp b/main/winaccessibility/source/UAccCOM/AccComponent.cpp
new file mode 100644
index 0000000..64402ed
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccComponent.cpp
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+/**
+ * AccComponent.cpp : Implementation of CUAccCOMApp and DLL registration.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccComponent.h"
+
+/**
+ * Returns the location of the upper left corner of the object's bounding 
+ * box relative to the parent.
+ * 
+ * @param    Location    the upper left corner of the object's bounding box.
+ */
+STDMETHODIMP CAccComponent::get_locationInParent(long *x, long *y)
+{
+    
+    return CAccComponentBase::get_locationInParent(x,y);
+}
+
+/**
+ * Returns the foreground color of this object.
+ * 
+ * @param    Color    the color of foreground.
+ */
+STDMETHODIMP CAccComponent::get_foreground(IA2Color * foreground)
+{
+    
+    return CAccComponentBase::get_foreground(foreground);
+}
+
+/**
+ * Returns the background color of this object.
+ * 
+ * @param    Color    the color of background.
+ */
+STDMETHODIMP CAccComponent::get_background(IA2Color * background)
+{
+    
+    return CAccComponentBase::get_background(background);
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccComponent::put_XInterface(long pXInterface)
+{
+    
+    return CAccComponentBase::put_XInterface(pXInterface);
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccComponent.h b/main/winaccessibility/source/UAccCOM/AccComponent.h
new file mode 100644
index 0000000..f0bbc5e
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccComponent.h
@@ -0,0 +1,97 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
+#define AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"       // main symbols
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include "UNOXWrapper.h"
+#include "AccComponentBase.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+ * CAccComponent implements IAccessibleComponent interface.
+ */
+class ATL_NO_VTABLE CAccComponent :
+            public CComObjectRoot,
+            public CComCoClass<CAccComponent,&CLSID_AccComponent>,
+            public IAccessibleComponent,
+            public CAccComponentBase
+{
+public:
+    CAccComponent()
+    {
+            }
+    ~CAccComponent()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccComponent)
+    COM_INTERFACE_ENTRY(IAccessibleComponent)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccComponent*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccComponent)
+
+    // IAccessibleComponent
+public:
+    // IAccessibleComponent
+
+    // Returns the location of the upper left corner of the object's bounding
+    // box relative to the parent.
+    STDMETHOD(get_locationInParent)(long *x, long *y);
+
+    // Returns the foreground color of this object.
+    STDMETHOD(get_foreground)(IA2Color * foreground);
+
+    // Returns the background color of this object.
+    STDMETHOD(get_background)(IA2Color * background);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+};
+
+#endif // !defined(AFX_ACCCOMPONENT_H__626D760C_3944_4B0E_BB4D_F0D20AEDF7DC__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccComponent.rgs b/main/winaccessibility/source/UAccCOM/AccComponent.rgs
new file mode 100644
index 0000000..ee87c16
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccComponent.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccComponent.1 = s 'AccComponent Class'
+	{
+		CLSID = s '{9FD9BA47-70AF-4160-99F1-526F2B9F111B}'
+	}
+	UAccCOM.AccComponent = s 'AccComponent Class'
+	{
+		CLSID = s '{9FD9BA47-70AF-4160-99F1-526F2B9F111B}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {9FD9BA47-70AF-4160-99F1-526F2B9F111B} = s 'AccComponent Class'
+		{
+			ProgID = s 'UAccCOM.AccComponent.1'
+			VersionIndependentProgID = s 'UAccCOM.AccComponent'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccComponentBase.cpp b/main/winaccessibility/source/UAccCOM/AccComponentBase.cpp
new file mode 100644
index 0000000..280aed0
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccComponentBase.cpp
@@ -0,0 +1,213 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "AccComponentBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+CAccComponentBase::CAccComponentBase()
+{}
+
+CAccComponentBase::~CAccComponentBase()
+{}
+
+
+/**
+ * Returns the location of the upper left corner of the object's bounding 
+ * box relative to the parent.
+ * 
+ * @param    Location    the upper left corner of the object's bounding box.
+ */
+STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y)
+{
+    
+	CHECK_ENABLE_INF
+
+    try
+    {
+        if (x == NULL || y == NULL)
+            return E_INVALIDARG;
+        // #CHECK XInterface#
+        if(!pRXComp.is())
+            return E_FAIL;
+
+        const ::com::sun::star::awt::Point& pt = GetXInterface()->getLocation();
+        *x = pt.X;
+        *y = pt.Y;
+        return S_OK;
+    }
+    catch(...)
+    {
+        return E_FAIL;
+    }
+}
+
+/**
+ * Returns the location of the upper left corner of the object's bounding 
+ * box in screen.
+ * 
+ * @param    Location    the upper left corner of the object's bounding 
+ *                       box in screen coordinates.
+ */
+STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y)
+{
+    
+	CHECK_ENABLE_INF
+
+    try
+    {
+        if (x == NULL || y == NULL)
+            return E_INVALIDARG;
+        // #CHECK XInterface#
+        if(!pRXComp.is())
+            return E_FAIL;
+
+        const ::com::sun::star::awt::Point& pt = GetXInterface()->getLocationOnScreen();
+        *x = pt.X;
+        *y = pt.Y;
+        return S_OK;
+
+    }
+    catch(...)
+    {
+        return E_FAIL;
+    }
+}
+
+/**
+ * Grabs the focus to this object.
+ * 
+ * @param    success    the boolean result to be returned.
+ */
+STDMETHODIMP CAccComponentBase::grabFocus(boolean * success)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (success == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXComp.is())
+    {
+        return E_FAIL;
+    }
+    GetXInterface()->grabFocus();
+    *success = TRUE;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Returns the foreground color of this object.
+ * 
+ * @param    Color    the color of foreground.
+ */
+STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (foreground == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXComp.is())
+    {
+        return E_FAIL;
+    }
+    *foreground = (long)GetXInterface()->getForeground();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Returns the background color of this object.
+ * 
+ * @param    Color    the color of background.
+ */
+STDMETHODIMP CAccComponentBase::get_background(IA2Color * background)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (background == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXComp.is())
+    {
+        return E_FAIL;
+    }
+    *background = (long)GetXInterface()->getBackground();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccComponentBase::put_XInterface(long pXInterface)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleComponent> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXComp = NULL;
+    else
+        pRXComp = pRXI.get();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccComponentBase.h b/main/winaccessibility/source/UAccCOM/AccComponentBase.h
new file mode 100644
index 0000000..a59f673
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccComponentBase.h
@@ -0,0 +1,78 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+//////////////////////////////////////////////////////////////////////
+// AccComponentBase.h: interface for the CAccComponentBase class.
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_)
+#define AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccComponentBase : public CUNOXWrapper
+{
+public:
+    CAccComponentBase();
+    virtual ~CAccComponentBase();
+    // IAccessibleComponent
+public:
+    // IAccessibleComponent
+
+    // Returns the location of the upper left corner of the object's bounding
+    // box relative to the parent.
+    STDMETHOD(get_locationInParent)(long *x, long *y);
+
+    // Returns the location of the upper left corner of the object's bounding
+    // box in screen.
+    STDMETHOD(get_locationOnScreen)(long *x, long *y);
+
+    // Grabs the focus to this object.
+    STDMETHOD(grabFocus)(boolean * success);
+
+    // Returns the foreground color of this object.
+    STDMETHOD(get_foreground)(IA2Color * foreground);
+
+    // Returns the background color of this object.
+    STDMETHOD(get_background)(IA2Color * background);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+protected:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleComponent> pRXComp;
+
+    inline com::sun::star::accessibility::XAccessibleComponent* GetXInterface()
+    {
+        return pRXComp.get();
+    }
+};
+
+#endif // !defined(AFX_ACCCOMPONENTBASE_H__946BE230_1DCB_494B_ACF6_32A2E197DD2A__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccContext.rgs b/main/winaccessibility/source/UAccCOM/AccContext.rgs
new file mode 100644
index 0000000..b3e9e3a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccContext.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccContext.1 = s 'AccContext Class'
+	{
+		CLSID = s '{F77CAEC2-F04C-4E74-A36C-F3B557BC59E1}'
+	}
+	UAccCOM.AccContext = s 'AccContext Class'
+	{
+		CLSID = s '{F77CAEC2-F04C-4E74-A36C-F3B557BC59E1}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {F77CAEC2-F04C-4E74-A36C-F3B557BC59E1} = s 'AccContext Class'
+		{
+			ProgID = s 'UAccCOM.AccContext.1'
+			VersionIndependentProgID = s 'UAccCOM.AccContext'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccEditableText.cpp b/main/winaccessibility/source/UAccCOM/AccEditableText.cpp
new file mode 100644
index 0000000..42bc928
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccEditableText.cpp
@@ -0,0 +1,508 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+/**
+ * AccEditableText.cpp : Implementation of CUAccCOMApp and DLL registration.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccEditableText.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/awt/FontSlant.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <vector>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+using namespace com::sun::star::beans;
+using namespace std;
+
+/**
+ * Copys a range of text to the clipboard.
+ *
+ * @param    startOffset    the start offset of copying.
+ * @param    endOffset      the end offset of copying.
+ * @param    success        the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::copyText(long startOffset, long endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK XInterface#
+    if(!pRXEdtTxt.is())
+    {
+        return E_FAIL;
+    }
+
+    if ( GetXInterface()->copyText( startOffset, endOffset ) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Deletes a range of text.
+ *
+ * @param    startOffset    the start offset of deleting.
+ * @param    endOffset      the end offset of deleting.
+ * @param    success        the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::deleteText(long startOffset, long endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    if( GetXInterface()->deleteText( startOffset, endOffset ) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Inserts text at a specified offset.
+ *
+ * @param    offset    the offset of inserting.
+ * @param    text      the text to be inserted.
+ * @param    success   the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (text == NULL)
+        return E_INVALIDARG;
+
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    ::rtl::OUString ouStr(*text);
+
+    if( GetXInterface()->insertText( ouStr, offset ) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Cuts a range of text to the clipboard.
+ *
+ * @param    startOffset    the start offset of cuting.
+ * @param    endOffset      the end offset of cuting.
+ * @param    success        the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::cutText(long startOffset, long endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    if( GetXInterface()->cutText( startOffset, endOffset ) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Pastes text from clipboard at specified offset.
+ *
+ * @param    offset    the offset of pasting.
+ * @param    success   the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::pasteText(long offset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    if( GetXInterface()->pasteText( offset ) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Replaces range of text with new text.
+ *
+ * @param    startOffset    the start offset of replacing.
+ * @param    endOffset      the end offset of replacing.
+ * @param    text           the replacing text.
+ * @param    success        the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BSTR * text)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if (text == NULL)
+        return E_INVALIDARG;
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    ::rtl::OUString ouStr(*text);
+
+    if( GetXInterface()->replaceText( startOffset,endOffset, ouStr) )
+        return S_OK;
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Sets attributes of range of text.
+ *
+ * @param    startOffset    the start offset.
+ * @param    endOffset      the end offset.
+ * @param    attributes     the attribute text.
+ * @param    success        the boolean result to be returned.
+ */
+STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, BSTR * attributes)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if (attributes == NULL)
+        return E_INVALIDARG;
+    if( !pRXEdtTxt.is() )
+        return E_FAIL;
+
+    ::rtl::OUString ouStr(*attributes);
+
+    sal_Int32 nIndex = 0;
+    sal_Unicode cTok = ';';
+    vector< ::rtl::OUString > vecAttr;
+    do
+    {
+        ::rtl::OUString ouToken = ouStr.getToken(0, cTok, nIndex);
+        vecAttr.push_back(ouToken);
+    }
+    while(nIndex >= 0);
+
+    Sequence< PropertyValue > beanSeq(vecAttr.size());
+    for(unsigned int i = 0; i < vecAttr.size(); i ++)
+    {
+        ::rtl::OUString attr = vecAttr[i];
+        sal_Int32 nPos = attr.indexOf(':');
+        if(nPos > -1)
+        {
+            ::rtl::OUString attrName = attr.copy(0, nPos);
+            ::rtl::OUString attrValue = attr.copy(nPos + 1, attr.getLength() - nPos - 1);
+            beanSeq[i].Name = attrName;
+            get_AnyFromOLECHAR(attrName, attrValue, beanSeq[i].Value);
+        }
+    }
+
+    if( GetXInterface()->setAttributes( startOffset,endOffset, beanSeq) )
+        return S_OK;
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Convert attributes string to Any type.
+ * Reference to infra\accessibility\bridge\org\openoffice\java\accessibility\AccessibleTextImpl.java
+ *
+ * @param	ouName		the string of attribute name.
+ * @param	ouValue		the string of attribute value.
+ * @param	rAny		the Any object to be returned.
+ */
+void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, Any &rAny)
+{
+    if(ouName.compareTo(L"CharBackColor") == 0 ||
+            ouName.compareTo(L"CharColor") == 0 ||
+            ouName.compareTo(L"ParaAdjust") == 0 ||
+            ouName.compareTo(L"ParaFirstLineIndent") == 0 ||
+            ouName.compareTo(L"ParaLeftMargin") == 0 ||
+            ouName.compareTo(L"ParaRightMargin") == 0 ||
+            ouName.compareTo(L"ParaTopMargin") == 0 ||
+            ouName.compareTo(L"ParaBottomMargin") == 0 ||
+            ouName.compareTo(L"CharFontPitch") == 0)
+    {
+        // Convert to int.
+        // NOTE: CharFontPitch is not implemented in java file.
+        sal_Int32 nValue = ouValue.toInt32();
+        rAny.setValue(&nValue, getCppuType((sal_Int32 *)0));
+    }
+    else if(ouName.compareTo(L"CharShadowed") == 0 ||
+            ouName.compareTo(L"CharContoured") == 0)
+    {
+        // Convert to boolean.
+        boolean nValue = (boolean)ouValue.toBoolean();
+        rAny.setValue(&nValue, getCppuType((sal_Bool *)sal_False));
+    }
+    else if(ouName.compareTo(L"CharEscapement") == 0 ||
+            ouName.compareTo(L"CharStrikeout") == 0 ||
+            ouName.compareTo(L"CharUnderline") == 0 ||
+            ouName.compareTo(L"CharFontPitch") == 0)
+    {
+        // Convert to short.
+        short nValue = (short)ouValue.toInt32();
+        rAny.setValue(&nValue, getCppuType((short *)0));
+    }
+    else if(ouName.compareTo(L"CharHeight") == 0 ||
+            ouName.compareTo(L"CharWeight") == 0)
+    {
+        // Convert to float.
+        float fValue = ouValue.toFloat();
+        rAny.setValue(&fValue, getCppuType((float *)0));
+    }
+    else if(ouName.compareTo(L"CharFontName") == 0)
+    {
+        // Convert to string.
+        rAny.setValue(&ouValue, getCppuType((::rtl::OUString *)0));
+    }
+    else if(ouName.compareTo(L"CharPosture") == 0)
+    {
+        // Convert to FontSlant.
+        ::com::sun::star::awt::FontSlant fontSlant = (::com::sun::star::awt::FontSlant)ouValue.toInt32();
+        rAny.setValue(&fontSlant, getCppuType((::com::sun::star::awt::FontSlant*)0));
+    }
+    else if(ouName.compareTo(L"ParaTabStops") == 0)
+    {
+        //
+        // Convert to the Sequence with TabStop element.
+        vector< ::com::sun::star::style::TabStop > vecTabStop;
+        ::com::sun::star::style::TabStop tabStop;
+        ::rtl::OUString ouSubValue;
+        sal_Int32 nIndex = 0;
+        sal_Int32 pos = 0, posComma = 0;
+
+        do
+        {
+            // Position.
+            pos = ouValue.indexOf(L"Position=", pos);
+            if(pos != -1)
+            {
+                posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "Position=".
+                if(posComma != -1)
+                {
+                    ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+                    tabStop.Position = ouSubValue.toInt32();
+                    pos = posComma + 1;
+
+                    // TabAlign.
+                    pos = ouValue.indexOf(L"TabAlign=", pos);
+                    if(pos != -1)
+                    {
+                        posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
+                        if(posComma != -1)
+                        {
+                            ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+                            tabStop.Alignment = (::com::sun::star::style::TabAlign)ouSubValue.toInt32();
+                            pos = posComma + 1;
+
+                            // DecimalChar.
+                            pos = ouValue.indexOf(L"DecimalChar=", pos);
+                            if(pos != -1)
+                            {
+                                posComma = ouValue.indexOf(',', pos + 11); // 11 = length of "TabAlign=".
+                                if(posComma != -1)
+                                {
+                                    ouSubValue = ouValue.copy(pos + 11, posComma - pos - 11);
+                                    tabStop.DecimalChar = (sal_Unicode)ouSubValue.toChar();
+                                    pos = posComma + 1;
+
+                                    // FillChar.
+                                    pos = ouValue.indexOf(L"FillChar=", pos);
+                                    if(pos != -1)
+                                    {
+                                        posComma = ouValue.indexOf(',', pos + 9); // 9 = length of "TabAlign=".
+                                        if(posComma != -1)
+                                        {
+                                            ouSubValue = ouValue.copy(pos + 9, posComma - pos - 9);
+                                            tabStop.DecimalChar = (sal_Unicode)ouSubValue.toChar();
+                                            pos = posComma + 1;
+
+                                            // Complete TabStop element.
+                                            vecTabStop.push_back(tabStop);
+                                        }
+                                        else
+                                            break;	// No match comma.
+                                    }
+                                    else
+                                        break;	// No match FillChar.
+                                }
+                                else
+                                    break;	// No match comma.
+                            }
+                            else
+                                break;	// No match DecimalChar.
+                        }
+                        else
+                            break;	// No match comma.
+                    }
+                    else
+                        break;	// No match TabAlign.
+                }
+                else
+                    break;	// No match comma.
+            }
+            else
+                break;	// No match Position.
+        }
+        while(pos < ouValue.getLength());
+
+        //
+        // Dump into Sequence.
+        int iSeqLen = (vecTabStop.size() == 0) ? 1 : vecTabStop.size();
+        Sequence< ::com::sun::star::style::TabStop > seqTabStop(iSeqLen);
+
+        if(vecTabStop.size() != 0)
+        {
+            // Dump every element.
+            for(int i = 0; i < iSeqLen; i ++)
+            {
+                seqTabStop[i] = vecTabStop[i];
+            }
+        }
+        else
+        {
+            // Create default value.
+            seqTabStop[0].Position = 0;
+            seqTabStop[0].Alignment = ::com::sun::star::style::TabAlign_DEFAULT;
+            seqTabStop[0].DecimalChar = '.';
+            seqTabStop[0].FillChar = ' ';
+        }
+
+        // Assign to Any object.
+        rAny.setValue(&seqTabStop, getCppuType((Sequence< ::com::sun::star::style::TabStop >*)0));
+    }
+    else if(ouName.compareTo(L"ParaLineSpacing") == 0)
+    {
+        // Parse value string.
+        ::com::sun::star::style::LineSpacing lineSpacing;
+        ::rtl::OUString ouSubValue;
+        sal_Int32 pos = 0, posComma = 0;
+
+        pos = ouValue.indexOf(L"Mode=", pos);
+        if(pos != -1)
+        {
+            posComma = ouValue.indexOf(',', pos + 5); // 5 = length of "Mode=".
+            if(posComma != -1)
+            {
+                ouSubValue = ouValue.copy(pos + 5, posComma - pos - 5);
+                lineSpacing.Mode = (sal_Int16)ouSubValue.toInt32();
+                pos = posComma + 1;
+
+                pos = ouValue.indexOf(L"Height=", pos);
+                if(pos != -1)
+                {
+                    ouSubValue = ouValue.copy(pos + 7, ouValue.getLength() - pos - 7);
+                    lineSpacing.Height = (sal_Int16)ouSubValue.toInt32();
+                }
+                else
+                {
+                    lineSpacing.Height = (sal_Int16)100;	// Default height.
+                }
+            }
+            else
+            {
+                lineSpacing.Height = (sal_Int16)100;	// Default height.
+            }
+        }
+        else
+        {
+            // Default Mode and Height.
+            lineSpacing.Mode = (sal_Int16)0;
+            lineSpacing.Height = (sal_Int16)100;	// Default height.
+        }
+
+        // Convert to Any object.
+        rAny.setValue(&lineSpacing, getCppuType((::com::sun::star::style::LineSpacing* )0));
+    }
+    else
+    {
+        // Do nothing.
+        sal_Int32 nDefault = 0;
+        rAny.setValue(&nDefault, getCppuType((sal_Int32 *)0));
+    }
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccEditableText::put_XInterface(long pXInterface)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleEditableText> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXEdtTxt = NULL;
+    else
+        pRXEdtTxt = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccEditableText.h b/main/winaccessibility/source/UAccCOM/AccEditableText.h
new file mode 100644
index 0000000..0e43024
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccEditableText.h
@@ -0,0 +1,115 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
+#define AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccEditableText implements IAccessibleEditableText interface.
+ */
+class CAccEditableText :
+            public CComObjectRoot,
+            public CComCoClass<CAccEditableText,&CLSID_AccEditableText>,
+            public IAccessibleEditableText,
+            public CUNOXWrapper
+{
+public:
+    CAccEditableText()
+    {
+        
+    }
+    virtual ~CAccEditableText()
+    {
+        
+    }
+
+    BEGIN_COM_MAP(CAccEditableText)
+    COM_INTERFACE_ENTRY(IAccessibleEditableText)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccEditableText*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccEditableText)
+
+    // IAccessibleEditableText
+public:
+    // IAccessibleEditableText
+
+    // Copys a range of text to the clipboard.
+    STDMETHOD(copyText)(long startOffset, long endOffset);
+
+    // Deletes a range of text.
+    STDMETHOD(deleteText)(long startOffset, long endOffset);
+
+    // Inserts text at a specified offset.
+    STDMETHOD(insertText)(long offset, BSTR * text);
+
+    // Cuts a range of text to the clipboard.
+    STDMETHOD(cutText)(long startOffset, long endOffset);
+
+    // Pastes text from clipboard at specified offset.
+    STDMETHOD(pasteText)(long offset);
+
+    // Replaces range of text with new text.
+    STDMETHOD(replaceText)(long startOffset, long endOffset, BSTR * text);
+
+
+    // Sets attributes of range of text.
+    STDMETHOD(setAttributes)(long startOffset, long endOffset, BSTR * attributes);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleEditableText> pRXEdtTxt;
+
+    void get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const ::rtl::OUString &ouValue, com::sun::star::uno::Any &rAny);
+
+    inline com::sun::star::accessibility::XAccessibleEditableText* GetXInterface()
+    {
+        return pRXEdtTxt.get();
+    }
+};
+
+#endif // !defined(AFX_ACCEDITABLETEXT_H__0C41AFBE_5A87_4D9D_A284_CEC264D91F81__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccEditableText.rgs b/main/winaccessibility/source/UAccCOM/AccEditableText.rgs
new file mode 100644
index 0000000..03aacb3
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccEditableText.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccEditableText.1 = s 'AccEditableText Class'
+	{
+		CLSID = s '{79CE1450-1F61-48E2-BF76-C07BD10105E2}'
+	}
+	UAccCOM.AccEditableText = s 'AccEditableText Class'
+	{
+		CLSID = s '{79CE1450-1F61-48E2-BF76-C07BD10105E2}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {79CE1450-1F61-48E2-BF76-C07BD10105E2} = s 'AccEditableText Class'
+		{
+			ProgID = s 'UAccCOM.AccEditableText.1'
+			VersionIndependentProgID = s 'UAccCOM.AccEditableText'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs b/main/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs
new file mode 100644
index 0000000..6039885
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccExtendedComponent.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccExtendedComponent.1 = s 'AccExtendedComponent Class'
+	{
+		CLSID = s '{D91562E1-BE6C-41F3-A34C-E7AA846561A4}'
+	}
+	UAccCOM.AccExtendedComponent = s 'AccExtendedComponent Class'
+	{
+		CLSID = s '{D91562E1-BE6C-41F3-A34C-E7AA846561A4}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {D91562E1-BE6C-41F3-A34C-E7AA846561A4} = s 'AccExtendedComponent Class'
+		{
+			ProgID = s 'UAccCOM.AccExtendedComponent.1'
+			VersionIndependentProgID = s 'UAccCOM.AccExtendedComponent'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccFont.rgs b/main/winaccessibility/source/UAccCOM/AccFont.rgs
new file mode 100644
index 0000000..c229746
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccFont.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccFont.1 = s 'AccFont Class'
+	{
+		CLSID = s '{185B9AD9-5D31-4793-888F-A21846BBAEDD}'
+	}
+	UAccCOM.AccFont = s 'AccFont Class'
+	{
+		CLSID = s '{185B9AD9-5D31-4793-888F-A21846BBAEDD}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {185B9AD9-5D31-4793-888F-A21846BBAEDD} = s 'AccFont Class'
+		{
+			ProgID = s 'UAccCOM.AccFont.1'
+			VersionIndependentProgID = s 'UAccCOM.AccFont'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccHyperLink.cpp b/main/winaccessibility/source/UAccCOM/AccHyperLink.cpp
new file mode 100644
index 0000000..1f0c095
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHyperLink.cpp
@@ -0,0 +1,296 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccHyperLink.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::awt;
+
+/**
+ * Returns the number of action.
+ *
+ * @param    nActions    the number of action.
+ */
+STDMETHODIMP CAccHyperLink::nActions(/*[out,retval]*/long* nActions)
+{
+    
+    return CAccActionBase::nActions(nActions);
+}
+
+/**
+ * Performs specified action on the object.
+ *
+ * @param    actionIndex    the index of action.
+ */
+STDMETHODIMP CAccHyperLink::doAction(/* [in] */ long actionIndex)
+{
+    
+    return CAccActionBase::doAction(actionIndex);
+}
+
+/**
+ * Gets description of specified action.
+ *
+ * @param    actionIndex    the index of action.
+ * @param    description    the description string of the specified action.
+ */
+STDMETHODIMP CAccHyperLink::get_description(long actionIndex,BSTR __RPC_FAR *description)
+{
+    
+    return CAccActionBase::get_description(actionIndex, description);
+}
+
+STDMETHODIMP CAccHyperLink::get_name( long actionIndex, BSTR __RPC_FAR *name)
+{
+    
+    return CAccActionBase::get_name(actionIndex, name);
+}
+
+STDMETHODIMP CAccHyperLink::get_localizedName( long actionIndex, BSTR __RPC_FAR *localizedName)
+{
+    
+    return CAccActionBase::get_name(actionIndex, localizedName);
+}
+
+/**
+ * Returns key binding object (if any) associated with specified action 
+ * key binding is string.
+ * e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+ *
+ * @param    actionIndex    the index of action.
+ * @param    nMaxBinding    the max number of key binding.
+ * @param    keyBinding     the key binding array.
+ * @param    nBinding       the actual number of key binding returned.
+ */
+STDMETHODIMP CAccHyperLink::get_keyBinding(
+    /* [in] */ long actionIndex,
+    /* [in] */ long nMaxBinding,
+    /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+    /* [retval][out] */ long __RPC_FAR *nBinding)
+{
+    
+    return CAccActionBase::get_keyBinding(actionIndex, nMaxBinding,	keyBinding, nBinding);
+}
+
+/**
+   * get an object
+   * @param 
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index,
+        /* [retval][out] */ VARIANT __RPC_FAR *anchor)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(anchor == NULL)
+    {
+        return E_INVALIDARG;
+    }
+    // #CHECK XInterface#
+    if(!pRXLink.is())
+    {
+        return E_FAIL;
+    }
+    // Get Any type value via pRXLink.
+    ::com::sun::star::uno::Any	anyVal = GetXInterface()->getAccessibleActionAnchor(index);
+    // Convert Any to VARIANT.
+    CMAccessible::ConvertAnyToVariant(anyVal, anchor);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * get an object
+   * @param 
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index,
+        /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget)
+{
+    
+
+	CHECK_ENABLE_INF
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(anchorTarget == NULL)
+    {
+        return E_INVALIDARG;
+    }
+    // #CHECK XInterface#
+    if(!pRXLink.is())
+    {
+        return E_FAIL;
+    }
+    // Get Any type value via pRXLink.
+    ::com::sun::star::uno::Any	anyVal = GetXInterface()->getAccessibleActionObject(index);
+    // Convert Any to VARIANT.
+    CMAccessible::ConvertAnyToVariant(anyVal, anchorTarget);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+
+/**
+   * Get start index.
+   * @param index Variant to get start index.
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(index == NULL)
+    {
+        return E_INVALIDARG;
+    }
+    *index = GetXInterface()->getStartIndex();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get start index.
+   * @param index Variant to get end index.
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(index == NULL)
+    {
+        return E_INVALIDARG;
+    }
+    // #CHECK XInterface#
+    if(!pRXLink.is())
+    {
+        return E_FAIL;
+    }
+    *index = GetXInterface()->getEndIndex();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Judge if the hyperlink is valid.
+   * @param valid Variant to get validity.
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(valid == NULL)
+    {
+        return E_INVALIDARG;
+    }
+    // #CHECK XInterface#
+    if(!pRXLink.is())
+    {
+        return E_FAIL;
+    }
+    *valid = GetXInterface()->isValid();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put UNO interface.
+   * @param pXInterface XAccessibleContext interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::put_XInterface(long pXInterface)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    CAccActionBase::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface != NULL)
+    {
+        Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+        if( !pRContext.is() )
+        {
+            return E_FAIL;
+        }
+        Reference<XAccessibleHyperlink> pRXI(pRContext,UNO_QUERY);
+        if( !pRXI.is() )
+        {
+            pRXLink = NULL;
+        }
+        else
+            pRXLink = pRXI.get();
+    }
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put UNO interface.
+   * @param pXSubInterface XAccessibleHyperlink interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccHyperLink::put_XSubInterface(long pXSubInterface)
+{
+    
+	CHECK_ENABLE_INF
+
+    pRXLink = (XAccessibleHyperlink*)pXSubInterface;
+    pRXAct = (XAccessibleAction*)pXSubInterface;
+
+    return S_OK;
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccHyperLink.h b/main/winaccessibility/source/UAccCOM/AccHyperLink.h
new file mode 100644
index 0000000..8fe6700
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHyperLink.h
@@ -0,0 +1,140 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_)
+#define AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"       // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include "AccActionBase.h"
+#include "UNOXWrapper.h"
+
+/**
+ * CAccHyperLink implements IAccessibleHyperlink interface.
+ */
+class ATL_NO_VTABLE CAccHyperLink :
+            public CComObjectRoot,
+            public CComCoClass<CAccHyperLink,&CLSID_AccHyperLink>,
+            public IAccessibleHyperlink,
+            public CAccActionBase
+{
+public:
+    CAccHyperLink()
+    {
+            }
+    ~CAccHyperLink()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccHyperLink)
+    COM_INTERFACE_ENTRY(IAccessibleAction)
+    COM_INTERFACE_ENTRY(IAccessibleHyperlink)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    END_COM_MAP()
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccHyperLink)
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccHyperLink*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    // IAccessibleHyperlink
+public:
+    // IAccessibleAction
+
+    // Returns the number of action.
+    STDMETHOD(nActions)(/*[out,retval]*/long* nActions);
+
+    // Performs specified action on the object.
+    STDMETHOD(doAction)(/* [in] */ long actionIndex);
+
+    // get the action name
+    STDMETHOD(get_name)( long actionIndex, BSTR __RPC_FAR *name);
+
+    // get the localized action name
+    STDMETHOD(get_localizedName)( long actionIndex, BSTR __RPC_FAR *localizedName);
+
+    // Gets description of specified action.
+    STDMETHOD(get_description)(long actionIndex,BSTR __RPC_FAR *description);
+
+    // Returns key binding object (if any) associated with specified action
+    // key binding is string.
+    // e.g. "alt+d" (like IAccessible::get_accKeyboardShortcut).
+    STDMETHOD(get_keyBinding)(
+        /* [in] */ long actionIndex,
+        /* [in] */ long nMaxBinding,
+        /* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
+        /* [retval][out] */ long __RPC_FAR *nBinding);
+
+    // IAccessibleHyperlink
+
+    // get an object, e.g. BSTR or image object, that is overloaded with link behavior
+    STDMETHOD(get_anchor)(/* [in] */ long index,
+                                     /* [retval][out] */ VARIANT __RPC_FAR *anchor);
+
+    // get an object representing the target of the link, usually a BSTR of the URI
+    STDMETHOD(get_anchorTarget)(/* [in] */ long index,
+                                           /* [retval][out] */ VARIANT __RPC_FAR *anchorTarget);
+
+    // Returns the index at which the textual representation of the
+    // hyperlink (group) starts.
+    STDMETHOD(get_startIndex)(/* [retval][out] */ long __RPC_FAR *index);
+
+    // Returns the index at which the textual rerpesentation of the
+    // hyperlink (group) ends.
+    STDMETHOD(get_endIndex)(/* [retval][out] */ long __RPC_FAR *index);
+
+    // Returns whether the document referenced by this links is still valid.
+    STDMETHOD(get_valid)(/* [retval][out] */ boolean __RPC_FAR *valid);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHyperlink> pRXLink;
+
+    inline com::sun::star::accessibility::XAccessibleHyperlink* GetXInterface()
+    {
+        return pRXLink.get();
+    }
+
+};
+
+#endif // !defined(AFX_ACCHYPERLINK_H__59DA79A5_A895_43DB_9495_2B2049CF5C65__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccHyperLink.rgs b/main/winaccessibility/source/UAccCOM/AccHyperLink.rgs
new file mode 100644
index 0000000..ceb622e
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHyperLink.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccHyperLink.1 = s 'AccHyperLink Class'
+	{
+		CLSID = s '{519A64CD-F6A6-4793-BE50-4E36C4C593EF}'
+	}
+	UAccCOM.AccHyperLink = s 'AccHyperLink Class'
+	{
+		CLSID = s '{519A64CD-F6A6-4793-BE50-4E36C4C593EF}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {519A64CD-F6A6-4793-BE50-4E36C4C593EF} = s 'AccHyperLink Class'
+		{
+			ProgID = s 'UAccCOM.AccHyperLink.1'
+			VersionIndependentProgID = s 'UAccCOM.AccHyperLink'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccHypertext.cpp b/main/winaccessibility/source/UAccCOM/AccHypertext.cpp
new file mode 100644
index 0000000..29ac8bf
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHypertext.cpp
@@ -0,0 +1,409 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccHypertext.h"
+
+#include "act.hxx"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/////////////////////////////////////////////////////////////////////////////
+//
+/**
+   * Get special selection.
+   * @param startOffset Start selection offset.
+   * @param endOffset   End selection offset.
+   * @param success     Variant to accept the result of if the method call is successful.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::addSelection(long startOffset, long endOffset)
+{
+    
+    return CAccTextBase::get_addSelection(startOffset, endOffset);
+}
+
+
+/**
+   * Get special attributes.
+   * @param offset Offset.
+   * @param startOffset Variant to accept start offset.
+   * @param endOffset   Variant to accept end offset.
+   * @param textAttributes     Variant to accept attributes.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+    
+    return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
+}
+
+/**
+   * Get caret position.
+   * @param offset     Variant to accept caret offset.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_caretOffset(long * offset)
+{
+    
+    return CAccTextBase::get_caretOffset(offset);
+}
+
+/**
+   * Get character count.
+   * @param nCharacters  Variant to accept character count.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_characterCount(long * nCharacters)
+{
+    
+    return CAccTextBase::get_characterCount(nCharacters);
+}
+
+/**
+   * Get character extents.
+   * @param offset  Offset.
+   * @param x Variant to accpet x position.
+   * @param y Variant to accpet y position.
+   * @param width Variant to accpet width.
+   * @param Height Variant to accpet height.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+    
+    return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
+}
+
+/**
+   * Get slections count.
+   * @param nSelections Variant to accpet slections count.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nSelections(long * nSelections)
+{
+    
+    return CAccTextBase::get_nSelections(nSelections);
+}
+
+/**
+   * Get offset of some special point.
+   * @param x X position of one point.
+   * @param x Y position of one point.
+   * @param coordType Type.
+   * @param offset Variant to accept offset.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
+{
+    return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset);
+}
+
+/**
+   * Get selection range.
+   * @param selection selection count.
+   * @param startOffset Variant to accept the start offset of special selection.
+   * @param endOffset Variant to accept the end offset of special selection.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_selection(long selection, long * startOffset, long * endOffset)
+{
+    
+    return CAccTextBase::get_selection(selection, startOffset, endOffset);
+}
+
+/**
+   * Get special text.
+   * @param startOffset Start position of special range.
+   * @param endOffset   End position of special range.
+   * @param text        Variant to accept the text of special range.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_text(long startOffset, long endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_text(startOffset, endOffset, text);
+}
+
+/**
+   * Get special text before some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
+            startOffset, endOffset, text);
+}
+
+/**
+   * Get special text after some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textAfterOffset(offset, boundaryType,
+            startOffset, endOffset, text);
+}
+
+/**
+   * Get special text at some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textAtOffset(offset, boundaryType,
+                                          startOffset, endOffset, text);
+}
+
+/**
+   * Remove selection.
+   * @param selectionIndex Special selection index
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::removeSelection(long selectionIndex)
+{
+    
+    return CAccTextBase::removeSelection(selectionIndex);
+}
+
+/**
+   * Set caret position.
+   * @param offset Special position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::setCaretOffset(long offset)
+{
+    
+    return CAccTextBase::setCaretOffset(offset);
+}
+
+/**
+   * Set special selection.
+   * @param selectionIndex Special selection index.
+   * @param startOffset start position.
+   * @param endOffset end position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::setSelection(long selectionIndex, long startOffset, long endOffset)
+{
+    
+    return CAccTextBase::setSelection(selectionIndex, startOffset,
+                                      endOffset);
+}
+
+/**
+   * Get characters count.
+   * @param nCharacters Variant to accept the characters count.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nCharacters(long * nCharacters)
+{
+    
+    return CAccTextBase::get_nCharacters(nCharacters);
+}
+
+STDMETHODIMP CAccHypertext::get_newText( IA2TextSegment *newText)
+{
+    return CAccTextBase::get_newText(newText);
+}
+
+STDMETHODIMP CAccHypertext::get_oldText( IA2TextSegment *oldText)
+{
+    return CAccTextBase::get_oldText(oldText);
+}
+
+/**
+   * Scroll to special sub-string .
+   * @param startIndex Start index of sub string.
+   * @param endIndex   End index of sub string.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
+{
+    
+    return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
+}
+STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
+{
+    
+    return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType);
+}
+
+/**
+   * Get hyperlink count.
+   * @param hyperlinkCount Variant to accpet hyperlink count.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(hyperlinkCount == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pHyperText.is())
+    {
+        return E_FAIL;
+    }
+
+    *hyperlinkCount = pHyperText->getHyperLinkCount();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special hyperlink.
+   * @param index Special hyperlink index.
+   * @param hyperlink Variant to accept special hyperlink via index.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hyperlink)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(hyperlink == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pHyperText.is())
+    {
+        return E_FAIL;
+    }
+
+    Reference<XAccessibleHyperlink> pRLink = pHyperText->getHyperLink(index);
+    if(!pRLink.is())
+    {
+        *hyperlink = NULL;
+        return E_FAIL;
+    }
+
+    IAccessibleHyperlink* plink = NULL;
+	ActivateActContext();
+	HRESULT hr = CoCreateInstance( CLSID_AccHyperLink, NULL, CLSCTX_SERVER ,
+                                   IID_IAccessibleHyperlink,
+                                   (void **)&plink);
+	DeactivateActContext();
+    if( SUCCEEDED(hr) )
+    {
+        IUNOXWrapper* wrapper = NULL;
+        plink->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+        if(wrapper)
+        {
+            wrapper->put_XSubInterface((long)pRLink.get()/*pXI*/);
+            wrapper->Release();
+        }
+        *hyperlink = plink;
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Returns the index of the hyperlink that is associated with this character index.
+   * @param charIndex Special char index.
+   * @param hyperlinkIndex Variant to accept special hyperlink index.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(hyperlinkIndex == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pHyperText.is())
+    {
+        return E_FAIL;
+    }
+
+    *hyperlinkIndex = pHyperText->getHyperLinkIndex(charIndex);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put UNO interface.
+   * @param pXInterface UNO interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccHypertext::put_XInterface(long pXInterface)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    CAccTextBase::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleHypertext> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pHyperText = NULL;
+    else
+        pHyperText = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccHypertext.h b/main/winaccessibility/source/UAccCOM/AccHypertext.h
new file mode 100644
index 0000000..767eaa7
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHypertext.h
@@ -0,0 +1,161 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_)
+#define AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"       // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleHypertext.hpp>
+#include "AccTextBase.h"
+
+/**
+ * CAccHypertext implements IAccessibleHypertext interface.
+ */
+class ATL_NO_VTABLE CAccHypertext :
+            public CComObjectRoot,
+            public CComCoClass<CAccHypertext,&CLSID_AccHypertext>,
+            public IAccessibleHypertext,
+            public CAccTextBase
+{
+public:
+    CAccHypertext()
+    {
+            }
+    ~CAccHypertext()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccHypertext)
+    COM_INTERFACE_ENTRY(IAccessibleText)
+    COM_INTERFACE_ENTRY(IAccessibleHypertext)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccHypertext*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccHypertext)
+
+    // IAccessibleHypertext
+public:
+    // IAccessibleText
+
+    // Adds a text selection.
+    STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success)
+
+    // Gets text attributes.
+    STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+    // Gets caret offset.
+    STDMETHOD(get_caretOffset)(long * offset);
+
+    // Gets total number of characters.
+    STDMETHOD(get_characterCount)(long * nCharacters);
+
+    // Gets bounding rect containing the glyph(s) representing the character
+    // at the specified text offset
+    STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+    // Gets number of active non-contiguous selections.
+    STDMETHOD(get_nSelections)(long * nSelections);
+
+    // Gets bounding rect for the glyph at a certain point.
+    STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+    // Gets character offsets of N-th active text selection.
+    STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset);
+
+    // Gets a range of text by offset NOTE: returned string may be longer
+    // than endOffset-startOffset bytes if text contains multi-byte characters.
+    STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+    // Gets a specified amount of text that ends before a specified offset.
+    STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that spans the specified offset.
+    STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that starts after a specified offset.
+    STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Unselects a range of text.
+    STDMETHOD(removeSelection)(long selectionIndex);
+
+    // Moves text caret.
+    STDMETHOD(setCaretOffset)(long offset);
+
+    // Changes the bounds of an existing selection.
+    STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);
+
+    // Gets total number of characters.
+    // NOTE: this may be different than the total number of bytes required
+    // to store the text, if the text contains multi-byte characters.
+    STDMETHOD(get_nCharacters)(long * nCharacters);
+
+    // Makes specific part of string visible on screen.
+    STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+
+    STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+    STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+    STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+    //IAccessibleHypertext
+
+    // Gets the number of hyperlink.
+    STDMETHOD(get_nHyperlinks)(long *hyperlinkCount);
+
+    // Gets the hyperlink object via specified index.
+    STDMETHOD(get_hyperlink)(long index,IAccessibleHyperlink **hyperlink);
+
+    // Returns the index of the hyperlink that is associated with this
+    // character index.
+    STDMETHOD(get_hyperlinkIndex)(long charIndex, long *hyperlinkIndex);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleHypertext> pHyperText;
+
+};
+
+#endif // !defined(AFX_ACCHYPERTEXT_H__6DC133B6_03DB_42C6_A9B7_27AF4FDA00CA__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccHypertext.rgs b/main/winaccessibility/source/UAccCOM/AccHypertext.rgs
new file mode 100644
index 0000000..6baf544
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccHypertext.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccHypertext.1 = s 'AccHypertext Class'
+	{
+		CLSID = s '{CC55D71B-1828-4EE0-89E2-C3749CF9C9AB}'
+	}
+	UAccCOM.AccHypertext = s 'AccHypertext Class'
+	{
+		CLSID = s '{CC55D71B-1828-4EE0-89E2-C3749CF9C9AB}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {CC55D71B-1828-4EE0-89E2-C3749CF9C9AB} = s 'AccHypertext Class'
+		{
+			ProgID = s 'UAccCOM.AccHypertext.1'
+			VersionIndependentProgID = s 'UAccCOM.AccHypertext'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccImage.cpp b/main/winaccessibility/source/UAccCOM/AccImage.cpp
new file mode 100644
index 0000000..e02da4a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccImage.cpp
@@ -0,0 +1,102 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccImage.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+   * Get description.
+   * @param description Variant to get description.
+   * @return Result.
+*/
+STDMETHODIMP CAccImage::get_description(BSTR * description)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if (description == NULL)
+        return E_INVALIDARG;
+    if( !pRXImg.is() )
+        return E_FAIL;
+
+    ::rtl::OUString ouStr = GetXInterface()->getAccessibleImageDescription();
+    SAFE_SYSFREESTRING(*description);
+    *description = SysAllocString((OLECHAR*)ouStr.getStr());
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccImage::get_imagePosition(
+    /* [in] */ enum IA2CoordinateType,
+    /* [out] */ long __RPC_FAR *,
+    /* [retval][out] */ long __RPC_FAR *)
+{
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccImage::get_imageSize(
+    /* [out] */ long __RPC_FAR *,
+    /* [retval][out] */ long __RPC_FAR *)
+{
+    return E_NOTIMPL;
+}
+
+/**
+   * Put UNO interface.
+   * @param pXInterface UNO interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccImage::put_XInterface(long pXInterface)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleImage> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXImg = NULL;
+    else
+        pRXImg = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccImage.h b/main/winaccessibility/source/UAccCOM/AccImage.h
new file mode 100644
index 0000000..17514b4
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccImage.h
@@ -0,0 +1,101 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
+#define AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"        // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccImage implements IAccessibleImage interface.
+ */
+class ATL_NO_VTABLE CAccImage :
+            public CComObjectRoot,
+            public CComCoClass<CAccImage,&CLSID_AccImage>,
+            public IAccessibleImage,
+            public CUNOXWrapper
+{
+public:
+    CAccImage()
+    {
+            }
+    virtual ~CAccImage()
+    {
+            }
+    BEGIN_COM_MAP(CAccImage)
+    COM_INTERFACE_ENTRY(IAccessibleImage)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccImage*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccImage)
+
+    // IAccessibleImage
+public:
+    // IAccessibleImage
+
+    // Gets the description of the image.
+    STDMETHOD(get_description)(BSTR * description);
+
+    STDMETHOD(get_imagePosition)( enum IA2CoordinateType coordinateType,
+                                  long __RPC_FAR *x,
+                                  long __RPC_FAR *y);
+
+    STDMETHOD(get_imageSize)(
+        long __RPC_FAR *height,
+        long __RPC_FAR *width);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleImage> pRXImg;
+
+    inline com::sun::star::accessibility::XAccessibleImage* GetXInterface()
+    {
+        return pRXImg.get();
+    }
+};
+
+#endif // !defined(AFX_ACCIMAGE_H__D5E55275_CCD4_497F_8E77_F9B391D2F4A8__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccImage.rgs b/main/winaccessibility/source/UAccCOM/AccImage.rgs
new file mode 100644
index 0000000..9be96fd
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccImage.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccImage.1 = s 'AccImage Class'
+	{
+		CLSID = s '{73A45800-7A62-432C-A1A6-BF8852994331}'
+	}
+	UAccCOM.AccImage = s 'AccImage Class'
+	{
+		CLSID = s '{73A45800-7A62-432C-A1A6-BF8852994331}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {73A45800-7A62-432C-A1A6-BF8852994331} = s 'AccImage Class'
+		{
+			ProgID = s 'UAccCOM.AccImage.1'
+			VersionIndependentProgID = s 'UAccCOM.AccImage'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccKeyBinding.rgs b/main/winaccessibility/source/UAccCOM/AccKeyBinding.rgs
new file mode 100644
index 0000000..6967bf2
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccKeyBinding.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccKeyBinding.1 = s 'AccKeyBinding Class'
+	{
+		CLSID = s '{98AFE6FB-D748-4313-B4D6-E7B273B6255D}'
+	}
+	UAccCOM.AccKeyBinding = s 'AccKeyBinding Class'
+	{
+		CLSID = s '{98AFE6FB-D748-4313-B4D6-E7B273B6255D}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {98AFE6FB-D748-4313-B4D6-E7B273B6255D} = s 'AccKeyBinding Class'
+		{
+			ProgID = s 'UAccCOM.AccKeyBinding.1'
+			VersionIndependentProgID = s 'UAccCOM.AccKeyBinding'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccRelation.cpp b/main/winaccessibility/source/UAccCOM/AccRelation.cpp
new file mode 100644
index 0000000..9d6bcea
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccRelation.cpp
@@ -0,0 +1,214 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccRelation.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+   * Get relation type.
+   * @param relationType Variant to get relation type.
+   * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_relationType(BSTR * relationType)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (relationType == NULL)
+        return E_INVALIDARG;
+
+    int type = relation.RelationType;
+    SAFE_SYSFREESTRING(*relationType);
+
+    *relationType = getRelationTypeBSTR(type);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+// Gets what the type of localized relation is.
+STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR *)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get targets length.
+   * @param nTargets Variant to get targets length.
+   * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+	CHECK_ENABLE_INF
+    if (nTargets == NULL)
+        return E_INVALIDARG;
+
+    Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+    *nTargets = xTargets.getLength();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special target.
+   * @param targetIndex target index.
+   * @param target      Variant to get special target.
+   * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown * * target)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (target == NULL)
+        return E_FAIL;
+
+    Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+    int nCount = xTargets.getLength();
+    if( targetIndex >= nCount )
+        return E_FAIL;
+
+    Reference<XInterface> pRAcc = xTargets[targetIndex];
+    IAccessible* pRet = NULL;
+
+    BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+    if(isGet)
+    {
+        *target = /*(IAccessible2 *)*/(IUnknown*)pRet;
+        pRet->AddRef();
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special targets.
+   * @param maxTargets Special targets count.
+   * @param target Variant to get special target.
+   * @param nTargets Variant to accept actual target length.
+   * @return Result.
+*/
+STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * target, long * nTargets)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(target == NULL)
+        return E_INVALIDARG;
+    if (nTargets == NULL)
+        return E_INVALIDARG;
+
+    Sequence< Reference< XInterface > > xTargets = relation.TargetSet;
+    int nCount = xTargets.getLength();
+
+    *target = (IUnknown*)::CoTaskMemAlloc(nCount*sizeof(IUnknown));
+
+    // #CHECK Memory Allocation#
+    if(*target == NULL)
+    {
+        return E_FAIL;
+    }
+
+    for(int i=0; i<nCount ; i++)
+    {
+        IUnknown* pAcc = NULL;
+        HRESULT hr = get_target(i,&pAcc);
+        if(SUCCEEDED(hr))
+            target[i] = pAcc;
+    }
+
+    *nTargets = nCount;
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put UNO interface.
+   * @param pXSubInterface AccessibleRelation pointer.
+   * @return Result.
+*/
+STDMETHODIMP CAccRelation::put_XSubInterface(long pXSubInterface)
+{
+    
+    relation = *((AccessibleRelation*)pXSubInterface);
+    return S_OK;
+}
+
+/**
+   * Get relation type string by type.
+   * @param type Relation type.
+   * @return relation type string.
+*/
+BSTR CAccRelation::getRelationTypeBSTR(int type)
+{
+    static struct TYPE_BSTR_MAP
+    {
+        LPCTSTR string;
+        int type;
+    }
+    map[] =
+        {
+            {_T("INVALID")				,	0},
+            {IA2_RELATION_FLOWS_FROM	,	1},
+            {IA2_RELATION_FLOWS_TO		,	2},
+            {IA2_RELATION_CONTROLLED_BY	,	3},
+            {IA2_RELATION_CONTROLLER_FOR,	4},
+            {IA2_RELATION_LABEL_FOR		,	5},
+            {IA2_RELATION_LABELED_BY	,	6},
+            {IA2_RELATION_MEMBER_OF		,	7},
+            {IA2_RELATION_SUBWINDOW_OF	,	8},
+			{IA2_RELATION_NODE_CHILD_OF,	9},

+            {IA2_RELATION_DESCRIBED_BY	,	10},
+        };
+
+    USES_CONVERSION;
+
+    return (type >= 0 && type <= 10) ? T2BSTR(map[type].string) : _T("");
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccRelation.h b/main/winaccessibility/source/UAccCOM/AccRelation.h
new file mode 100644
index 0000000..075b7e2
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccRelation.h
@@ -0,0 +1,88 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCRELATION_H_
+#define __ACCRELATION_H_
+
+#include "resource.h"       // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccRelation implements IAccessibleRelation interface.
+ */
+class ATL_NO_VTABLE CAccRelation :
+            public CComObjectRoot,
+            public CComCoClass<CAccRelation, &CLSID_AccRelation>,
+            public IAccessibleRelation,
+            public CUNOXWrapper
+{
+public:
+    CAccRelation()
+    {
+            }
+    virtual ~CAccRelation()
+    {
+            }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_ACCRELATION)
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(CAccRelation)
+    COM_INTERFACE_ENTRY(IAccessibleRelation)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    END_COM_MAP()
+
+    // IAccessibleRelation
+public:
+    // IAccessibleRelation
+
+    // Gets what the type of relation is.
+    STDMETHOD(get_relationType)(BSTR * relationType);
+
+    // Gets what the type of localized relation is.
+    STDMETHOD(get_localizedRelationType)(BSTR * relationType);
+
+    // Gets how many targets this relation have.
+    STDMETHOD(get_nTargets)(long * nTargets);
+
+    // Gets one accessible relation target.
+    STDMETHOD(get_target)(long targetIndex, IUnknown * * target);
+
+    // Gets multiple accessible relation targets.
+    STDMETHOD(get_targets)(long maxTargets, IUnknown * * target, long * nTargets);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XSubInterface)(long pXSubInterface);
+
+    //static OLECHAR* getRelationTypeOLECHAR(int type);
+    static BSTR getRelationTypeBSTR(int type);
+
+private:
+
+    com::sun::star::accessibility::AccessibleRelation relation;
+};
+
+#endif //__ACCRELATION_H_
diff --git a/main/winaccessibility/source/UAccCOM/AccRelation.rgs b/main/winaccessibility/source/UAccCOM/AccRelation.rgs
new file mode 100644
index 0000000..3a7d3d2
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccRelation.rgs
@@ -0,0 +1,25 @@
+HKCR
+{
+	UAccCOM.AccRelation.1 = s 'AccRelation Class'
+	{
+		CLSID = s '{8745CF0C-3104-4BAE-B7D0-D7B1717C006E}'
+	}
+	UAccCOM.AccRelation = s 'AccRelation Class'
+	{
+		CLSID = s '{8745CF0C-3104-4BAE-B7D0-D7B1717C006E}'
+		CurVer = s 'UAccCOM.AccRelation.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {8745CF0C-3104-4BAE-B7D0-D7B1717C006E} = s 'AccRelation Class'
+		{
+			ProgID = s 'UAccCOM.AccRelation.1'
+			VersionIndependentProgID = s 'UAccCOM.AccRelation'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'Apartment'
+			}
+			'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccSelection.rgs b/main/winaccessibility/source/UAccCOM/AccSelection.rgs
new file mode 100644
index 0000000..4840990
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccSelection.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccSelection.1 = s 'AccSelection Class'
+	{
+		CLSID = s '{9B83B8C3-3592-4C29-8682-559E37368E95}'
+	}
+	UAccCOM.AccSelection = s 'AccSelection Class'
+	{
+		CLSID = s '{9B83B8C3-3592-4C29-8682-559E37368E95}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {9B83B8C3-3592-4C29-8682-559E37368E95} = s 'AccSelection Class'
+		{
+			ProgID = s 'UAccCOM.AccSelection.1'
+			VersionIndependentProgID = s 'UAccCOM.AccSelection'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccTable.cpp b/main/winaccessibility/source/UAccCOM/AccTable.cpp
new file mode 100644
index 0000000..e0d4341
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccTable.cpp
@@ -0,0 +1,1069 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+/**
+ * AccTable.cpp : Implementation of CAccTable.
+ */
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccTable.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include "MAccessible.h"
+
+#include "act.hxx"
+
+#ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLETABLEEXTENT_HPP_
+#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp>
+#endif
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+/**
+  * Gets accessible table cell.
+  *
+  * @param    row        the row of the specified cell.
+  * @param    column     the column of the specified cell.
+  * @param    accessible the accessible object of the cell.
+  */
+
+STDMETHODIMP CAccTable::get_accessibleAt(long row, long column, IUnknown * * accessible)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(accessible == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleCellAt(row,column);
+
+    if(!pRAcc.is())
+    {
+        *accessible = NULL;
+        return E_FAIL;
+    }
+
+    IAccessible* pRet = NULL;
+
+    BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+    if(isTRUE)
+    {
+        *accessible = (IAccessible2 *)pRet;
+        pRet->AddRef();
+        return S_OK;
+    }
+    else if(pRAcc.is())
+    {
+        Reference<XAccessible> pxTable(GetXInterface(),UNO_QUERY);
+
+        CMAccessible::g_pAgent->InsertAccObj(pRAcc.get(),pxTable.get());
+        isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+
+        if(isTRUE)
+        {
+            *accessible = (IAccessible2 *)pRet;
+            pRet->AddRef();
+            return S_OK;
+        }
+    }
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible table caption.
+  *
+  * @param    accessible    the accessible object of table cpation.
+  */
+STDMETHODIMP CAccTable::get_caption(IUnknown * *)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    return E_NOTIMPL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible column description (as string).
+  *
+  * @param    column        the column index.
+  * @param    description   the description of the specified column.
+  */
+STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(description == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleColumnDescription(column);
+    // #CHECK#
+
+    SAFE_SYSFREESTRING(*description);//??
+    *description = SysAllocString((OLECHAR*)ouStr.getStr());
+    if(description==NULL)
+        return E_FAIL;
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets number of columns spanned by table cell.
+  *
+  * @param    row            the row of the specified cell.
+  * @param    column         the column of the specified cell.
+  * @param    spanColumns    the column span of the specified cell.
+  */
+STDMETHODIMP CAccTable::get_columnExtentAt(long row, long column, long * nColumnsSpanned)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    XAccessibleTable	*pXAccTable = GetXInterface();
+
+    // Check pointer.
+    if(nColumnsSpanned == NULL)
+        return E_INVALIDARG;
+
+    // Get Extent.
+    if(pXAccTable)
+    {
+        long lExt = pXAccTable->getAccessibleColumnExtentAt(row,column);
+
+        // Fill Extent struct.
+        *nColumnsSpanned = lExt;
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible column header.
+  *
+  * @param    column        the column index.
+  * @param    accessible    the accessible object of the specified column.
+  */
+STDMETHODIMP CAccTable::get_columnHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(accessibleTable == NULL || startingRowIndex == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTable> pRColumnHeaderTable = GetXInterface()->getAccessibleColumnHeaders();
+    if(!pRColumnHeaderTable.is())
+    {
+        *accessibleTable = NULL;
+        return E_FAIL;
+    }
+
+    Reference<XAccessible> pRXColumnHeader(pRColumnHeaderTable,UNO_QUERY);
+
+    if(!pRXColumnHeader.is())
+    {
+        *accessibleTable = NULL;
+        return E_FAIL;
+    }
+    *startingRowIndex = 0 ;
+
+    IAccessible* m_pIMacc = NULL;
+	ActivateActContext();
+	HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+                                    IID_IMAccessible,
+                                    (void **)&m_pIMacc
+                                  );
+	DeactivateActContext();
+    ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXColumnHeader.get());
+    m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable);
+    if( SUCCEEDED(hr) )
+    {
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets total number of columns in table.
+  *
+  * @param    columnCount    the number of columns in table.
+  */
+STDMETHODIMP CAccTable::get_nColumns(long * columnCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(columnCount == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *columnCount = GetXInterface()->getAccessibleColumnCount();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets total number of rows in table.
+  *
+  * @param    rowCount    the number of rows in table.
+  */
+STDMETHODIMP CAccTable::get_nRows(long * rowCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(rowCount == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *rowCount = GetXInterface()->getAccessibleRowCount();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets total number of selected columns.
+  *
+  * @param    columnCount    the number of selected columns.
+  */
+STDMETHODIMP CAccTable::get_nSelectedColumns(long * columnCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(columnCount == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns();
+    *columnCount = pSelected.getLength();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets total number of selected rows.
+  *
+  * @param    rowCount    the number of selected rows.
+  */
+STDMETHODIMP CAccTable::get_nSelectedRows(long * rowCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(rowCount == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows();
+    *rowCount = pSelected.getLength();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible row description (as string).
+  *
+  * @param    row            the row index.
+  * @param    description    the description of the specified row.
+  */
+STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(description == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    const ::rtl::OUString& ouStr = GetXInterface()->getAccessibleRowDescription(row);
+    // #CHECK#
+
+    SAFE_SYSFREESTRING(*description);
+    *description = SysAllocString((OLECHAR*)ouStr.getStr());
+    if(description==NULL)
+        return E_FAIL;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets number of rows spanned by a table cell.
+  *
+  * @param    row            the row of the specified cell.
+  * @param    column         the column of the specified cell.
+  * @param    spanRows       the row span of the specified cell.
+  */
+STDMETHODIMP CAccTable::get_rowExtentAt(long row, long column, long * nRowsSpanned)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    XAccessibleTable	*pXAccTable = GetXInterface();
+
+    // Check pointer.
+    if(nRowsSpanned == NULL)
+        return E_INVALIDARG;
+
+    // Get Extent.
+    if(pXAccTable)
+    {
+        long lExt = GetXInterface()->getAccessibleRowExtentAt(row,column);
+
+        // Fill Extent struct.
+        *nRowsSpanned= lExt;
+
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible row header.
+  *
+  * @param    row        the row index.
+  * @param    accessible the accessible object of the row header.
+  */
+STDMETHODIMP CAccTable::get_rowHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(accessibleTable == NULL || startingColumnIndex == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTable> pRRowHeaderTable = GetXInterface()->getAccessibleRowHeaders();
+    if(!pRRowHeaderTable.is())
+    {
+        *accessibleTable = NULL;
+        return E_FAIL;
+    }
+
+    Reference<XAccessible> pRXRowHeader(pRRowHeaderTable,UNO_QUERY);
+
+    if(!pRXRowHeader.is())
+    {
+        *accessibleTable = NULL;
+        return E_FAIL;
+    }
+    *startingColumnIndex = 0 ;
+
+    IAccessible* m_pIMacc = NULL;
+	ActivateActContext();
+	HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+                                    IID_IMAccessible,
+                                    (void **)&m_pIMacc
+                                  );
+	DeactivateActContext();
+    ((CMAccessible*)m_pIMacc)->SetXAccessible((long)pRXRowHeader.get());
+    m_pIMacc->QueryInterface(IID_IAccessibleTable,(void **)accessibleTable);
+    if( SUCCEEDED(hr) )
+    {
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets list of row indexes currently selected (0-based).
+  *
+  * @param    maxRows        the max number of the rows.
+  * @param    accessible     the accessible object array of the selected rows.
+  * @param    nRows          the actual size of the accessible object array.
+  */
+STDMETHODIMP CAccTable::get_selectedRows(long, long ** rows, long * nRows)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(rows == NULL || nRows == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleRows();
+    long count = pSelected.getLength() ;
+    *nRows = count;
+
+    *rows = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long)));
+	// #CHECK Memory Allocation#
+	if(*rows == NULL)
+	{
+		return E_FAIL;
+	}
+    for(int i=0; i<count; i++)
+        (*rows)[i] = pSelected[i];
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets list of column indexes currently selected (0-based).
+  *
+  * @param    maxColumns    the max number of the columns.
+  * @param    accessible    the accessible object array of the selected columns.
+  * @param    numColumns    the actual size of accessible object array.
+  */
+STDMETHODIMP CAccTable::get_selectedColumns(long, long ** columns, long * numColumns)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(columns == NULL || numColumns == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Sequence<long> pSelected = GetXInterface()->getSelectedAccessibleColumns();
+    long count = pSelected.getLength() ;
+    *numColumns = count;
+
+    *columns = reinterpret_cast<long*>(CoTaskMemAlloc((count) * sizeof(long)));
+	// #CHECK Memory Allocation#
+	if(*columns == NULL)
+	{
+		return E_FAIL;
+	}
+    for(int i=0; i<count; i++)
+        (*columns)[i] = pSelected[i];
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets accessible table summary.
+  *
+  * @param    accessible   the accessible object of the summary.
+  */
+STDMETHODIMP CAccTable::get_summary(IUnknown * * accessible)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(accessible == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessible> pRAcc = GetXInterface()->getAccessibleSummary();
+
+    IAccessible* pRet = NULL;
+    BOOL isTRUE = CMAccessible::get_IAccessibleFromXAccessible((long)pRAcc.get(),&pRet);
+
+    if(pRet)
+    {
+        *accessible = (IAccessible2 *)pRet;
+        pRet->AddRef();
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Determines if table column is selected.
+  *
+  * @param    column        the column index.
+  * @param    isSelected    the result.
+  */
+STDMETHODIMP CAccTable::get_isColumnSelected(long column, unsigned char * isSelected)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(isSelected == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *isSelected = GetXInterface()->isAccessibleColumnSelected(column);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Determines if table row is selected.
+  *
+  * @param    row           the row index.
+  * @param    isSelected    the result.
+  */
+STDMETHODIMP CAccTable::get_isRowSelected(long row, unsigned char * isSelected)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(isSelected == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+    {
+        return E_FAIL;
+    }
+    *isSelected = GetXInterface()->isAccessibleRowSelected(row);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Determines if table cell is selected.
+  *
+  * @param    row            the row index.
+  * @param    column         the column index.
+  * @param    isSelected     the result.
+  */
+STDMETHODIMP CAccTable::get_isSelected(long row, long column, unsigned char * isSelected)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(isSelected == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *isSelected = GetXInterface()->isAccessibleSelected(row,column);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Selects a row and unselect all previously selected rows.
+  *
+  * @param    row        the row index.
+  * @param    success    the result.
+  */
+STDMETHODIMP CAccTable::selectRow(long row)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // Check XAccessibleTable reference.
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTableSelection>		pRTableExtent(pRXTable, UNO_QUERY);
+    if(pRTableExtent.is())
+    {
+        pRTableExtent.get()->selectRow(row);
+        return S_OK;
+    }
+    else
+    {
+        // Get XAccessibleSelection.
+        Reference<XAccessibleSelection>		pRSelection(GetXInterface(), UNO_QUERY);
+        if(!pRSelection.is())
+            return E_FAIL;
+
+        // Select row.
+        long			lCol, lColumnCount, lChildIndex;
+        lColumnCount = GetXInterface()->getAccessibleColumnCount();
+        for(lCol = 0; lCol < lColumnCount; lCol ++)
+        {
+            lChildIndex = GetXInterface()->getAccessibleIndex(row, lCol);
+            pRSelection.get()->selectAccessibleChild(lChildIndex);
+        }
+
+        return S_OK;
+    }
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Selects a column and unselect all previously selected columns.
+  *
+  * @param    column    the column index.
+  * @param    success   the result.
+  */
+STDMETHODIMP CAccTable::selectColumn(long column)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // Check XAccessibleTable reference.
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTableSelection>		pRTableExtent(GetXInterface(), UNO_QUERY);
+    if(pRTableExtent.is())
+    {
+        pRTableExtent.get()->selectColumn(column);
+        return S_OK;
+    }
+    else
+    {
+        // Get XAccessibleSelection.
+        Reference<XAccessibleSelection>		pRSelection(pRXTable, UNO_QUERY);
+        if(!pRSelection.is())
+            return E_FAIL;
+
+        // Select column.
+        long			lRow, lRowCount, lChildIndex;
+        lRowCount = GetXInterface()->getAccessibleRowCount();
+        for(lRow = 0; lRow < lRowCount; lRow ++)
+        {
+            lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column);
+            pRSelection.get()->selectAccessibleChild(lChildIndex);
+        }
+
+        return S_OK;
+    }
+    return S_OK;
+    // End of added.
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Unselects one row, leaving other selected rows selected (if any).
+  *
+  * @param    row        the row index.
+  * @param    success    the result.
+  */
+STDMETHODIMP CAccTable::unselectRow(long row)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // Check XAccessibleTable reference.
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTableSelection>		pRTableExtent(GetXInterface(), UNO_QUERY);
+    if(pRTableExtent.is())
+    {
+        if(pRTableExtent.get()->unselectRow(row))
+            return S_OK;
+        else
+            return E_FAIL;
+    }
+    else
+    {
+        // Get XAccessibleSelection.
+        Reference<XAccessibleSelection>		pRSelection(pRXTable, UNO_QUERY);
+        if(!pRSelection.is())
+            return E_FAIL;
+
+        // Select column.
+        long			lColumn, lColumnCount, lChildIndex;
+        lColumnCount = GetXInterface()->getAccessibleColumnCount();
+        for(lColumn = 0; lColumn < lColumnCount; lColumn ++)
+        {
+            lChildIndex = GetXInterface()->getAccessibleIndex(row,lColumn);
+            pRSelection.get()->deselectAccessibleChild(lChildIndex);
+        }
+
+        return S_OK;
+    }
+    return S_OK;
+    // End of added.
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Unselects one column, leaving other selected columns selected (if any).
+  *
+  * @param    column    the column index.
+  * @param    success   the result.
+  */
+STDMETHODIMP CAccTable::unselectColumn(long column)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // Check XAccessibleTable reference.
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleTableSelection>		pRTableExtent(GetXInterface(), UNO_QUERY);
+    if(pRTableExtent.is())
+    {
+        if(pRTableExtent.get()->unselectColumn(column))
+            return S_OK;
+        else
+            return E_FAIL;
+    }
+    else
+    {
+        // Get XAccessibleSelection.
+        Reference<XAccessibleSelection>		pRSelection(pRXTable, UNO_QUERY);
+        if(!pRSelection.is())
+            return E_FAIL;
+
+        // Unselect columns.
+        long			lRow, lRowCount, lChildIndex;
+        lRowCount = GetXInterface()->getAccessibleRowCount();
+
+        for(lRow = 0; lRow < lRowCount; lRow ++)
+        {
+            lChildIndex = GetXInterface()->getAccessibleIndex(lRow, column);
+            pRSelection.get()->deselectAccessibleChild(lChildIndex);
+        }
+        return S_OK;
+    }
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+ * Overide of IUNOXWrapper.
+ *
+ * @param    pXInterface    the pointer of UNO interface.
+ */
+STDMETHODIMP CAccTable::put_XInterface(long pXInterface)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_INVALIDARG;
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+        return E_FAIL;
+
+    Reference<XAccessibleTable> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXTable = NULL;
+    else
+        pRXTable = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+  * Gets columnIndex of childIndex.
+  *
+  * @param    childIndex    childIndex
+  */
+STDMETHODIMP CAccTable::get_columnIndex(long childIndex, long * columnIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(columnIndex == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *columnIndex = GetXInterface()->getAccessibleColumn(childIndex);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+/**
+  * Gets rowIndex of childIndex.
+  *
+  * @param    childIndex    childIndex
+  */
+STDMETHODIMP CAccTable::get_rowIndex(long childIndex, long * rowIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(rowIndex == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *rowIndex = GetXInterface()->getAccessibleRow(childIndex);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+/**
+  * Gets childIndex of childIndex.
+  *
+  * @param    childIndex    childIndex
+  */
+STDMETHODIMP CAccTable::get_childIndex(long RowIndex , long columnIndex, long * childIndex )
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(childIndex == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    *childIndex = GetXInterface()->getAccessibleIndex(RowIndex, columnIndex);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTable::get_rowColumnExtentsAtIndex(long,
+        long  *,
+        long  *,
+        long  *,
+        long  *,
+        boolean  *)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    return E_NOTIMPL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTable::get_modelChange(IA2TableModelChange  *)
+{
+    
+    return E_NOTIMPL;
+}
+
+// @brief Returns the total number of selected children
+//   @param [out] childCount
+//    Number of children currently selected
+STDMETHODIMP CAccTable::get_nSelectedChildren(long *childCount)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(childCount == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleSelection>		pRSelection(GetXInterface(), UNO_QUERY);
+    if(!pRSelection.is())
+        return E_FAIL;
+
+    *childCount = pRSelection->getSelectedAccessibleChildCount();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+// @brief Returns a list of child indexes currently selected (0-based).
+//   @param [in] maxChildren
+//    Max children requested (possibly from IAccessibleTable::nSelectedChildren)
+//   @param [out] children
+//    array of indexes of selected children (each index is 0-based)
+//   @param [out] nChildren
+//    Length of array (not more than maxChildren)
+STDMETHODIMP CAccTable::get_selectedChildren(long, long **children, long *nChildren)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if(children == NULL || nChildren == NULL)
+        return E_INVALIDARG;
+
+    // #CHECK XInterface#
+    if(!pRXTable.is())
+        return E_FAIL;
+
+    Reference<XAccessibleSelection>		pRSelection(GetXInterface(), UNO_QUERY);
+    if(!pRSelection.is())
+        return E_FAIL;
+
+    long childCount = pRSelection->getSelectedAccessibleChildCount() ;
+
+    *nChildren = childCount;
+
+    *children = reinterpret_cast<long*>(CoTaskMemAlloc((childCount) * sizeof(long)));
+
+    for( long i = 0; i< childCount; i++)
+    {
+        Reference<XAccessible> pRAcc = pRSelection->getSelectedAccessibleChild(i);
+        if(pRAcc.is())
+        {
+            Reference<XAccessibleContext> pRContext(pRAcc, UNO_QUERY);
+            if( !pRContext.is() )
+                return E_FAIL;
+
+            long childIndex = pRContext->getAccessibleIndexInParent();
+            (*children)[i] = childIndex;
+        }
+    }
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccTable.h b/main/winaccessibility/source/UAccCOM/AccTable.h
new file mode 100644
index 0000000..d3ca3ce
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccTable.h
@@ -0,0 +1,175 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCTABLE_H_
+#define __ACCTABLE_H_
+
+#include "resource.h"       // main symbols
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccTable implements IAccessibleTable interface.
+ */
+class ATL_NO_VTABLE CAccTable :
+            public CComObjectRoot,
+            public CComCoClass<CAccTable, &CLSID_AccTable>,
+            public IAccessibleTable,
+            public CUNOXWrapper
+
+{
+public:
+    CAccTable()
+    {
+            }
+    virtual ~CAccTable()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccTable)
+    COM_INTERFACE_ENTRY(IAccessibleTable)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccTable*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_ACCTABLE)
+
+    // IAccessibleTable
+public:
+    // IAccessibleTable
+
+    // Gets accessible table cell.
+    STDMETHOD(get_accessibleAt)(long row, long column, IUnknown * * accessible);
+
+    // Gets accessible table caption.
+    STDMETHOD(get_caption)(IUnknown * * accessible);
+
+    // Gets accessible column description (as string).
+    STDMETHOD(get_columnDescription)(long column, BSTR * description);
+
+    // Gets number of columns spanned by table cell.
+    STDMETHOD(get_columnExtentAt)(long row, long column, long * nColumnsSpanned);
+
+    // Gets accessible column header.
+    STDMETHOD(get_columnHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex);
+
+    // Gets total number of columns in table.
+    STDMETHOD(get_nColumns)(long * columnCount);
+
+    // Gets total number of rows in table.
+    STDMETHOD(get_nRows)(long * rowCount);
+
+    // Gets total number of selected columns.
+    STDMETHOD(get_nSelectedColumns)(long * columnCount);
+
+    // Gets total number of selected rows.
+    STDMETHOD(get_nSelectedRows)(long * rowCount);
+
+    // Gets accessible row description (as string).
+    STDMETHOD(get_rowDescription)(long row, BSTR * description);
+
+    // Gets number of rows spanned by a table cell.
+    STDMETHOD(get_rowExtentAt)(long row, long column, long * nRowsSpanned);
+
+    // Gets accessible row header.
+    STDMETHOD(get_rowHeader)(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex);
+
+    // Gets list of row indexes currently selected (0-based).
+    STDMETHOD(get_selectedRows)(long maxRows, long **rows, long * nRows);
+
+    // Gets list of column indexes currently selected (0-based).
+    STDMETHOD(get_selectedColumns)(long maxColumns, long **columns, long * numColumns);
+
+    // Gets accessible table summary.
+    STDMETHOD(get_summary)(IUnknown * * accessible);
+
+    // Determines if table column is selected.
+    STDMETHOD(get_isColumnSelected)(long column, unsigned char * isSelected);
+
+    // Determines if table row is selected.
+    STDMETHOD(get_isRowSelected)(long row, unsigned char * isSelected);
+
+    // Determines if table cell is selected.
+    STDMETHOD(get_isSelected)(long row, long column, unsigned char * isSelected);
+
+    // Selects a row and unselect all previously selected rows.
+    STDMETHOD(selectRow)(long row );
+
+
+    // Selects a column and unselect all previously selected columns.
+
+    STDMETHOD(selectColumn)(long column);
+
+    // Unselects one row, leaving other selected rows selected (if any).
+    STDMETHOD(unselectRow)(long row);
+
+    // Unselects one column, leaving other selected columns selected (if any).
+    STDMETHOD(unselectColumn)(long column);
+
+    //get Column index
+    STDMETHOD(get_columnIndex)(long childIndex, long * columnIndex);
+
+    STDMETHOD(get_rowIndex)(long childIndex, long * rowIndex);
+
+    STDMETHOD(get_childIndex)(long rowIndex,long columnIndex, long * childIndex);
+
+    STDMETHOD(get_nSelectedChildren)(long *childCount);
+
+    STDMETHOD(get_selectedChildren)(long maxChildren, long **children, long *nChildren);
+
+    STDMETHOD(get_rowColumnExtentsAtIndex)( long index,
+                                            long  *row,
+                                            long  *column,
+                                            long  *rowExtents,
+                                            long  *columnExtents,
+                                            boolean  *isSelected) ;
+
+    STDMETHOD(get_modelChange)(IA2TableModelChange  *modelChange);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleTable> pRXTable;
+
+    inline com::sun::star::accessibility::XAccessibleTable* GetXInterface()
+    {
+        return pRXTable.get();
+    }
+};
+
+#endif //__ACCTABLE_H_
diff --git a/main/winaccessibility/source/UAccCOM/AccTable.rgs b/main/winaccessibility/source/UAccCOM/AccTable.rgs
new file mode 100644
index 0000000..7117fe6
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccTable.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccTable.1 = s 'AccTable Class'
+	{
+		CLSID = s '{92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6}'
+	}
+	UAccCOM.AccTable = s 'AccTable Class'
+	{
+		CLSID = s '{92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6} = s 'AccTable Class'
+		{
+			ProgID = s 'UAccCOM.AccTable.1'
+			VersionIndependentProgID = s 'UAccCOM.AccTable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccText.cpp b/main/winaccessibility/source/UAccCOM/AccText.cpp
new file mode 100644
index 0000000..d5f7ffe
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccText.cpp
@@ -0,0 +1,282 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccText.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+   * Get special selection.
+   * @param startOffset Start selection offset.
+   * @param endOffset   End selection offset.
+   * @param success     Variant to accept the result of if the method call is successful.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::addSelection(long startOffset, long endOffset)//, unsigned char * success)
+{
+    
+    return CAccTextBase::get_addSelection(startOffset, endOffset);//, success);
+}
+
+/**
+   * Get special attributes.
+   * @param offset Offset.
+   * @param startOffset Variant to accept start offset.
+   * @param endOffset   Variant to accept end offset.
+   * @param textAttributes     Variant to accept attributes.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+    
+    return CAccTextBase::get_attributes(offset, startOffset, endOffset, textAttributes);
+}
+
+/**
+   * Get caret position.
+   * @param offset     Variant to accept caret offset.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_caretOffset(long * offset)
+{
+    
+    return CAccTextBase::get_caretOffset(offset);
+}
+
+/**
+   * Get character count.
+   * @param nCharacters  Variant to accept character count.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_characterCount(long * nCharacters)
+{
+    
+    return CAccTextBase::get_characterCount(nCharacters);
+}
+
+/**
+   * Get character extents.
+   * @param offset  Offset.
+   * @param x Variant to accpet x position.
+   * @param y Variant to accpet y position.
+   * @param width Variant to accpet width.
+   * @param Height Variant to accpet height.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+    
+    return CAccTextBase::get_characterExtents(offset, coordType, x, y, width, height);
+}
+
+/**
+   * Get slections count.
+   * @param nSelections Variant to accpet slections count.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_nSelections(long * nSelections)
+{
+    
+    return CAccTextBase::get_nSelections(nSelections);
+}
+
+/**
+   * Get offset of some special point.
+   * @param x X position of one point.
+   * @param x Y position of one point.
+   * @param coordType Type.
+   * @param offset Variant to accept offset.
+   * @return Result.
+*/
+
+STDMETHODIMP CAccText::get_offsetAtPoint(long x, long y, IA2CoordinateType coordType, long * offset)
+{
+    
+    return CAccTextBase::get_offsetAtPoint(x, y, coordType, offset);
+}
+
+/**
+   * Get selection range.
+   * @param selection selection count.
+   * @param startOffset Variant to accept the start offset of special selection.
+   * @param endOffset Variant to accept the end offset of special selection.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_selection(long selection, long * startOffset, long * endOffset)
+{
+    
+    return CAccTextBase::get_selection(selection, startOffset, endOffset);
+}
+
+/**
+   * Get special text.
+   * @param startOffset Start position of special range.
+   * @param endOffset   End position of special range.
+   * @param text        Variant to accept the text of special range.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_text(long startOffset, long endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_text(startOffset, endOffset, text);
+}
+
+/**
+   * Get special text before some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textBeforeOffset(offset, boundaryType,
+            startOffset, endOffset, text);
+}
+
+/**
+   * Get special text after some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textAfterOffset(offset, boundaryType,
+            startOffset, endOffset, text);
+}
+
+/**
+   * Get special text at some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+    return CAccTextBase::get_textAtOffset(offset, boundaryType,
+                                          startOffset, endOffset, text);
+}
+
+/**
+   * Remove selection.
+   * @param selectionIndex Special selection index
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::removeSelection(long selectionIndex)//, unsigned char * success)
+{
+    
+    return CAccTextBase::removeSelection(selectionIndex);//, success);
+}
+
+/**
+   * Set caret position.
+   * @param offset Special position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::setCaretOffset(long offset)
+{
+    
+    return CAccTextBase::setCaretOffset(offset);
+}
+
+/**
+   * Set special selection.
+   * @param selectionIndex Special selection index.
+   * @param startOffset start position.
+   * @param endOffset end position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+
+STDMETHODIMP CAccText::setSelection(long selectionIndex, long startOffset, long endOffset)
+{
+    
+    return CAccTextBase::setSelection(selectionIndex, startOffset,
+                                      endOffset);
+}
+
+/**
+   * Get characters count.
+   * @param nCharacters Variant to accept the characters count.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::get_nCharacters(long * nCharacters)
+{
+    
+    return CAccTextBase::get_nCharacters(nCharacters);
+}
+
+STDMETHODIMP CAccText::get_newText( IA2TextSegment *newText)
+{
+    return CAccTextBase::get_newText(newText);
+}
+
+STDMETHODIMP CAccText::get_oldText( IA2TextSegment *oldText)
+{
+    return CAccTextBase::get_oldText(oldText);
+}
+
+/**
+   * Scroll to special sub-string .
+   * @param startIndex Start index of sub string.
+   * @param endIndex   End index of sub string.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::scrollSubstringToPoint(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y )
+{
+    
+    return CAccTextBase::scrollSubstringToPoint(startIndex, endIndex, coordinateType, x, y);
+}
+
+STDMETHODIMP CAccText::scrollSubstringTo(long startIndex, long endIndex,enum IA2ScrollType scrollType)
+{
+    
+    return CAccTextBase::scrollSubstringTo(startIndex, endIndex,scrollType);
+}
+
+/**
+   * Put UNO interface.
+   * @param pXInterface UNO interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccText::put_XInterface(long pXInterface)
+{
+    
+    return CAccTextBase::put_XInterface(pXInterface);
+}
+
diff --git a/main/winaccessibility/source/UAccCOM/AccText.h b/main/winaccessibility/source/UAccCOM/AccText.h
new file mode 100644
index 0000000..14000ba
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccText.h
@@ -0,0 +1,140 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
+#define AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"       // main symbols
+
+#include "AccTextBase.h"
+
+/**
+ * CAccText implements IAccessibleText interface.
+ */
+class ATL_NO_VTABLE CAccText :
+            public CComObjectRoot,
+            public CComCoClass<CAccText,&CLSID_AccText>,
+            public IAccessibleText,
+            public CAccTextBase
+{
+public:
+    CAccText()
+    {
+            }
+    ~CAccText()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccText)
+    COM_INTERFACE_ENTRY(IAccessibleText)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccText*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccText)
+
+    // IAccessibleText
+public:
+    // IAccessibleText
+
+    // Adds a text selection.
+    STDMETHOD(addSelection)(long startOffset, long endOffset);//, unsigned char * success);
+
+    // Gets text attributes.
+    STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+    // Gets caret offset.
+    STDMETHOD(get_caretOffset)(long * offset);
+
+    // Gets total number of characters.
+    STDMETHOD(get_characterCount)(long * nCharacters);
+
+    // Gets bounding rect containing the glyph(s) representing the character
+    // at the specified text offset
+    STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+    // Gets number of active non-contiguous selections.
+    STDMETHOD(get_nSelections)(long * nSelections);
+
+    // Gets bounding rect for the glyph at a certain point.
+    STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+    // Gets character offsets of N-th active text selection.
+    STDMETHOD(get_selection)(long selection, long * startOffset, long * endOffset);
+
+    // Gets a range of text by offset NOTE: returned string may be longer
+    // than endOffset-startOffset bytes if text contains multi-byte characters.
+    STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+    // Gets a specified amount of text that ends before a specified offset.
+    STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that spans the specified offset.
+    STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that starts after a specified offset.
+    STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Unselects a range of text.
+    STDMETHOD(removeSelection)(long selectionIndex);//, unsigned char * success);
+
+    // Moves text caret.
+    STDMETHOD(setCaretOffset)(long offset);//, unsigned char * success);
+
+    // Changes the bounds of an existing selection.
+    STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);//, unsigned char * success);
+
+    // Gets total number of characters.
+    // NOTE: this may be different than the total number of bytes required
+    // to store the text, if the text contains multi-byte characters.
+    STDMETHOD(get_nCharacters)(long * nCharacters);
+
+    // Makes specific part of string visible on screen.
+    STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+    STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+    STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+    STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+};
+
+#endif // !defined(AFX_ACCTEXT_H__F06C5496_9959_4C7C_873E_A8D50CFB290D__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccText.rgs b/main/winaccessibility/source/UAccCOM/AccText.rgs
new file mode 100644
index 0000000..6cb3ebd
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccText.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccText.1 = s 'AccText Class'
+	{
+		CLSID = s '{6D8AB08B-CCE9-471E-8A41-35773D5263F5}'
+	}
+	UAccCOM.AccText = s 'AccText Class'
+	{
+		CLSID = s '{6D8AB08B-CCE9-471E-8A41-35773D5263F5}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {6D8AB08B-CCE9-471E-8A41-35773D5263F5} = s 'AccText Class'
+		{
+			ProgID = s 'UAccCOM.AccText.1'
+			VersionIndependentProgID = s 'UAccCOM.AccText'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccTextBase.cpp b/main/winaccessibility/source/UAccCOM/AccTextBase.cpp
new file mode 100644
index 0000000..01c7b8a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccTextBase.cpp
@@ -0,0 +1,995 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+//////////////////////////////////////////////////////////////////////
+// AccTextBase.cpp: implementation of the CAccTextBase class.
+//////////////////////////////////////////////////////////////////////
+#include "stdafx.h"
+#include <string>
+#define WNT
+
+#include <com/sun/star/accessibility/AccessibleTextType.hpp>
+#include "AccTextBase.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleTextSelection.hpp>
+#include "MAccessible.h"
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+using namespace rtl;
+
+//////////////////////////////////////////////////////////////////////
+// Construction/Destruction
+//////////////////////////////////////////////////////////////////////
+
+OUString ReplaceFourChar(OUString oldOUString);
+
+CAccTextBase::CAccTextBase()
+{}
+
+CAccTextBase::~CAccTextBase()
+{}
+
+
+/**
+   * Get special selection.
+   * @param startOffset Start selection offset.
+   * @param endOffset   End selection offset.
+   * @param success     Variant to accept the result of if the method call is successful.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_addSelection(long startOffset, long endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK XInterface#
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+    Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+    if( pRExtension.is() )
+    {
+        pRExtension->addSelection(0, startOffset, endOffset);
+        return S_OK;
+    }
+    else
+    {
+        GetXInterface()->setSelection(startOffset, endOffset);
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special attributes.
+   * @param offset Offset.
+   * @param startOffset Variant to accept start offset.
+   * @param endOffset   Variant to accept end offset.
+   * @param textAttributes     Variant to accept attributes.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (startOffset == NULL || endOffset == NULL || textAttributes == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+    {
+        return E_FAIL;
+    }
+
+    if( offset < 0 || offset > GetXInterface()->getCharacterCount() )
+        return E_FAIL;
+
+	std::wstring strAttrs;  
+
+    strAttrs += L"Version:1;";
+
+    Sequence< ::com::sun::star::beans::PropertyValue > pValues = GetXInterface()->getCharacterAttributes(offset, Sequence< rtl::OUString >());
+    int nCount = pValues.getLength();
+
+    short numberingLevel = 0;
+    OUString numberingPrefix;
+	Any anyNumRule;
+    bool bHaveNumberingPrefixAttr = false;
+	bool bHaveNumberingLevel = false;
+	bool bHaveNumberingRules = false;
+    for(int i =0; i<nCount; i++)
+    {
+
+        ::com::sun::star::beans::PropertyValue &pValue = pValues[i];
+        if(pValue.Name.compareTo(OUString::createFromAscii("NumberingLevel"))==0)
+        {
+			if (pValue.Value != Any())
+				pValue.Value >>= numberingLevel;
+			else
+				numberingLevel = -1;
+			bHaveNumberingLevel = true;
+            continue;
+        }
+        if(pValue.Name.compareTo(OUString::createFromAscii("NumberingPrefix"))==0)
+        {
+            pValue.Value >>=numberingPrefix;
+            bHaveNumberingPrefixAttr = true;
+            continue;
+        }
+        if(pValue.Name.compareTo(OUString::createFromAscii("NumberingRules"))==0)
+        {
+			bHaveNumberingRules = true;
+			anyNumRule = pValue.Value;
+			continue;
+        }
+		if (bHaveNumberingLevel && bHaveNumberingRules && bHaveNumberingPrefixAttr)
+		{
+			OLECHAR numProps[512] = {0};
+			strAttrs+=L";";
+			numberingPrefix = ReplaceFourChar(numberingPrefix);
+			CMAccessible::get_OLECHAR4Numbering(anyNumRule,numberingLevel,numberingPrefix,numProps);
+			strAttrs += numProps;
+			bHaveNumberingLevel = 0;
+			bHaveNumberingRules = 0;
+		}
+		if( (bHaveNumberingPrefixAttr && i > 1 ) ||
+			(!bHaveNumberingPrefixAttr && i > 0 ) ) //element 0 is NumberingPrefix, not write alone
+		{
+			strAttrs+=L";";
+		}
+        strAttrs += pValue.Name.getStr();
+        strAttrs += L":";
+
+        OLECHAR pTemp[2048] = {0};
+
+        if (pValue.Name.compareTo(OUString::createFromAscii("CharBackColor"))==0 ||
+                pValue.Name.compareTo(OUString::createFromAscii("CharColor"))==0 ||
+                pValue.Name.compareTo(OUString::createFromAscii("CharUnderlineColor"))==0 )
+        {
+            unsigned long nColor;
+            pValue.Value >>= nColor;
+            OLECHAR pBuf[64];
+            swprintf( pBuf, L"%08X", nColor );
+            pTemp[0]=L'#';
+            wcscat( pTemp, pBuf );
+
+        }
+        else
+        {
+            CMAccessible::get_OLECHARFromAny(pValue.Value,pTemp);
+        }
+
+        strAttrs +=pTemp;
+    }
+	strAttrs +=L";";
+    // #CHECK#
+    if(*textAttributes)
+        SysFreeString(*textAttributes);
+    *textAttributes = SysAllocString(strAttrs.c_str());
+
+    if( offset < GetXInterface()->getCharacterCount() )
+    {
+        TextSegment textSeg = GetXInterface()->getTextAtIndex(offset, AccessibleTextType::ATTRIBUTE_RUN);
+        *startOffset = textSeg.SegmentStart;
+        *endOffset = textSeg.SegmentEnd;
+    }
+    else
+    {
+        *startOffset = offset;
+        *endOffset = offset;
+    }
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get caret position.
+   * @param offset     Variant to accept caret offset.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_caretOffset(long * offset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (offset == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+    {
+        *offset = 0;
+        return S_OK;
+    }
+
+    *offset = GetXInterface()->getCaretPosition();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get character count.
+   * @param nCharacters  Variant to accept character count.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_characterCount(long * nCharacters)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (nCharacters == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+    {
+        *nCharacters = 0;
+        return S_OK;
+    }
+
+    *nCharacters = GetXInterface()->getCharacterCount();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get character extents.
+   * @param offset  Offset.
+   * @param x Variant to accept x position.
+   * @param y Variant to accept y position.
+   * @param width Variant to accept width.
+   * @param Height Variant to accept height.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (x == NULL || height == NULL || y == NULL || width == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    if(offset < 0 || offset > GetXInterface()->getCharacterCount() )
+        return E_FAIL;
+
+    com::sun::star::awt::Rectangle rectangle;
+    rectangle = GetXInterface()->getCharacterBounds(offset);
+
+    //IA2Point aPoint;
+    com::sun::star::awt::Point aPoint;
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleComponent> pRComp(pRContext,UNO_QUERY);
+    if( pRComp.is() )
+    {
+        if(coordType == IA2_COORDTYPE_SCREEN_RELATIVE)
+        {
+            ::com::sun::star::awt::Point pt = pRComp->getLocationOnScreen();
+            aPoint.X = pt.X;
+            aPoint.Y = pt.Y;
+        }
+        else if(coordType == IA2_COORDTYPE_PARENT_RELATIVE)
+        {
+            ::com::sun::star::awt::Point pt = pRComp->getLocation();
+            aPoint.X = pt.X;
+            aPoint.Y = pt.Y;
+        }
+    }
+    rectangle.X = rectangle.X + aPoint.X;
+    rectangle.Y = rectangle.Y + aPoint.Y;
+
+    *x = rectangle.X;
+    *y = rectangle.Y;
+
+    // GetXInterface()->getCharacterBounds() have different implement in different acc component
+    // But we need return the width/height == 1 for every component when offset == text length.
+    // So we ignore the return result of GetXInterface()->getCharacterBounds() when offset == text length.
+    if( offset == GetXInterface()->getCharacterCount() )
+    {
+        *width = 1;
+        *height = 1;
+    }
+    else
+    {
+        *width = rectangle.Width;
+        *height = rectangle.Height;
+    }
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get selections count.
+   * @param nSelections Variant to accept selections count.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_nSelections(long * nSelections)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (nSelections == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(pUNOInterface == NULL)
+    {
+        *nSelections = 0;
+        return S_OK;
+    }
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+    Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+    if( pRExtension.is() )
+    {
+        *nSelections = pRExtension->getSelectedPortionCount();
+        return S_OK;
+    }
+
+    long iLength = GetXInterface()->getSelectedText().getLength();
+    if( iLength> 0)
+    {
+        *nSelections = 1;
+        return S_OK;
+    }
+
+    *nSelections = 0;
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get offset of some special point.
+   * @param x X position of one point.
+   * @param x Y position of one point.
+   * @param coordType Type.
+   * @param offset Variant to accept offset.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_offsetAtPoint(long x, long y, IA2CoordinateType, long * offset)
+{
+	CHECK_ENABLE_INF
+    ENTER_PROTECTED_BLOCK
+
+    if (offset == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    com::sun::star::awt::Point point;
+    point.X = x;
+    point.Y = y;
+    *offset = GetXInterface()->getIndexAtPoint(point);
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get selection range.
+   * @param selection selection count.
+   * @param startOffset Variant to accept the start offset of special selection.
+   * @param endOffset Variant to accept the end offset of special selection.
+   * @return Result.
+*/
+
+STDMETHODIMP CAccTextBase::get_selection(long selectionIndex, long * startOffset, long * endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (startOffset == NULL || endOffset == NULL )
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(pUNOInterface == NULL )
+        return E_FAIL;
+
+    long nSelection = 0;
+    get_nSelections(&nSelection);
+
+    if(selectionIndex >= nSelection || selectionIndex < 0 )
+        return E_FAIL;
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+    Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+    if( pRExtension.is() )
+    {
+        *startOffset = pRExtension->getSeletedPositionStart(selectionIndex);
+        *endOffset = pRExtension->getSeletedPositionEnd(selectionIndex);
+        return S_OK;
+    }
+    else if(GetXInterface()->getSelectionEnd() > -1)
+    {
+        *startOffset = GetXInterface()->getSelectionStart();
+        *endOffset = GetXInterface()->getSelectionEnd();
+        return S_OK;
+    }
+
+    *startOffset = 0;
+    *endOffset = 0;
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special text.
+   * @param startOffset Start position of special range.
+   * @param endOffset   End position of special range.
+   * @param text        Variant to accept the text of special range.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * text)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (text == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    if (endOffset < -1 || endOffset < startOffset )
+    {
+        return E_FAIL;
+    }
+
+    ::rtl::OUString ouStr;
+    if (endOffset == -1 )
+    {
+        long nLen=0;
+        if(SUCCEEDED(get_characterCount(&nLen)))
+        {
+            ouStr = GetXInterface()->getTextRange( 0, nLen );
+        }
+    }
+    else
+    {
+        ouStr = GetXInterface()->getTextRange( startOffset, endOffset );
+    }
+
+    SysFreeString(*text);
+    *text = SysAllocString((OLECHAR*)ouStr.getStr());
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special text before some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK#
+    if (startOffset == NULL || endOffset == NULL || text == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    // In New UNO IAccessibleText.idl these constant values are defined as follows:
+    //
+    //  const long TEXT_BOUNDARY_CHAR = -1;
+    //  const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+    //  const long TEXT_BOUNDARY_START_OF_WORD = -3;
+    //  const long TEXT_BOUNDARY_END_OF_WORD = -4;
+    //  const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+    //  const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+    //  const long TEXT_BOUNDARY_START_OF_LINE = -7;
+    //  const long TEXT_BOUNDARY_END_OF_LINE = -8;
+    //
+    // In UNO, the corresponding values are as follows:
+    //
+    //  const short CHARACTER = 1;
+    //  const short WORD = 2;
+    //  const short SENTENCE = 3;
+    //  const short PARAGRAPH = 4;
+    //  const short LINE = 5;
+    //  const short GLYPH = 6;
+    //  const short ATTRIBUTE_RUN = 7;
+    //
+
+    long			lUnoBoundaryType;
+
+    switch(boundaryType)
+    {
+    case IA2_TEXT_BOUNDARY_CHAR:
+        lUnoBoundaryType = 1; // CHARACTER;
+        break;
+    case IA2_TEXT_BOUNDARY_WORD:
+        lUnoBoundaryType = 2; // WORD;
+        break;
+    case IA2_TEXT_BOUNDARY_SENTENCE:
+        lUnoBoundaryType = 3; // SENTENCE;
+        break;
+    case IA2_TEXT_BOUNDARY_LINE:
+        lUnoBoundaryType = 5; // LINE;
+        break;
+    case IA2_TEXT_BOUNDARY_PARAGRAPH:
+        lUnoBoundaryType = 4;
+        break;
+    case IA2_TEXT_BOUNDARY_ALL:
+        {
+            long nChar;
+            get_nCharacters( &nChar );
+            *startOffset = 0;
+            *endOffset = nChar;
+            return get_text(0, nChar, text);
+        }
+        break;
+    default:
+        return E_FAIL;
+    }
+
+    TextSegment segment = GetXInterface()->getTextBeforeIndex( offset, sal_Int16(lUnoBoundaryType));
+    ::rtl::OUString ouStr = segment.SegmentText;
+    SysFreeString(*text);
+    *text = SysAllocString((OLECHAR*)ouStr.getStr());
+    *startOffset = segment.SegmentStart;
+    *endOffset = segment.SegmentEnd;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special text after some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (startOffset == NULL || endOffset == NULL || text == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    // In New UNO IAccessibleText.idl these constant values are defined as follows:
+    //
+    //  const long TEXT_BOUNDARY_CHAR = -1;
+    //  const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+    //  const long TEXT_BOUNDARY_START_OF_WORD = -3;
+    //  const long TEXT_BOUNDARY_END_OF_WORD = -4;
+    //  const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+    //  const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+    //  const long TEXT_BOUNDARY_START_OF_LINE = -7;
+    //  const long TEXT_BOUNDARY_END_OF_LINE = -8;
+    //
+    // In UNO, the corresponding values are as follows:
+    //
+    //  const short CHARACTER = 1;
+    //  const short WORD = 2;
+    //  const short SENTENCE = 3;
+    //  const short PARAGRAPH = 4;
+    //  const short LINE = 5;
+    //  const short GLYPH = 6;
+    //  const short ATTRIBUTE_RUN = 7;
+    //
+
+    long			lUnoBoundaryType;
+    switch(boundaryType)
+    {
+    case IA2_TEXT_BOUNDARY_CHAR:
+        lUnoBoundaryType = 1; // CHARACTER;
+        break;
+    case IA2_TEXT_BOUNDARY_WORD:
+        lUnoBoundaryType = 2; // WORD;
+        break;
+    case IA2_TEXT_BOUNDARY_SENTENCE:
+        lUnoBoundaryType = 3; // SENTENCE;
+        break;
+    case IA2_TEXT_BOUNDARY_LINE:
+        lUnoBoundaryType = 5; // LINE;
+        break;
+    case IA2_TEXT_BOUNDARY_PARAGRAPH:
+        lUnoBoundaryType = 4;
+        break;
+    case IA2_TEXT_BOUNDARY_ALL:
+        {
+            long nChar;
+            get_nCharacters( &nChar );
+            *startOffset = 0;
+            *endOffset = nChar;
+            return get_text(0, nChar, text);
+        }
+        break;
+    default:
+        return E_FAIL;
+    }
+
+    TextSegment segment = GetXInterface()->getTextBehindIndex( offset, sal_Int16(lUnoBoundaryType));
+    ::rtl::OUString ouStr = segment.SegmentText;
+    SysFreeString(*text);
+    *text = SysAllocString((OLECHAR*)ouStr.getStr());
+    *startOffset = segment.SegmentStart;
+    *endOffset = segment.SegmentEnd;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get special text at some position.
+   * @param offset Special position.
+   * @param boundaryType Boundary type.
+   * @param startOffset Variant to accept the start offset.
+   * @param endOffset   Variant to accept the end offset.
+   * @param text        Variant to accept the special text.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
+{
+    
+
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (startOffset == NULL || text == NULL ||endOffset == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    // In New UNO IAccessibleText.idl these constant values are defined as follows:
+    //
+    //  const long TEXT_BOUNDARY_CHAR = -1;
+    //  const long TEXT_BOUNDARY_TO_CURSOR_POS = -2;
+    //  const long TEXT_BOUNDARY_START_OF_WORD = -3;
+    //  const long TEXT_BOUNDARY_END_OF_WORD = -4;
+    //  const long TEXT_BOUNDARY_START_OF_SENTENCE = -5;
+    //  const long TEXT_BOUNDARY_END_OF_SENTENCE = -6;
+    //  const long TEXT_BOUNDARY_START_OF_LINE = -7;
+    //  const long TEXT_BOUNDARY_END_OF_LINE = -8;
+    //
+    // In UNO, the corresponding values are as follows:
+    //
+    //  const short CHARACTER = 1;
+    //  const short WORD = 2;
+    //  const short SENTENCE = 3;
+    //  const short PARAGRAPH = 4;
+    //  const short LINE = 5;
+    //  const short GLYPH = 6;
+    //  const short ATTRIBUTE_RUN = 7;
+    //
+
+    long			lUnoBoundaryType;
+
+    switch(boundaryType)
+    {
+    case IA2_TEXT_BOUNDARY_CHAR:
+        lUnoBoundaryType = 1; // CHARACTER;
+        break;
+    case IA2_TEXT_BOUNDARY_WORD:
+        lUnoBoundaryType = 2; // WORD;
+        break;
+    case IA2_TEXT_BOUNDARY_SENTENCE:
+        lUnoBoundaryType = 3; // SENTENCE;
+        break;
+    case IA2_TEXT_BOUNDARY_LINE:
+        lUnoBoundaryType = 5; // LINE;
+        break;
+    case IA2_TEXT_BOUNDARY_PARAGRAPH:
+        lUnoBoundaryType = 4;
+        break;
+    case IA2_TEXT_BOUNDARY_ALL:
+        {
+            long nChar;
+            get_nCharacters( &nChar );
+            *startOffset = 0;
+            *endOffset = nChar;
+            return get_text(0, nChar, text);
+        }
+        break;
+    default:
+        return E_FAIL;
+    }
+
+    TextSegment segment = GetXInterface()->getTextAtIndex( offset, sal_Int16(lUnoBoundaryType));
+    ::rtl::OUString ouStr = segment.SegmentText;
+    SysFreeString(*text);
+    *text = SysAllocString((OLECHAR*)ouStr.getStr());
+    *startOffset = segment.SegmentStart;
+    *endOffset = segment.SegmentEnd;
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Remove selection.
+   * @param selectionIndex Special selection index
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::removeSelection(long selectionIndex)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK XInterface#
+    if(pUNOInterface == NULL)
+    {
+        return E_FAIL;
+    }
+
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+
+    Reference< XAccessibleTextSelection > pRExtension(pRContext,UNO_QUERY);
+
+    if( pRExtension.is() )
+    {
+        pRExtension->removeSelection(selectionIndex);
+        return S_OK;
+    }
+	else
+    {
+        GetXInterface()->setSelection(0, 0);
+        return S_OK;
+    }
+
+    return E_FAIL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Set caret position.
+   * @param offset Special position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::setCaretOffset(long offset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK XInterface#
+    if(!pRXText.is())
+        return E_FAIL;
+
+    GetXInterface()->setCaretPosition( offset);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Set special selection.
+   * @param selectionIndex Special selection index.
+   * @param startOffset start position.
+   * @param endOffset end position.
+   * @param success Variant to accept the memthod called result.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::setSelection(long, long startOffset, long endOffset)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    // #CHECK XInterface#
+    if(!pRXText.is())
+    {
+        return E_FAIL;
+    }
+
+    GetXInterface()->setSelection( startOffset,	endOffset );
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get characters count.
+   * @param nCharacters Variant to accept the characters count.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::get_nCharacters(long * nCharacters)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (nCharacters == NULL)
+        return E_INVALIDARG;
+    // #CHECK XInterface#
+    if(!pRXText.is())
+    {
+        *nCharacters = 0;
+        return S_OK;
+    }
+
+    *nCharacters = GetXInterface()->getCharacterCount();
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+// added by qiuhd, 2006/07/03, for direver 07/11
+STDMETHODIMP CAccTextBase::get_newText( IA2TextSegment *)
+{
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP CAccTextBase::get_oldText( IA2TextSegment *)
+{
+    return E_NOTIMPL;
+}
+
+/**
+   * Scroll to special sub-string .
+   * @param startIndex Start index of sub string.
+   * @param endIndex   End index of sub string.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::scrollSubstringToPoint(long, long, IA2CoordinateType, long, long )
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    return E_NOTIMPL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CAccTextBase::scrollSubstringTo(long, long, IA2ScrollType)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    return E_NOTIMPL;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put UNO interface.
+   * @param pXInterface UNO interface.
+   * @return Result.
+*/
+STDMETHODIMP CAccTextBase::put_XInterface(long pXInterface)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleText> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXText = NULL;
+    else
+        pRXText = pRXI;
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+OUString ReplaceOneChar(OUString oldOUString, OUString replacedChar, OUString replaceStr)
+{
+    int iReplace = -1;
+    iReplace = oldOUString.lastIndexOf(replacedChar);
+    if (iReplace > -1)
+    {
+        for(;iReplace>-1;)
+        {
+            oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+            iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+        }
+    }
+    return oldOUString;
+
+}
+OUString ReplaceFourChar(OUString oldOUString)
+{
+    oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("\\"),OUString::createFromAscii("\\\\"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(";"),OUString::createFromAscii("\\;"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii("="),OUString::createFromAscii("\\="));
+    oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(","),OUString::createFromAscii("\\,"));
+    oldOUString = ReplaceOneChar(oldOUString,OUString::createFromAscii(":"),OUString::createFromAscii("\\:"));
+    return oldOUString;
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccTextBase.h b/main/winaccessibility/source/UAccCOM/AccTextBase.h
new file mode 100644
index 0000000..7dc7785
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccTextBase.h
@@ -0,0 +1,122 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+// AccTextBase.h: interface for the CAccTextBase class.
+//
+//////////////////////////////////////////////////////////////////////
+
+#if !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_)
+#define AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define WNT
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include "UNOXWrapper.h"
+
+class ATL_NO_VTABLE CAccTextBase : public CUNOXWrapper
+{
+public:
+    CAccTextBase();
+    virtual ~CAccTextBase();
+
+    // IAccessibleText
+public:
+    // IAccessibleText
+
+    // Adds a text selection.
+    STDMETHOD(get_addSelection)(long startOffset, long endOffset);
+
+    // Gets text attributes.
+    STDMETHOD(get_attributes)(long offset, long * startOffset, long * endOffset, BSTR * textAttributes);
+
+    // Gets caret offset.
+    STDMETHOD(get_caretOffset)(long * offset);
+
+    // Gets total number of characters.
+    STDMETHOD(get_characterCount)(long * nCharacters);
+
+    // Gets bounding rect containing the glyph(s) representing the character
+    // at the specified text offset
+    STDMETHOD(get_characterExtents)(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height);
+
+    // Gets number of active non-contiguous selections.
+    STDMETHOD(get_nSelections)(long * nSelections);
+
+    // Gets bounding rect for the glyph at a certain point.
+    STDMETHOD(get_offsetAtPoint)(long x, long y, IA2CoordinateType coordType, long * offset);
+
+    // Gets character offsets of N-th active text selection.
+    STDMETHOD(get_selection)(long selectionIndex, long * startOffset, long * endOffset);
+
+    // Gets a range of text by offset NOTE: returned string may be longer
+    // than endOffset-startOffset bytes if text contains multi-byte characters.
+    STDMETHOD(get_text)(long startOffset, long endOffset, BSTR * text);
+
+    // Gets a specified amount of text that ends before a specified offset.
+    STDMETHOD(get_textBeforeOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that spans the specified offset.
+    STDMETHOD(get_textAfterOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Gets a specified amount of text that starts after a specified offset.
+    STDMETHOD(get_textAtOffset)(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text);
+
+    // Unselects a range of text.
+    STDMETHOD(removeSelection)(long selectionIndex);
+
+    // Moves text caret.
+    STDMETHOD(setCaretOffset)(long offset);
+
+    // Changes the bounds of an existing selection.
+    STDMETHOD(setSelection)(long selectionIndex, long startOffset, long endOffset);
+
+    // Gets total number of characters.
+    // NOTE: this may be different than the total number of bytes required
+    // to store the text, if the text contains multi-byte characters.
+    STDMETHOD(get_nCharacters)(long * nCharacters);
+
+    STDMETHOD(get_newText)( IA2TextSegment *newText);
+
+    STDMETHOD(get_oldText)( IA2TextSegment *oldText);
+
+    // Makes specific part of string visible on screen.
+    STDMETHOD(scrollSubstringTo)(long startIndex, long endIndex,enum IA2ScrollType scrollType);
+    STDMETHOD(scrollSubstringToPoint)(long startIndex, long endIndex,enum IA2CoordinateType coordinateType, long x, long y );
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleText> pRXText;
+
+    inline com::sun::star::accessibility::XAccessibleText* GetXInterface()
+    {
+        return pRXText.get();
+    }
+};
+
+#endif // !defined(AFX_ACCTEXTBASE_H__B9AE05F6_E28B_4CF3_A8F2_EEE5D2E00B82__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccValue.cpp b/main/winaccessibility/source/UAccCOM/AccValue.cpp
new file mode 100644
index 0000000..a98a1b2
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccValue.cpp
@@ -0,0 +1,224 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "AccValue.h"
+#include "MAccessible.h"
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleContext.hpp>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+/**
+   * Get current value.
+   * @param  currentValue Variant that accepts current value.
+   * @return Result.
+   */
+
+STDMETHODIMP CAccValue::get_currentValue(VARIANT * currentValue)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (currentValue == NULL)
+        return E_INVALIDARG;
+    if ( !pRXVal.is() )
+        return E_FAIL;
+
+    // Get Any type value from UNO.
+    ::com::sun::star::uno::Any	anyVal = GetXInterface()->getCurrentValue();
+    // Convert Any to VARIANT.
+    CMAccessible::ConvertAnyToVariant(anyVal, currentValue);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Set current value.
+   * @param  Value New value should be set.
+   * @param  success If the method is successfully called.
+   * @return Result.
+   */
+STDMETHODIMP CAccValue::setCurrentValue(VARIANT value)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if ( !pRXVal.is() )
+        return E_FAIL;
+
+    HRESULT hRet = S_OK;
+    ::com::sun::star::uno::Any anyVal;
+
+    // Set value according to value type.
+    switch(value.vt)
+    {
+    case VT_UI1:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_CHAR, (sal_Char *)"char");
+            anyVal.setValue(&value.bVal, typeInfo);
+        }
+        break;
+
+    case VT_BOOL:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_BOOLEAN, (sal_Char *)"bool");
+            anyVal.setValue(&value.boolVal, typeInfo);
+        }
+        break;
+
+    case VT_I2:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_SHORT, (sal_Char *)"short");
+            anyVal.setValue(&value.iVal, typeInfo);
+        }
+        break;
+
+    case VT_I4:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_LONG, (sal_Char *)"long");
+            anyVal.setValue(&value.lVal, typeInfo);
+        }
+        break;
+
+    case VT_R4:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_FLOAT, (sal_Char *)"float");
+            anyVal.setValue(&value.fltVal, typeInfo);
+        }
+        break;
+
+    case VT_R8:
+        {
+            ::com::sun::star::uno::Type		typeInfo(TypeClass_DOUBLE, (sal_Char *)"double");
+            anyVal.setValue(&value.dblVal, typeInfo);
+        }
+        break;
+
+    default:
+        {
+            // Unsupport type conversion.
+            hRet = E_FAIL;
+        }
+        break;
+    }
+
+    if(hRet == S_OK)
+    {
+        hRet = pRXVal->setCurrentValue(anyVal) ? S_OK : E_FAIL ;
+    }
+
+    return hRet;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get maximum value.
+   * @param  maximumValue Variant that accepts maximum value.
+   * @return Result.
+   */
+STDMETHODIMP CAccValue::get_maximumValue(VARIANT *maximumValue)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (maximumValue == NULL)
+        return E_INVALIDARG;
+    if ( !pRXVal.is() )
+        return E_FAIL;
+
+    // Get Any type value from UNO.
+    ::com::sun::star::uno::Any	anyVal = GetXInterface()->getMaximumValue();
+    // Convert Any to VARIANT.
+    CMAccessible::ConvertAnyToVariant(anyVal, maximumValue);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Get minimum value.
+   * @param  mininumValue Variant that accepts minimum value.
+   * @return Result.
+   */
+STDMETHODIMP CAccValue::get_minimumValue(VARIANT *mininumValue)
+{
+    
+	CHECK_ENABLE_INF
+
+    ENTER_PROTECTED_BLOCK
+
+    if (mininumValue == NULL)
+        return E_FAIL;
+    if ( !pRXVal.is() )
+        return E_FAIL;
+
+    // Get Any type value from UNO.
+    ::com::sun::star::uno::Any	anyVal = GetXInterface()->getMinimumValue();
+    // Convert Any to VARIANT.
+    CMAccessible::ConvertAnyToVariant(anyVal, mininumValue);
+
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
+
+/**
+   * Put valid UNO interface into com class.
+   * @param  pXInterface UNO interface.
+   * @return Result.
+   */
+STDMETHODIMP CAccValue::put_XInterface(long pXInterface)
+{
+    
+
+    ENTER_PROTECTED_BLOCK
+
+    CUNOXWrapper::put_XInterface(pXInterface);
+    //special query.
+    if(pUNOInterface == NULL)
+        return E_FAIL;
+    Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+    if( !pRContext.is() )
+    {
+        return E_FAIL;
+    }
+    Reference<XAccessibleValue> pRXI(pRContext,UNO_QUERY);
+    if( !pRXI.is() )
+        pRXVal = NULL;
+    else
+        pRXVal = pRXI.get();
+    return S_OK;
+
+    LEAVE_PROTECTED_BLOCK
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccValue.h b/main/winaccessibility/source/UAccCOM/AccValue.h
new file mode 100644
index 0000000..002a757
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccValue.h
@@ -0,0 +1,104 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#if !defined(AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
+#define AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#include "resource.h"           // main symbols
+
+
+#include <com/sun/star/uno/reference.hxx>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include "UNOXWrapper.h"
+
+/**
+ * CAccValue implements IAccessibleValue interface.
+ */
+class CAccValue :
+            public CComObjectRoot,
+            public CComCoClass<CAccValue,&CLSID_AccValue>,
+            public IAccessibleValue,
+            public CUNOXWrapper
+{
+public:
+    CAccValue()
+    {
+            }
+    virtual ~CAccValue()
+    {
+            }
+
+    BEGIN_COM_MAP(CAccValue)
+    COM_INTERFACE_ENTRY(IAccessibleValue)
+    COM_INTERFACE_ENTRY(IUNOXWrapper)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CAccValue*)pv)->SmartQI(iid,ppvObject);
+    }
+
+    HRESULT SmartQI(REFIID iid, void** ppvObject)
+    {
+        if( m_pOuterUnknown )
+            return OuterQueryInterface(iid,ppvObject);
+        return E_FAIL;
+    }
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_AccValue)
+
+    // IAccessibleValue
+public:
+    // IAccessibleValue
+
+    // Returns the value of this object as a number.
+    STDMETHOD(get_currentValue)(VARIANT *currentValue);
+
+    // Sets the value of this object to the given number.
+    STDMETHOD(setCurrentValue)(VARIANT value);
+
+    // Returns the maximal value that can be represented by this object.
+    STDMETHOD(get_maximumValue)(VARIANT *maximumValue);
+
+    // Returns the minimal value that can be represented by this object.
+    STDMETHOD(get_minimumValue)(VARIANT *mininumValue);
+
+    // Overide of IUNOXWrapper.
+    STDMETHOD(put_XInterface)(long pXInterface);
+
+private:
+
+    com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleValue> pRXVal;
+
+    inline com::sun::star::accessibility::XAccessibleValue* GetXInterface()
+    {
+        return pRXVal.get();
+    }
+
+};
+
+#endif // !defined(AFX_ACCVALUE_H__CBA4972C_4188_4A18_A3CD_4A1FA3DDED38__INCLUDED_)
diff --git a/main/winaccessibility/source/UAccCOM/AccValue.rgs b/main/winaccessibility/source/UAccCOM/AccValue.rgs
new file mode 100644
index 0000000..f57f318
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccValue.rgs
@@ -0,0 +1,23 @@
+HKCR
+{
+	UAccCOM.AccValue.1 = s 'AccValue Class'
+	{
+		CLSID = s '{730A561B-1AF6-49E1-9C04-9A2F48CD8512}'
+	}
+	UAccCOM.AccValue = s 'AccValue Class'
+	{
+		CLSID = s '{730A561B-1AF6-49E1-9C04-9A2F48CD8512}'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {730A561B-1AF6-49E1-9C04-9A2F48CD8512} = s 'AccValue Class'
+		{
+			ProgID = s 'UAccCOM.AccValue.1'
+			VersionIndependentProgID = s 'UAccCOM.AccValue'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'both'
+			}
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h b/main/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h
new file mode 100644
index 0000000..076151e
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/AccessibleKeyStroke.h
@@ -0,0 +1,157 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCESSIBLEKEYSTROKE_H_
+#define __ACCESSIBLEKEYSTROKE_H_
+
+#pragma	once
+        
+typedef struct _ACCESSIBLE_KEYSTROKE {
+  short modifiers;
+  short keyCode;
+  char keyChar;
+  short keyFunc;
+} ACCESSIBLE_KEYSTROKE;
+
+const short MODIFIER_SHIFT = 1;
+const short MODIFIER_CTRL = 2;
+const short MODIFIER_ALT = 4;
+
+const short KEYCODE_NUM0 = 256;
+const short KEYCODE_NUM1 = 257;
+const short KEYCODE_NUM2 = 258;
+const short KEYCODE_NUM3 = 259;
+const short KEYCODE_NUM4 = 260;
+const short KEYCODE_NUM5 = 261;
+const short KEYCODE_NUM6 = 262;
+const short KEYCODE_NUM7 = 263;
+const short KEYCODE_NUM8 = 264;
+const short KEYCODE_NUM9 = 265;
+const short KEYCODE_A = 512;
+const short KEYCODE_B = 513;
+const short KEYCODE_C = 514;
+const short KEYCODE_D = 515;
+const short KEYCODE_E = 516;
+const short KEYCODE_F = 517;
+const short KEYCODE_G = 518;
+const short KEYCODE_H = 519;
+const short KEYCODE_I = 520;
+const short KEYCODE_J = 521;
+const short KEYCODE_K = 522;
+const short KEYCODE_L = 523;
+const short KEYCODE_M = 524;
+const short KEYCODE_N = 525;
+const short KEYCODE_O = 526;
+const short KEYCODE_P = 527;
+const short KEYCODE_Q = 528;
+const short KEYCODE_R = 529;
+const short KEYCODE_S = 530;
+const short KEYCODE_T = 531;
+const short KEYCODE_U = 532;
+const short KEYCODE_V = 533;
+const short KEYCODE_W = 534;
+const short KEYCODE_X = 535;
+const short KEYCODE_Y = 536;
+const short KEYCODE_Z = 537;
+const short KEYCODE_F1 = 768;
+const short KEYCODE_F2 = 769;
+const short KEYCODE_F3 = 770;
+const short KEYCODE_F4 = 771;
+const short KEYCODE_F5 = 772;
+const short KEYCODE_F6 = 773;
+const short KEYCODE_F7 = 774;
+const short KEYCODE_F8 = 775;
+const short KEYCODE_F9 = 776;
+const short KEYCODE_F10 = 777;
+const short KEYCODE_F11 = 778;
+const short KEYCODE_F12 = 779;
+const short KEYCODE_F13 = 780;
+const short KEYCODE_F14 = 781;
+const short KEYCODE_F15 = 782;
+const short KEYCODE_F16 = 783;
+const short KEYCODE_F17 = 784;
+const short KEYCODE_F18 = 785;
+const short KEYCODE_F19 = 786;
+const short KEYCODE_F20 = 787;
+const short KEYCODE_F21 = 788;
+const short KEYCODE_F22 = 789;
+const short KEYCODE_F23 = 790;
+const short KEYCODE_F24 = 791;
+const short KEYCODE_F25 = 792;
+const short KEYCODE_F26 = 793;
+const short KEYCODE_DOWN = 1024;
+const short KEYCODE_UP = 1025;
+const short KEYCODE_LEFT = 1026;
+const short KEYCODE_RIGHT = 1027;
+const short KEYCODE_HOME = 1028;
+const short KEYCODE_END = 1029;
+const short KEYCODE_PAGEUP = 1030;
+const short KEYCODE_PAGEDOWN = 1031;
+const short KEYCODE_RETURN = 1280;
+const short KEYCODE_ESCAPE = 1281;
+const short KEYCODE_TAB = 1282;
+const short KEYCODE_BACKSPACE = 1283;
+const short KEYCODE_SPACE = 1284;
+const short KEYCODE_INSERT = 1285;
+const short KEYCODE_DELETE = 1286;
+const short KEYCODE_ADD = 1287;
+const short KEYCODE_SUBTRACT = 1288;
+const short KEYCODE_MULTIPLY = 1289;
+const short KEYCODE_DIVIDE = 1290;
+const short KEYCODE_POINT = 1291;
+const short KEYCODE_COMMA = 1292;
+const short KEYCODE_LESS = 1293;
+const short KEYCODE_GREATER = 1294;
+const short KEYCODE_EQUAL = 1295;
+const short KEYCODE_OPEN = 1296;
+const short KEYCODE_CUT = 1297;
+const short KEYCODE_COPY = 1298;
+const short KEYCODE_PASTE = 1299;
+const short KEYCODE_UNDO = 1300;
+const short KEYCODE_REPEAT = 1301;
+const short KEYCODE_FIND = 1302;
+const short KEYCODE_PROPERTIES = 1303;
+const short KEYCODE_FRONT = 1304;
+const short KEYCODE_CONTEXTMENU = 1305;
+const short KEYCODE_HELP = 1306;
+
+const short SHORTCUT_DONTKNOW = 0;
+const short NEW = 1;
+const short OPEN = 2;
+const short SAVE = 3;
+const short SAVEAS = 4;
+const short PRINT = 5;
+const short CLOSE = 6;
+const short QUIT = 7;
+const short CUT = 8;
+const short COPY = 9;
+const short PASTE = 10;
+const short UNDO = 11;
+const short REDO = 12;
+const short UNODELETE = 13;
+const short REPEAT = 14;
+const short FIND = 15;
+const short FINDBACKWARD = 16;
+const short PROPERTIES = 17;
+const short FRONT = 18;
+
+
+#endif //#define __ACCESSIBLEKEYSTROKE_H_
diff --git a/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.cpp b/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.cpp
new file mode 100644
index 0000000..8a7987a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.cpp
@@ -0,0 +1,35 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#define WNT

+#define _USE_NAMESPACE

+

+#ifndef _SV_SVAPP_HXX

+#include <vcl/svapp.hxx>

+#endif

+

+#include "CheckEnableAccessible.h"

+

+

+bool IsEnableAccessibleInterface()

+{

+	return Application::IsEnableAccessInterface();

+}

diff --git a/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.h b/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.h
new file mode 100644
index 0000000..3c7ed07
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/CheckEnableAccessible.h
@@ -0,0 +1,30 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef _CHECKENABLEACCESSIBLE_HXX

+#define _CHECKENABLEACCESSIBLE_HXX

+

+bool IsEnableAccessibleInterface();

+

+#define CHECK_ENABLE_INF if(!IsEnableAccessibleInterface()){ return S_FALSE; }

+#define CHECK_ENABLE_INF_ZERO if(!IsEnableAccessibleInterface()){ return 0; }

+

+#endif //_CHECKENABLEACCESSIBLE_HXX

diff --git a/main/winaccessibility/source/UAccCOM/EnumVariant.cpp b/main/winaccessibility/source/UAccCOM/EnumVariant.cpp
new file mode 100644
index 0000000..890d2a1
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/EnumVariant.cpp
@@ -0,0 +1,227 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "EnumVariant.h"
+#include "MAccessible.h"
+
+#include "act.hxx"
+
+/////////////////////////////////////////////////////////////////////////////
+// CEnumVariant
+
+
+
+/**
+   * enumarate method,get next element
+   * @param  cElements The number of elements to be returned. 
+   * @param  pvar      An array of at least size celt in which the elements are to be returned.
+   * @param  pcElementFetched Pointer to the number of elements returned in rgVar, or Null¡£
+   * @return Result.
+   */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched)
+{
+    long l1;
+    ULONG l2;
+
+    if (pvar == NULL)
+        return E_INVALIDARG;
+
+	CHECK_ENABLE_INF
+    if (pcElementFetched != NULL)
+        *pcElementFetched = 0;
+
+    // Retrieve the next cElements.
+    for (l1=m_lCurrent, l2=0; l1<m_pXAccessibleSelection->getSelectedAccessibleChildCount() &&
+            l2<cElements; l1++, l2++)
+    {
+        Reference< XAccessible > pRXAcc = m_pXAccessibleSelection->getSelectedAccessibleChild(l1);
+        IAccessible* pChild = NULL;
+        BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRXAcc.get(),&pChild);
+        if(isGet)
+        {
+            pvar[l2].vt = VT_I4;
+            ((IMAccessible*)pChild)->Get_XAccChildID(&pvar[l2].lVal);
+        }
+        else if(pRXAcc.is())
+        {
+            if(CMAccessible::g_pAgent)
+                CMAccessible::g_pAgent->InsertAccObj(pRXAcc.get(),pUNOInterface,NULL);
+            BOOL isGet = CMAccessible::get_IAccessibleFromXAccessible((long)pRXAcc.get(),&pChild);
+            if(isGet)
+            {
+                pvar[l2].vt = VT_I4;
+                ((IMAccessible*)pChild)->Get_XAccChildID(&pvar[l2].lVal);
+            }
+        }
+    }
+    // Set count of elements retrieved.
+    if (pcElementFetched != NULL)
+        *pcElementFetched = l2;
+    m_lCurrent = l1;
+
+    return (l2 < cElements) ? S_FALSE : NOERROR;
+}
+
+/**
+   * skip the elements in the given range when enumarate elements
+   * @param  cElements The number of elements to skip. 
+   * @return Result.
+   */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Skip(ULONG cElements)
+{
+	CHECK_ENABLE_INF
+    m_lCurrent += cElements;
+    if (m_lCurrent > (long)(m_lLBound+m_pXAccessibleSelection->getSelectedAccessibleChildCount()))
+    {
+        m_lCurrent =  m_lLBound+m_pXAccessibleSelection->getSelectedAccessibleChildCount();
+        return E_FAIL;
+    }
+    else
+        return NOERROR;
+}
+
+
+/**
+   * reset the enumaration position to initial value
+   * @param 
+   * @return Result.
+   */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Reset( void)
+{
+    m_lCurrent = m_lLBound;
+    return NOERROR;
+}
+
+
+/**
+   *create a new IEnumVariant object,
+   *copy current enumaration container and its state to 
+   *the new object
+   *AT will use the copy object to get elements
+   * @param ppenum On return, pointer to the location of the clone enumerator¡£
+   * @return Result.
+   */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum)
+{
+    CEnumVariant * penum = NULL;
+    HRESULT hr;
+    if (ppenum == NULL)
+        return E_INVALIDARG;
+
+    *ppenum = NULL;
+
+    hr = Create(&penum);
+    if( hr == S_OK )
+    {
+        penum->PutSelection((long)pUNOInterface);
+        *ppenum = penum;
+    }
+    else
+    {
+        if (penum)
+            penum->Release();
+    }
+    return hr;
+}
+
+/**
+   *Static public method to create a CLSID_EnumVariant com object.
+   * @param ppenum Pointer to accept com object.
+   * @return Result.
+   */
+HRESULT STDMETHODCALLTYPE CEnumVariant::Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum)
+{
+	ActivateActContext();
+	HRESULT hr = CoCreateInstance(CLSID_EnumVariant,NULL,
+                                 CLSCTX_SERVER,IID_IEnumVariant,(void **)ppenum);
+	DeactivateActContext();
+	if (S_OK != hr)
+    {
+        return E_FAIL;
+    }
+
+    return S_OK;
+}
+
+/**
+   *Return count of elements in current container
+   * @param.
+   * @return count of elements in current container.
+   */
+long CEnumVariant::GetCountOfElements()
+{
+	CHECK_ENABLE_INF_ZERO
+
+    if(m_pXAccessibleSelection.is())
+        return m_pXAccessibleSelection->getSelectedAccessibleChildCount();
+    return 0;
+}
+
+/**
+   * Set memeber m_pXAccessibleSelection to NULL and m_lCurrent to m_lLBound.
+   * @param.
+   * @return Result
+   */
+STDMETHODIMP CEnumVariant::ClearEnumeration()
+{
+    pUNOInterface = NULL;
+    m_pXAccessibleSelection = NULL;
+    m_lCurrent = m_lLBound;
+    return S_OK;
+}
+
+/**
+   *Static method to fetch XAccessibleSelection
+   * @param pXAcc XAccessible interface.
+   * @return XAccessibleSelection interface.
+   */
+static Reference<XAccessibleSelection> GetXAccessibleSelection(XAccessible* pXAcc)
+{
+    XAccessibleSelection* pSelection = NULL;
+    Reference< XAccessibleContext > pRContext;
+
+    if( pXAcc == NULL)
+        return NULL;
+
+    pRContext = pXAcc->getAccessibleContext();
+    if( !pRContext.is() )
+        return NULL;
+
+    Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+    if( !pRSelection.is() )
+        return NULL;
+
+    return pRSelection;
+}
+
+/**
+   * Put valid UNO XAccessible interface.
+   * @param pXSelection XAccessible interface.
+   * @return Result..
+   */
+STDMETHODIMP CEnumVariant::PutSelection(long pXSelection)
+{
+    pUNOInterface = (XAccessible*)pXSelection;
+    m_pXAccessibleSelection = GetXAccessibleSelection(pUNOInterface);
+    return S_OK;
+}
diff --git a/main/winaccessibility/source/UAccCOM/EnumVariant.h b/main/winaccessibility/source/UAccCOM/EnumVariant.h
new file mode 100644
index 0000000..9a8f0a6
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/EnumVariant.h
@@ -0,0 +1,106 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ENUMVARIANT_H_
+#define __ENUMVARIANT_H_
+
+#define WNT
+
+#include "resource.h"       // main symbols
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include "UAccCOM2.h"
+#include <AccObjectManagerAgent.hxx>
+
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+#include <vector>
+#include <algorithm>
+using namespace std;
+
+/**
+ * CEnumVariant implements IEnumVARIANT interface.
+ */
+class ATL_NO_VTABLE CEnumVariant :
+            public CComObjectRootEx<CComMultiThreadModel>,
+            public CComCoClass<CEnumVariant, &CLSID_EnumVariant>,
+            public IDispatchImpl<IEnumVariant, &IID_IEnumVariant, &LIBID_UACCCOMLib>
+{
+public:
+    CEnumVariant()
+            :m_lLBound(0),
+            pUNOInterface(NULL),
+            m_pXAccessibleSelection(NULL)
+    {
+        m_lCurrent = m_lLBound;
+    }
+
+	virtual ~CEnumVariant() {};
+
+    DECLARE_REGISTRY_RESOURCEID(IDR_ENUMVARIANT)
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(CEnumVariant)
+    COM_INTERFACE_ENTRY(IEnumVariant)
+    COM_INTERFACE_ENTRY(IEnumVARIANT)
+    END_COM_MAP()
+
+    // IEnumVariant
+public:
+
+    STDMETHOD(ClearEnumeration)();
+
+    // IEnumVARIANT
+
+    //
+    HRESULT STDMETHODCALLTYPE Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched);
+
+    //
+    HRESULT STDMETHODCALLTYPE Skip(ULONG cElements);
+
+    //
+    HRESULT STDMETHODCALLTYPE Reset( void);
+
+    //
+    HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum);
+
+    // IEnumVariant
+
+    //
+    HRESULT STDMETHODCALLTYPE PutSelection(long pXSelection);
+
+    //
+    static HRESULT STDMETHODCALLTYPE Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum);
+
+    //
+    long GetCountOfElements();
+
+private:
+
+    long m_lCurrent;
+    long m_lLBound;
+    XAccessible* pUNOInterface;						// XAccessible.
+    Reference<XAccessibleSelection> m_pXAccessibleSelection;	// Selection.
+};
+
+#endif //__ENUMVARIANT_H_
diff --git a/main/winaccessibility/source/UAccCOM/EnumVariant.rgs b/main/winaccessibility/source/UAccCOM/EnumVariant.rgs
new file mode 100644
index 0000000..c5decdc
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/EnumVariant.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+	UAccCOM.EnumVariant.1 = s 'EnumVariant Class'
+	{
+		CLSID = s '{152884E0-268B-4481-9AE7-1B372D3AA97F}'
+	}
+	UAccCOM.EnumVariant = s 'EnumVariant Class'
+	{
+		CLSID = s '{152884E0-268B-4481-9AE7-1B372D3AA97F}'
+		CurVer = s 'UAccCOM.EnumVariant.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {152884E0-268B-4481-9AE7-1B372D3AA97F} = s 'EnumVariant Class'
+		{
+			ProgID = s 'UAccCOM.EnumVariant.1'
+			VersionIndependentProgID = s 'UAccCOM.EnumVariant'
+			ForceRemove 'Programmable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'Both'
+			}
+			'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/MAccessible.cpp b/main/winaccessibility/source/UAccCOM/MAccessible.cpp
new file mode 100644
index 0000000..2659ea5
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/MAccessible.cpp
@@ -0,0 +1,3267 @@
+/**************************************************************
+* 
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+* 
+*   http://www.apache.org/licenses/LICENSE-2.0
+* 
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+* 
+*************************************************************/
+
+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "MAccessible.h"
+
+#include <algorithm>
+#include "AccAction.h"
+
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+#include <com/sun/star/accessibility/XAccessibleEditableText.hpp>
+#include <com/sun/star/accessibility/XAccessibleImage.hpp>
+#include <com/sun/star/accessibility/XAccessibleTable.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <com/sun/star/accessibility/XAccessibleKeyBinding.hpp>
+#include <com/sun/star/accessibility/XAccessibleHyperText.hpp>
+#include <com/sun/star/accessibility/XAccessibleHyperlink.hpp>
+#include <com/sun/star/accessibility/XAccessibleRelationSet.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleGroupPosition.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/accessibility/XAccessibleExtendedAttributes.hpp>
+#include <com/sun/star/style/LineSpacing.hpp>
+#include <com/sun/star/style/TabStop.hpp>
+#include <com/sun/star/container/XIndexReplace.hpp>
+
+#include "act.hxx"
+
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+// IA2 states mapping, and name
+// maintenance the consistency, change one array, change the three all
+long IA2_STATES[] =
+{
+	IA2_STATE_ACTIVE,					// =					0x1;
+	IA2_STATE_ARMED,					// =					0x2;
+	IA2_STATE_DEFUNCT,					// =					0x4;
+	IA2_STATE_EDITABLE,					// =					0x8;
+	IA2_STATE_HORIZONTAL,				// =					0x10;
+	IA2_STATE_ICONIFIED,				// =					0x20;
+	IA2_STATE_INVALID_ENTRY,			// =					0x80;
+	IA2_STATE_MANAGES_DESCENDANTS,		// =					0x100;
+	IA2_STATE_MODAL,					// =					0x200;
+	IA2_STATE_MULTI_LINE,				// =					0x400;
+	IA2_STATE_OPAQUE,					// =					0x800;
+	IA2_STATE_REQUIRED,					// =					0x2000;
+	IA2_STATE_SELECTABLE_TEXT,			// =					0x3000;
+	IA2_STATE_SINGLE_LINE,				// =					0x4000;
+	IA2_STATE_STALE,					// =					0x8000;
+	IA2_STATE_SUPPORTS_AUTOCOMPLETION,	// =					0x10000;
+	IA2_STATE_TRANSIENT,				//=						0x20000;
+	IA2_STATE_VERTICAL					// =					0x40000;
+};
+/*
+
+<=== map ===>  
+
+*/
+short UNO_STATES[] =
+{
+	ACTIVE,			// = (sal_Int16)1;
+	ARMED,			// = (sal_Int16)2;
+	DEFUNC,			// = (sal_Int16)5;
+	EDITABLE,		// = (sal_Int16)6;
+	HORIZONTAL,		// = (sal_Int16)12;
+	ICONIFIED,		// = (sal_Int16)13;
+	-1,				//IA2_STATE_INVALID_ENTRY
+	MANAGES_DESCENDANTS, // = (sal_Int16)15;
+	MODAL,			// = (sal_Int16)16;
+	MULTI_LINE,		// = (sal_Int16)17;
+	OPAQUE,			// = (sal_Int16)19;
+	-1,				//IA2_STATE_REQUIRED
+	-1,				//IA2_STATE_SELECTABLE_TEXT
+	SINGLE_LINE,	// = (sal_Int16)26;
+	STALE,			// = (sal_Int16)27;
+	-1,				//IA2_STATE_SUPPORTS_AUTOCOMPLETION
+	TRANSIENT,		//IA2_STATE_TRANSIENT
+	VERTICAL		// = (sal_Int16)29;
+};
+
+//  <=== map ===>
+
+BSTR IA2_STATES_NAME[] =
+{
+	_T("Active"),
+	_T("Armed"),
+	_T("Defunct"),
+	_T("Editable"),
+	_T("Horizontal"),
+	_T("Iconified"),
+	_T("Invalid Entry"),
+	_T("Manages Decendents"),
+	_T("Modal"),
+	_T("Multi Line"),
+	_T("Opaque"),
+	_T("Required"),
+	_T("Selectable Text"),
+	_T("Single Line"),
+	_T("Stale"),
+	_T("Supports Autocompletion"),
+	_T("Transient"),
+	_T("Vertical")
+};
+
+// IA2 states mapping, and name
+// maintenance the consistency. change one, change them all
+
+BSTR UNO_ALL_STATES[] =
+{
+	_T("INVALID"),			// 	INVALID	( 0 )
+	_T("ACTIVE"),			// 	ACTIVE	( 1 )
+	_T("ARMED"),			// 	ARMED	( 2 )
+	_T("BUSY"),				// 	BUSY	( 3 )
+	_T("CHECKED"),			// 	CHECKED	( 4 )
+	_T("DEFUNC"),			// 	DEFUNC	( 5 )
+	_T("EDITABLE"),			// 	EDITABLE	( 6 )
+	_T("ENABLED"),			// 	ENABLED	( 7 )
+	_T("EXPANDABLE"),		// 	EXPANDABLE	( 8 )
+	_T("EXPANDED"),			// 	EXPANDED	( 9 )
+	_T("FOCUSABLE"),		// 	FOCUSABLE	( 10 )
+	_T("FOCUSED"),			// 	FOCUSED	( 11 )
+	_T("HORIZONTAL"),		// 	HORIZONTAL	( 12 )
+	_T("ICONIFIED"),		// 	ICONIFIED	( 13 )
+	_T("INDETERMINATE"),	// 	INDETERMINATE	( 14 )
+	_T("MANAGES_DESCENDANTS"),// 	MANAGES_DESCENDANTS	( 15 )
+	_T("MODAL"),			// 	MODAL	( 16 )
+	_T("MULTI_LINE"),		// 	MULTI_LINE	( 17 )
+	_T("MULTI_SELECTABLE"),	// 	MULTI_SELECTABLE	( 18 )
+	_T("OPAQUE"),			// 	OPAQUE	( 19 )
+	_T("PRESSED"),			// 	PRESSED	( 20 )
+	_T("RESIZABLE"),		// 	RESIZABLE	( 21 )
+	_T("SELECTABLE"),		// 	SELECTABLE	( 22 )
+	_T("SELECTED"),			// 	SELECTED	( 23 )
+	_T("SENSITIVE"),		// 	SENSITIVE	( 24 )
+	_T("SHOWING"),			// 	SHOWING	( 25 )
+	_T("SINGLE_LINE"),		// 	SINGLE_LINE	( 26 )
+	_T("STALE"),			// 	STALE	( 27 )
+	_T("TRANSIENT"),		// 	TRANSIENT	( 28 )
+	_T("VERTICAL"),			// 	VERTICAL	( 29 )
+	_T("VISIBLE"),			// 	VISIBLE	( 30 )
+	_T("MOVEABLE"),			//  MOVEABLE ( 31 )
+	_T("OFFSCREEN"),		//  OFFSCREEN ( 32 )
+	_T("COLLAPSE"),			//  COLLAPSE ( 33 )
+	_T("DEFAULT")			//  DEFAULT ( 34 )
+};
+
+
+using namespace com::sun::star::accessibility::AccessibleRole;
+
+
+
+#define QUERYXINTERFACE(ainterface)	\
+{							\
+	if(pXAcc == NULL)		\
+	return FALSE;		\
+	pRContext = pXAcc->getAccessibleContext();	\
+	if( !pRContext.is() )	\
+{						\
+	return FALSE;		\
+}						\
+	Reference<X##ainterface> pRXI(pRContext,UNO_QUERY);\
+	if( !pRXI.is() )		\
+{						\
+	return FALSE;		\
+}						\
+	*ppXI = (XInterface*)pRXI.get();		\
+	return TRUE;			\
+}
+
+#define ISDESTROY()	\
+	if(m_isDestroy)	\
+	return S_FALSE;
+
+
+AccObjectManagerAgent* CMAccessible::g_pAgent = NULL;
+
+CMAccessible::CMAccessible():
+m_iRole(0x00),
+m_dState(0x00),
+m_dChildID(0x00),
+m_dFocusChildID(UACC_NO_FOCUS),
+m_hwnd(NULL),
+m_pIParent(NULL),
+m_pszName(NULL),
+m_pszValue(NULL),
+m_pszDescription(NULL),
+m_isDestroy(FALSE),
+m_pszActionDescription(NULL),
+m_pXAction(NULL),
+m_bRequiresSave(FALSE),
+pUNOInterface(NULL)
+{
+	m_sLocation.m_dLeft=0;
+	m_sLocation.m_dTop = 0;
+	m_sLocation.m_dWidth=0;
+	m_sLocation.m_dHeight=0;
+	CEnumVariant::Create(&m_pEnumVar);
+}
+
+CMAccessible::~CMAccessible()
+{
+	if(m_pszName!=NULL)
+	{
+		SAFE_SYSFREESTRING(m_pszName);
+		m_pszName=NULL;
+	}
+	if(m_pszValue!=NULL)
+	{
+		SAFE_SYSFREESTRING(m_pszValue);
+		m_pszValue=NULL;
+	}
+	if(m_pszDescription!=NULL)
+	{
+		SAFE_SYSFREESTRING(m_pszDescription);
+		m_pszDescription=NULL;
+	}
+
+	if(m_pszActionDescription!=NULL)
+	{
+		SAFE_SYSFREESTRING(m_pszActionDescription);
+		m_pszActionDescription=NULL;
+	}
+
+	if(m_pIParent)
+	{
+		m_pIParent->Release();
+		m_pIParent=NULL;
+	}
+	pRef = NULL;
+	m_pEnumVar->Release();
+	m_containedObjects.clear();
+	pRContext = NULL;
+}
+
+/**
+* Returns the Parent IAccessible interface pointer to AT. 
+* It should add reference, and the client should release the component.
+* It should return E_FAIL when the parent point is null.
+* @param	ppdispParent [in,out] used to return the parent interface point.
+*			when the point is null, should return null.
+* @return   S_OK if successful and E_FAIL if the m_pIParent is NULL.
+*/
+STDMETHODIMP CMAccessible::get_accParent(IDispatch **ppdispParent)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(ppdispParent == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		if(m_pIParent)
+		{
+			*ppdispParent = m_pIParent;
+			(*ppdispParent)->AddRef();
+			return S_OK;
+		}
+		else if(m_hwnd)
+		{
+			HRESULT hr = AccessibleObjectFromWindow(m_hwnd, OBJID_WINDOW, IID_IAccessible, (void**)ppdispParent);
+			if( ! SUCCEEDED( hr ) || ! ppdispParent )
+			{
+				return S_FALSE;
+			}
+			return S_OK;
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns child count of current COM object. 
+* @param	pcountChildren [in,out] used to return the children count.
+* @return   S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::get_accChildCount(long *pcountChildren)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pcountChildren == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		if(!pUNOInterface)
+			return S_FALSE;
+
+		Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+		if( pRContext.is() )
+		{
+			*pcountChildren = pRContext->getAccessibleChildCount();
+		}
+
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns child interface pointer for AT according to input child ID. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	ppdispChild, [in,out] use to return the child interface point.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accChild(VARIANT varChild, IDispatch **ppdispChild)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(ppdispChild == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt==VT_I4)
+		{
+			//get child interface pointer due to child ID
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				AddRef();
+				*ppdispChild = this;
+				return S_OK;
+			}
+			*ppdispChild = GetChildInterface(varChild.lVal);
+			(*ppdispChild)->AddRef();
+			return (*ppdispChild)?S_OK:S_FALSE;
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible name of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszName, [in,out] use to return the name of the proper object.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accName(VARIANT varChild, BSTR *pszName)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszName == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				SAFE_SYSFREESTRING(*pszName);
+				*pszName = SysAllocString(m_pszName);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accName(varChild,pszName);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible value of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszValue, [in,out] use to return the value of the proper object.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accValue(VARIANT varChild, BSTR *pszValue)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if( pszValue == NULL )
+		{
+			return E_INVALIDARG;
+		}
+		if( varChild.vt==VT_I4 )
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				if(m_dState & STATE_SYSTEM_PROTECTED)
+					return E_ACCESSDENIED;
+
+				if ( m_pszValue !=NULL && wcslen(m_pszValue) == 0 )
+					return S_OK;
+
+				SAFE_SYSFREESTRING(*pszValue);
+				*pszValue = SysAllocString(m_pszValue);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accValue(varChild,pszValue);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible description of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszDescription, [in,out] use to return the description of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accDescription(VARIANT varChild, BSTR *pszDescription)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszDescription == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				SAFE_SYSFREESTRING(*pszDescription);
+				*pszDescription = SysAllocString(m_pszDescription);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accDescription(varChild,pszDescription);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible role of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pvarRole, [in,out] use to return the role of the proper object.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accRole(VARIANT varChild, VARIANT *pvarRole)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarRole == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt == VT_I4)
+		{
+
+			if(varChild.lVal == CHILDID_SELF)
+			{
+				if( m_iRole < IA2_ROLE_CAPTION )
+				{
+					VariantInit(pvarRole);
+					pvarRole->vt = VT_I4;
+					pvarRole->lVal = m_iRole;
+				}
+				else
+				{
+					VariantInit(pvarRole);
+					pvarRole->vt = VT_I4;
+					pvarRole->lVal = ROLE_SYSTEM_CLIENT;
+				}
+				return S_OK;
+			}
+
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accRole(varChild,pvarRole);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible state of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pvarState, [in,out] use to return the state of the proper object.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accState(VARIANT varChild, VARIANT *pvarState)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarState == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal == CHILDID_SELF)
+			{
+				if(pUNOInterface)
+				{
+					Reference< XAccessibleContext > pContext = pUNOInterface->getAccessibleContext();
+					if(pContext.is())
+					{
+						// add the STATE_SYSTEM_LINKED state
+						Reference< XAccessibleHypertext > pRHypertext(pContext,UNO_QUERY);
+						if(pRHypertext.is())
+						{
+							if( pRHypertext->getHyperLinkCount() > 0 )
+								m_dState |= STATE_SYSTEM_LINKED;
+							else
+								m_dState &= ~STATE_SYSTEM_LINKED;
+						}
+						else
+							m_dState &= ~STATE_SYSTEM_LINKED;
+					}
+				}
+
+				VariantInit(pvarState);
+				pvarState->vt = VT_I4;
+				pvarState->lVal = m_dState;
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accState(varChild,pvarState);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the accessible helpString of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszHelp, [in,out] use to return the helpString of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accHelp(VARIANT, BSTR *)
+{
+	return E_NOTIMPL;
+}
+
+/**
+* Returns the accessible HelpTopic of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszHelpFile, [in,out] use to return the HelpTopic of the proper object.
+* @param	pidTopic, use to return the HelpTopic ID of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+* Not implemented yet
+*/
+STDMETHODIMP CMAccessible::get_accHelpTopic(BSTR *, VARIANT, long *)
+{
+	return E_NOTIMPL;
+}
+
+static void GetMnemonicChar( const ::rtl::OUString& aStr, WCHAR* wStr)
+{
+	int  nLen    = aStr.pData->length;
+	int  i       = 0;
+	WCHAR* text = aStr.pData->buffer;
+
+	while ( i < nLen )
+	{
+		if ( text[i] == L'~' )
+			if ( text[i+1] != L'~' )
+			{
+				wStr[0] = text[i+1];
+				break;
+			}
+			i++;
+	}
+}
+
+/**
+* Returns the accessible keyboard shortcut of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pszKeyboardShortcut, [in,out] use to return the kbshortcut of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accKeyboardShortcut(VARIANT varChild, BSTR *pszKeyboardShortcut)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+
+		ISDESTROY()
+		// #CHECK#
+		if(pszKeyboardShortcut == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal == CHILDID_SELF)
+			{
+				if( pUNOInterface )
+				{
+					Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+					if( !pRContext.is() )
+						return S_FALSE;
+
+					Reference<XAccessibleAction> pRXI(pRContext,UNO_QUERY);
+
+					OLECHAR wString[64]={0};
+
+					if( pRXI.is() && pRXI->getAccessibleActionCount() >= 1)
+					{
+						Reference< XAccessibleKeyBinding > binding = pRXI->getAccessibleActionKeyBinding(0);
+						if( binding.is() )
+						{
+							long nCount = binding->getAccessibleKeyBindingCount();
+							if(nCount >= 1)
+							{
+								CAccAction::GetkeyBindingStrByXkeyBinding( binding->getAccessibleKeyBinding(0),wString );
+							}
+						}
+					}
+					if(wString[0] == 0)
+					{
+						Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+						if(!pRrelationSet.is())
+						{
+							return S_FALSE;
+						}
+
+						long nRelCount = pRrelationSet->getRelationCount();
+
+						// Modified by Steve Yin, for SODC_1552
+						if( /*nRelCount <= 0 &&*/ m_iRole == ROLE_SYSTEM_TEXT )
+						{
+							VARIANT varParentRole;
+							VariantInit( &varParentRole );
+
+							m_pIParent->get_accRole(varChild, &varParentRole);
+
+							if( m_pIParent && varParentRole.lVal == ROLE_SYSTEM_COMBOBOX ) // edit in comoboBox
+							{
+								m_pIParent->get_accKeyboardShortcut(varChild, pszKeyboardShortcut);
+								return S_OK;
+							}
+						}
+
+						AccessibleRelation *paccRelation = NULL;
+						AccessibleRelation accRelation;
+						for(int i=0; i<nRelCount ; i++)
+						{
+							if( pRrelationSet->getRelation(i).RelationType == 6 )
+							{
+								accRelation = pRrelationSet->getRelation(i);
+								paccRelation = &accRelation;
+							}
+						}
+
+						if(paccRelation == NULL)
+							return S_FALSE;
+
+						Sequence< Reference< XInterface > > xTargets = paccRelation->TargetSet;
+						Reference<XInterface> pRAcc = xTargets[0];
+
+						XAccessible* pXAcc = (XAccessible*)pRAcc.get();
+
+						Reference<XAccessibleContext> pRLebelContext = pXAcc->getAccessibleContext();
+						if(!pRLebelContext.is())
+							return S_FALSE;
+
+						pRrelationSet = pRLebelContext->getAccessibleRelationSet();
+						nRelCount = pRrelationSet->getRelationCount();
+
+						paccRelation = NULL;
+						for(int j=0; j<nRelCount ; j++)
+						{
+							if( pRrelationSet->getRelation(j).RelationType == 5 )
+							{
+								accRelation = pRrelationSet->getRelation(j);
+								paccRelation = &accRelation;
+							}
+						}
+
+						if(paccRelation)
+						{
+							xTargets = paccRelation->TargetSet;
+							pRAcc = xTargets[0];
+							if(pUNOInterface != (XAccessible*)pRAcc.get())
+								return S_FALSE;
+						}
+
+						Reference<XAccessibleExtendedComponent> pRXIE(pRLebelContext,UNO_QUERY);
+						if(!pRXIE.is())
+							return S_FALSE;
+
+						::rtl::OUString ouStr = pRXIE->getTitledBorderText();
+						WCHAR key[2] = {NULL};
+						GetMnemonicChar(ouStr, key);
+						if(key[0] != 0)
+						{
+							wcscat(wString, L"Alt+");
+							wcscat(wString, key);
+						}
+						else
+							return S_FALSE;
+					}
+
+					SAFE_SYSFREESTRING(*pszKeyboardShortcut);
+					*pszKeyboardShortcut = SysAllocString(wString);
+
+					return S_OK;
+				}
+				else
+				{
+					return S_FALSE;
+				}
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+
+			return pChild->get_accKeyboardShortcut(varChild,pszKeyboardShortcut);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the current focused child to AT. 
+* @param	pvarChild, [in,out] vt member of pvarChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::get_accFocus(VARIANT *pvarChild)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarChild == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if( m_dFocusChildID==UACC_NO_FOCUS )
+		{
+			pvarChild->vt = VT_EMPTY;//no focus on the object and its children
+			return S_OK;
+		}
+		//if the descendant of current object has focus indicated by m_dFocusChildID, return the IDispatch of this focused object
+		else
+		{
+			IMAccessible* pIMAcc = NULL;
+			g_pAgent->GetIAccessibleFromResID(m_dFocusChildID,&pIMAcc);
+			pIMAcc->AddRef();
+			pvarChild->vt = VT_DISPATCH;
+			pvarChild->pdispVal = pIMAcc;
+
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the selection of the current COM object to AT. 
+* @param	pvarChildren,[in,out]
+* if selection num is 0,return VT_EMPTY for vt,
+* if selection num is 1,return VT_I4 for vt,and child index for lVal
+* if selection num >1,return VT_UNKNOWN for vt, and IEnumVariant* for punkVal
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::get_accSelection(VARIANT *pvarChildren)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarChildren == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		switch(m_pEnumVar->GetCountOfElements())
+		{
+		case 0:
+			pvarChildren->vt = VT_EMPTY;
+			break;
+		case 1:
+			VARIANT varTmp[1];
+			ULONG count;
+			VariantInit(&varTmp[0]);
+			m_pEnumVar->Next(1,varTmp,&count);
+			if(count!=1)
+				return S_FALSE;
+			pvarChildren->vt = VT_I4;
+			pvarChildren->lVal = varTmp[0].lVal;
+			VariantClear(&varTmp[0]);
+			m_pEnumVar->Reset();
+			break;
+		default:
+			pvarChildren->vt = VT_UNKNOWN;
+			m_pEnumVar->AddRef();
+			pvarChildren->punkVal = m_pEnumVar;
+			break;
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the location of the current COM object self or its one child to AT. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	pxLeft, [in,out] use to return the x-coordination of the proper object.
+* @param	pyTop,  [in,out] use to return the y-coordination of the proper object.
+* @param	pcxWidth, [in,out] use to return the x-coordination width of the proper object.
+* @param	pcyHeight, [in,out] use to return the y-coordination height of the proper object.
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::accLocation(long *pxLeft, long *pyTop, long *pcxWidth, long *pcyHeight, VARIANT varChild)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pxLeft == NULL || pyTop == NULL || pcxWidth == NULL || pcyHeight == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+
+				if(pUNOInterface)
+				{
+					Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+					if( !pRContext.is() )
+						return S_FALSE;
+					Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY);
+					if( !pRComponent.is() )
+						return S_FALSE;
+
+					::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen();
+					::com::sun::star::awt::Size pCSize = pRComponent->getSize();
+					*pxLeft = pCPoint.X;
+					*pyTop =  pCPoint.Y;
+					*pcxWidth = pCSize.Width;
+					*pcyHeight = pCSize.Height;
+					return S_OK;
+				}
+				else
+				{
+					*pxLeft = m_sLocation.m_dLeft;
+					*pyTop = m_sLocation.m_dTop;
+					*pcxWidth = m_sLocation.m_dWidth;
+					*pcyHeight = m_sLocation.m_dHeight;
+					return S_OK;
+				}
+			}
+
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Returns the current focused child to AT. 
+* @param	navDir, the direction flag of the navigation.
+* @param	varStart, the start child id of this navigation action.
+* @param	pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::accNavigate(long navDir, VARIANT varStart, VARIANT *pvarEndUpAt)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarEndUpAt == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		HRESULT ret = E_FAIL;
+		switch (navDir)
+		{
+		case NAVDIR_FIRSTCHILD:
+			ret = GetFirstChild(varStart,pvarEndUpAt);
+			break;
+		case NAVDIR_LASTCHILD:
+			ret = GetLastChild(varStart,pvarEndUpAt);
+			break;
+		case NAVDIR_NEXT:
+			ret = GetNextSibling(varStart,pvarEndUpAt);
+			break;
+		case NAVDIR_PREVIOUS:
+			ret = GetPreSibling(varStart,pvarEndUpAt);
+			break;
+		case NAVDIR_DOWN://do not implement temporarily
+			break;
+		case NAVDIR_UP://do not implement temporarily
+			break;
+		case NAVDIR_LEFT://do not implement temporarily
+			break;
+		case NAVDIR_RIGHT://do not implement temporarily
+			break;
+		default:
+			break;
+		};
+		return ret;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::accHitTest(long xLeft, long yTop, VARIANT *pvarChild)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarChild == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		long x, y, w, h;
+		VARIANT varSelf;
+		VariantInit(&varSelf);
+		varSelf.vt = VT_I4;
+		varSelf.lVal = CHILDID_SELF;
+		accLocation(&x,&y,&w,&h,varSelf);
+		if( (x < xLeft && (x + w) >xLeft) && (y < yTop && (y + h) >yTop) )
+		{
+			int i, nCount;
+			pvarChild->vt = VT_EMPTY;
+			Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+			nCount = pRContext->getAccessibleChildCount();
+			if(nCount > 256)
+				return E_FAIL;
+			IMAccessible* child = NULL;
+			for( i = 0; i<nCount; i++)
+			{
+
+				child = GetChildInterface(i + 1);
+				if(child && child->accHitTest(xLeft,yTop,pvarChild) == S_OK)
+					break;
+			}
+
+			if(pvarChild->vt == VT_DISPATCH)
+				return S_OK;
+
+			if( i < nCount)
+			{
+				pvarChild->vt = VT_DISPATCH;
+				pvarChild->pdispVal = child;
+				child->AddRef();
+			}
+			else
+			{
+				pvarChild->vt = VT_I4;
+				pvarChild->lVal = CHILDID_SELF;
+			}
+			return S_OK;
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Get The other Interface from CMAccessible. 
+* @param	guidService, must be IID_IAccessible here.
+* @param	riid, the IID interface .
+* @return   S_OK if successful and S_FALSE if failure.
+*/
+STDMETHODIMP CMAccessible::QueryService(REFGUID guidService, REFIID riid, void** ppvObject)
+{
+	if( InlineIsEqualGUID(guidService, IID_IAccessible) )
+		return QueryInterface(riid, ppvObject);
+	return S_FALSE;
+}
+
+/**
+* Set the accessible name of the current COM object self or its one child from UNO. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	szName, the name used to set the name of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::put_accName(VARIANT varChild, BSTR szName)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				SAFE_SYSFREESTRING(m_pszName);
+				m_pszName=SysAllocString(szName);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->put_accName(varChild,szName);
+		}
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible value of the current COM object self or its one child from UNO. 
+* @param	varChild, vt member of varChild must be VT_I4,and lVal member stores the child ID,
+* the child ID specify child index from 0 to children count, 0 stands for object self.
+* @param	szValue, the value used to set the value of the proper object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::put_accValue(VARIANT varChild, BSTR szValue)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				SysAllocString(m_pszValue);
+				m_pszValue=SysAllocString(szValue);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->put_accValue(varChild,szValue);
+		}
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible name of the current COM object self from UNO. 
+* @param	pszName, the name value used to set the name of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccName(const OLECHAR __RPC_FAR *pszName)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszName == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		SAFE_SYSFREESTRING(m_pszName);//??
+		m_pszName = SysAllocString(pszName);
+		if(m_pszName==NULL)
+			return E_FAIL;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible role of the current COM object self from UNO. 
+* @param	pRole, the role value used to set the role of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccRole(unsigned short pRole)
+{
+	m_iRole = pRole;
+	return S_OK;
+}
+
+/**
+* Add one state into the current state set for the current COM object from UNO. 
+* @param	pXSate, the state used to set the name of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::DecreaseState(DWORD pXSate)
+{
+	m_dState &= (~pXSate);
+	return S_OK;
+}
+
+/**
+* Delete one state into the current state set for the current COM object from UNO. 
+* @param	pXSate, the state used to set the name of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::IncreaseState(DWORD pXSate)
+{
+	m_dState |= pXSate;
+	return S_OK;
+}
+
+/**
+* Set state into the current state set for the current COM object from UNO. 
+* @param	pXSate, the state used to set the name of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::SetState(DWORD pXSate)
+{
+	m_dState = pXSate;
+	return S_OK;
+}
+
+
+
+/**
+* Set the accessible description of the current COM object self from UNO. 
+* @param	pszDescription, the name used to set the description of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccDescription(const OLECHAR __RPC_FAR *pszDescription)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszDescription == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		SAFE_SYSFREESTRING(m_pszDescription);
+		m_pszDescription = SysAllocString(pszDescription);
+
+		if(m_pszDescription==NULL)
+			return E_FAIL;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the accessible value of the current COM object self from UNO. 
+* @param	pszAccValue, the name used to set the value of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccValue(const OLECHAR __RPC_FAR *pszAccValue)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszAccValue == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		SAFE_SYSFREESTRING(m_pszValue);
+		m_pszValue = SysAllocString(pszAccValue);
+		if(m_pszValue==NULL)
+			return E_FAIL;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set the HWND value of the current COM object self from UNO. It should set the parent IAccessible
+* Object through the method AccessibleObjectFromWindow(...).
+* @param	hwnd, the HWND used to set the value of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccWindowHandle(HWND hwnd)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		m_hwnd = hwnd;
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Set accessible focus by specifying child ID
+* @param	dChildID, the child id identifies the focus child.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccFocus(long dChildID)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+
+		if(dChildID==CHILDID_SELF)
+		{
+			if(m_pIParent)
+			{
+				m_pIParent->Put_XAccFocus(m_dChildID);
+			}
+		}
+		else
+		{
+			m_dFocusChildID = dChildID;
+			//traverse all ancestors to set the focused child ID so that when the get_accFocus is called on 
+			//any of the ancestors, this id can be used to get the IAccessible of focused object. 
+			if(m_pIParent)
+			{
+				m_pIParent->Put_XAccFocus(dChildID);
+			}
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+*Set accessible object location for the current COM object
+* @param	sLocation, the location of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccLocation(const Location sLocation)
+{
+
+	this->m_sLocation = sLocation;
+	return S_OK;
+}
+
+/**
+* Set accessible parent object for the current COM object if 
+* the current object is a child of some COM object
+* @param	pIParent, the parent of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccParent(IMAccessible __RPC_FAR *pIParent)
+{
+	this->m_pIParent = pIParent;
+
+	if(pIParent)
+		m_pIParent->AddRef();
+
+	return S_OK;
+}
+
+/**
+* Set unique child id to COM
+* @param	dChildID, the id of the current object.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccChildID(long dChildID)
+{
+
+	this->m_dChildID = dChildID;
+	return S_OK;
+}
+
+/**
+* Set AccObjectManagerAgent object pointer to COM
+* @param	pAgent, the AccObjectManagerAgent point.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::Put_XAccAgent(long pAgent)
+{
+	g_pAgent = (AccObjectManagerAgent*)pAgent;
+	return S_OK;
+}
+
+/**
+* When a UNO control disposing, it disposes its listeners,
+* then notify AccObject in bridge management, then notify 
+* COM that the XAccessible is invalid,so set pUNOInterface as NULL
+* @param	isDestroy, true is it need to be destroyed.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+STDMETHODIMP CMAccessible::NotifyDestroy(BOOL isDestroy)
+{
+
+	m_isDestroy = isDestroy;
+	pUNOInterface = NULL;
+	return S_OK;
+}
+
+/**
+*private methods that help implement public functions
+*/
+
+/**
+* Return child interface pointer by child ID,note: need to call AddRef()
+* @param	lChildID, specify child index,which AT(such as Inspect32) gives.
+* @return  IMAccessible*, pointer to the corresponding child object.
+*/
+IMAccessible* CMAccessible::GetChildInterface(long dChildID)//for test
+{
+
+	long dChildIndex = 0;
+	if(dChildID<0)
+	{
+		if(g_pAgent)
+		{
+			IMAccessible* pIMAcc = NULL;
+			g_pAgent->GetIAccessibleFromResID(dChildID,&pIMAcc);
+			return pIMAcc;
+		}
+		return NULL;
+	}
+	else
+	{
+		Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+		if( !pRContext.is() )
+			return NULL;
+
+		if(dChildID<1 || dChildID>pRContext->getAccessibleChildCount())
+			return NULL;
+
+		IAccessible* pChild = NULL;
+		Reference< XAccessible > pXChild = pRContext->getAccessibleChild(dChildID-1);
+		BOOL isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild);
+
+		if(!isGet)
+		{
+			g_pAgent->InsertAccObj(pXChild.get(),pUNOInterface,(long)m_hwnd);
+			isGet = get_IAccessibleFromXAccessible((long)pXChild.get(),&pChild);
+		}
+
+		if(isGet)
+		{
+			IMAccessible* pIMAcc =  (IMAccessible*)pChild;
+			return pIMAcc;
+		}
+	}
+
+	return NULL;
+}
+
+/**
+* For List, tree and table,these roles belong to manage_decendant in UNO,
+* need to process specifically when navigate
+* @return  BOOL, if it is decendantmanager, return true.
+*/
+BOOL CMAccessible::IsDecendantManage()
+{
+
+	return (m_iRole==ROLE_SYSTEM_LIST)||(m_iRole==ROLE_SYSTEM_OUTLINE)||(m_iRole==ROLE_SYSTEM_TABLE);
+}
+
+/**
+* for decendantmanager circumstance,provide child interface when navigate
+* @param	varCur, the current child.
+* @param	flags, the navigation direction.
+* @return  IMAccessible*, the child of the end up node.
+*/
+IMAccessible* CMAccessible::GetNavigateChildForDM(VARIANT varCur, short flags)
+{
+
+	XAccessibleContext* pXContext = GetContextByXAcc(pUNOInterface);
+	if(pXContext==NULL)
+	{
+		return NULL;
+	}
+
+	int count = pXContext->getAccessibleChildCount();
+	if(count<1)
+	{
+		return NULL;
+	}
+
+	IMAccessible* pCurChild = NULL;
+	XAccessible* pChildXAcc = NULL;
+	Reference<XAccessible> pRChildXAcc;
+	XAccessibleContext* pChildContext = NULL;
+	int index = 0,delta=0;
+	switch(flags)
+	{
+	case DM_FIRSTCHILD:
+		pRChildXAcc = pXContext->getAccessibleChild(0);
+		break;
+	case DM_LASTCHILD:
+		pRChildXAcc = pXContext->getAccessibleChild(count-1);
+		break;
+	case DM_NEXTCHILD:
+	case DM_PREVCHILD:
+		pCurChild = GetChildInterface(varCur.lVal);
+		if(pCurChild==NULL)
+		{
+			return NULL;
+		}
+		pCurChild->GetUNOInterface((long*)&pChildXAcc);
+		if(pChildXAcc==NULL)
+		{
+			return NULL;
+		}
+		pChildContext = GetContextByXAcc(pChildXAcc);
+		if(pChildContext == NULL)
+		{
+			return NULL;
+		}
+		delta = (flags==DM_NEXTCHILD)?1:-1;
+		//currently, getAccessibleIndexInParent is error in UNO for
+		//some kind of List,such as ValueSet, the index will be less 1 than
+		//what should be, need to fix UNO code
+		index = pChildContext->getAccessibleIndexInParent()+delta;
+		if((index>=0)&&(index<=count-1))
+		{
+			pRChildXAcc = pXContext->getAccessibleChild(index);
+		}
+		break;
+	default:
+		break;
+	}
+
+	if(!pRChildXAcc.is())
+	{
+		return NULL;
+	}
+	pChildXAcc = pRChildXAcc.get();
+	g_pAgent->InsertAccObj(pChildXAcc,pUNOInterface);
+	return g_pAgent->GetIMAccByXAcc(pChildXAcc);
+}
+
+/**
+*the following 4 private methods are for accNavigate implementation
+*/
+
+/**
+* Return first child for parent container, process differently according 
+* to whether it is decendant manage
+* @param	varStart, the start child id of this navigation action.
+* @param	pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarEndUpAt == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varStart.vt != VT_I4)
+		{
+			pvarEndUpAt->vt = VT_EMPTY;
+			return E_INVALIDARG;
+		}
+
+		pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_FIRSTCHILD);
+		if(pvarEndUpAt->pdispVal)
+		{
+			pvarEndUpAt->pdispVal->AddRef();
+			pvarEndUpAt->vt = VT_DISPATCH;
+			return S_OK;
+		}
+
+		pvarEndUpAt->vt = VT_EMPTY;
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Return last child for parent container, process differently according 
+* to whether it is decendant manage
+* @param	varStart, the start child id of this navigation action.
+* @param	pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarEndUpAt == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varStart.vt != VT_I4)
+		{
+			pvarEndUpAt->vt = VT_EMPTY;
+			return E_INVALIDARG;
+		}
+
+		pvarEndUpAt->pdispVal = GetNavigateChildForDM(varStart, DM_LASTCHILD);
+		if(pvarEndUpAt->pdispVal)
+		{
+			pvarEndUpAt->pdispVal->AddRef();
+			pvarEndUpAt->vt = VT_DISPATCH;
+			return S_OK;
+		}
+		pvarEndUpAt->vt = VT_EMPTY;
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* The method GetNextSibling is general, whatever it is decendant manage or not
+* Get the next sibling object.
+* @param	varStart, the start child id of this navigation action.
+* @param	pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(varStart.vt != VT_I4)
+		{
+			pvarEndUpAt->vt = VT_EMPTY;
+			return E_INVALIDARG;
+		}
+
+		Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+		if(pRContext.is())
+		{
+			varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent() + 2);
+			if(m_pIParent)
+				if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK)
+				{
+					pvarEndUpAt->vt = VT_DISPATCH;
+					return S_OK;
+				}
+		}
+		pvarEndUpAt->vt = VT_EMPTY;
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+*the method GetPreSibling is general, whatever it is decendant manage or not
+* @param	varStart, the start child id of this navigation action.
+* @param	pvarEndUpAt, [in,out] the end up child of this navigation action.
+* @return   S_OK if successful and E_FAIL if failure.
+*/
+HRESULT CMAccessible::GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pvarEndUpAt == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varStart.vt != VT_I4)
+		{
+			pvarEndUpAt->vt = VT_EMPTY;
+			return E_INVALIDARG;
+		}
+
+		Reference< XAccessibleContext > pRContext = GetContextByXAcc(pUNOInterface);
+		if(pRContext.is())
+		{
+			varStart.iVal = sal_Int16(pRContext->getAccessibleIndexInParent());
+			if(m_pIParent && varStart.iVal > 0)
+				if( m_pIParent->get_accChild(varStart,&pvarEndUpAt->pdispVal) == S_OK)
+				{
+					pvarEndUpAt->vt = VT_DISPATCH;
+					return S_OK;
+				}
+		}
+		pvarEndUpAt->vt = VT_EMPTY;
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* For IAccessible2 implementation methods
+*/
+STDMETHODIMP CMAccessible::get_nRelations( long __RPC_FAR *nRelations)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+
+		// #CHECK#
+		if(nRelations == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		*nRelations = 0;
+
+		if( !pRContext.is() )
+			return E_FAIL;
+		Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+		if(!pRrelationSet.is())
+		{
+			*nRelations = 0;
+			return S_OK;
+		}
+
+		*nRelations = pRrelationSet->getRelationCount();
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::get_relation( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(relation == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		if( !pRContext.is() )
+			return E_FAIL;
+
+
+		long nMax = 0;
+		long nReal = 0;
+		get_nRelations(&nMax);
+
+		*relation = (IAccessibleRelation*)::CoTaskMemAlloc(sizeof(IAccessibleRelation));
+
+		// #CHECK Memory Allocation#
+		if(*relation == NULL)
+		{
+			return E_FAIL;
+		}
+
+		if( relationIndex < nMax )
+		{
+
+
+			Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+			if(!pRrelationSet.is())
+			{
+
+				return E_FAIL;
+			}
+
+			IAccessibleRelation* pRelation = NULL;
+			ActivateActContext();
+			HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER ,
+				IID_IAccessibleRelation,
+				(void **)&pRelation);
+			DeactivateActContext();
+			if(SUCCEEDED(hr))
+			{
+				IUNOXWrapper* wrapper = NULL;
+				hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+				if(SUCCEEDED(hr))
+				{
+					AccessibleRelation accRelation = pRrelationSet->getRelation(relationIndex);
+					wrapper->put_XSubInterface((long)&accRelation);
+					wrapper->Release();
+					*relation = pRelation;
+					return S_OK;
+				}
+
+			}
+		}
+
+		return E_FAIL;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::get_relations( long, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+
+		// #CHECK#
+		if(relation == NULL || nRelations == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		// #CHECK XInterface#
+
+		if( !pRContext.is() )
+			return E_FAIL;
+
+		Reference<XAccessibleRelationSet> pRrelationSet = pRContext.get()->getAccessibleRelationSet();
+		if(!pRrelationSet.is())
+		{
+			*nRelations = 0;
+			return S_OK;
+		}
+
+		long nCount = pRrelationSet->getRelationCount();
+
+		*relation = (IAccessibleRelation*)::CoTaskMemAlloc(nCount*sizeof(IAccessibleRelation));
+
+		// #CHECK Memory Allocation#
+		if(*relation == NULL)
+		{
+			return E_FAIL;
+		}
+
+		for(int i=0; i<nCount ; i++)
+		{
+			IAccessibleRelation* pRelation = NULL;
+			ActivateActContext();
+			HRESULT hr = CoCreateInstance( CLSID_AccRelation, NULL, CLSCTX_SERVER ,
+				IID_IAccessibleRelation,
+				(void **)&pRelation);
+			DeactivateActContext();
+			if(SUCCEEDED(hr))
+			{
+				IUNOXWrapper* wrapper = NULL;
+				hr = pRelation->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+				if(SUCCEEDED(hr))
+				{
+					AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+					wrapper->put_XSubInterface((long)&accRelation);
+					wrapper->Release();
+				}
+				(relation)[i] = pRelation;
+			}
+		}
+
+		*nRelations = nCount;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible::role(long __RPC_FAR *role)
+{
+	ENTER_PROTECTED_BLOCK
+
+		(*role) = m_iRole;
+
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_nActions(long __RPC_FAR *nActions)
+{
+
+	try
+	{
+		ISDESTROY()
+			// #CHECK#
+			if(nActions == NULL)
+			{
+				return E_INVALIDARG;
+			}
+			*nActions = 0L;
+			IAccessibleAction* pAcc = NULL;
+			HRESULT hr = QueryInterface(IID_IAccessibleAction, (void**)&pAcc);
+			if( hr == S_OK )
+			{
+				pAcc->nActions(nActions);
+				pAcc->Release();
+			}
+
+			return S_OK;
+	}
+	catch(...)
+	{
+		*nActions = 0L;
+		return S_OK;
+	}
+}
+
+
+STDMETHODIMP CMAccessible:: scrollToPoint(enum IA2CoordinateType, long, long)
+{
+
+	ENTER_PROTECTED_BLOCK
+	ISDESTROY()
+	return E_NOTIMPL;
+	LEAVE_PROTECTED_BLOCK
+
+}
+STDMETHODIMP CMAccessible:: scrollTo(enum IA2ScrollType)
+{
+
+	ENTER_PROTECTED_BLOCK
+	ISDESTROY()
+
+	return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+static XAccessible* getTheParentOfMember(XAccessible* pXAcc)
+{
+	// #CHECK#
+	if(pXAcc == NULL)
+	{
+		return NULL;
+	}
+	Reference<XAccessibleContext> pRContext = pXAcc->getAccessibleContext();
+	Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+	long nRelations = pRrelationSet->getRelationCount();
+	for(int i=0 ; i<nRelations ; i++)
+	{
+		AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+		if(accRelation.RelationType == 7)
+		{
+			Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
+			return (XAccessible*)xTargets[0].get();
+		}
+	}
+	return NULL;
+}
+
+STDMETHODIMP CMAccessible:: get_groupPosition(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(groupLevel == NULL || similarItemsInGroup == NULL || positionInGroup == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+		if(!pRContext.is())
+			return E_FAIL;
+		long Role = pRContext->getAccessibleRole();
+
+		*groupLevel = 0;
+		*similarItemsInGroup = 0;
+		*positionInGroup = 0;
+
+		if (Role != AccessibleRole::DOCUMENT)
+		{
+			Reference< XAccessibleGroupPosition > xGroupPosition( pRContext, UNO_QUERY );
+			if ( xGroupPosition.is() )
+			{
+				Sequence< sal_Int32 > rSeq = xGroupPosition->getGroupPosition( makeAny( pRContext ) );
+				sal_Int32* pSeq = rSeq.getArray();
+				if ( pSeq )
+				{
+					*groupLevel = pSeq[0];
+					*similarItemsInGroup = pSeq[1];
+					*positionInGroup = pSeq[2];
+					return S_OK;
+				}
+				return S_OK;
+			}
+		}
+
+		Reference< XAccessible> pParentAcc = pRContext->getAccessibleParent();
+		if( !pParentAcc.is() )
+		{
+			return S_OK;
+		}
+
+		Reference<XAccessibleContext> pRParentContext = pParentAcc->getAccessibleContext();
+
+		int level = 0;
+		int index = 0;
+		int number = 0;
+
+		if( Role ==  RADIO_BUTTON )
+		{
+			Reference<XAccessibleRelationSet> pRrelationSet = pRContext->getAccessibleRelationSet();
+			long nRel = pRrelationSet->getRelationCount();
+			for(int i=0 ; i<nRel ; i++)
+			{
+				AccessibleRelation accRelation = pRrelationSet->getRelation(i);
+				if(accRelation.RelationType == 7)
+				{
+					Sequence< Reference< XInterface > > xTargets = accRelation.TargetSet;
+					int nCount = xTargets.getLength();
+
+					Reference<XInterface> pRAcc = xTargets[0];
+					for(int j=0; j<pRParentContext->getAccessibleChildCount(); j++)
+					{
+						if( getTheParentOfMember(pRParentContext->getAccessibleChild(j).get())
+							== (XAccessible*)pRAcc.get() &&
+							pRParentContext->getAccessibleChild(j)->getAccessibleContext()->getAccessibleRole() == RADIO_BUTTON)
+							number++;
+						if(pRParentContext->getAccessibleChild(j).get() == pUNOInterface)
+							index = number;
+					}
+				}
+			}
+			*groupLevel = 1;
+			*similarItemsInGroup = number;
+			*positionInGroup = index;
+			return S_OK;
+		}
+
+		else if ( COMBO_BOX == Role )
+		{
+			*groupLevel = 1;
+			*similarItemsInGroup = 0;
+			*positionInGroup = -1;
+
+			long nCount = pRContext->getAccessibleChildCount();
+			if( 2 != nCount)
+			{
+				return S_OK;
+			}
+			Reference<XAccessible> xList=pRContext->getAccessibleChild(1);
+			if (!xList.is())
+			{
+				return S_OK;
+			}
+			Reference<XAccessibleContext> xListContext(xList,UNO_QUERY);
+			if (!xListContext.is())
+			{
+				return S_OK;
+			}
+			Reference<XAccessibleSelection> xListSel(xList,UNO_QUERY);
+			if (!xListSel.is())
+			{
+				return S_OK;
+			}
+			*similarItemsInGroup = xListContext->getAccessibleChildCount();
+			if (*similarItemsInGroup > 0 )
+			{
+				try
+				{
+					Reference<XAccessible> xChild = xListSel->getSelectedAccessibleChild(0);
+					if (xChild.is())
+					{
+						Reference<XAccessibleContext> xChildContext(xChild,UNO_QUERY);
+						if (xChildContext.is())
+						{
+							*positionInGroup=xChildContext->getAccessibleIndexInParent() + 1 ;
+							return S_OK;
+						}
+					}
+				}
+				catch(...)
+				{}
+			}
+			return S_OK;
+		}
+		else if ( PAGE_TAB == Role )
+		{
+			*groupLevel = 1;
+			*similarItemsInGroup = pRParentContext->getAccessibleChildCount();
+
+			if (*similarItemsInGroup > 0 )
+			{
+				*positionInGroup=pRContext->getAccessibleIndexInParent() + 1 ;
+			}
+			else
+			{
+				*positionInGroup = -1;
+			}
+			return S_OK;
+		}
+
+
+		BOOL isFound = FALSE;
+		while( pParentAcc.is() && !isFound)
+		{
+			level++;
+			pRParentContext = pParentAcc->getAccessibleContext();
+			Role = pRParentContext->getAccessibleRole();
+			if( (Role == TREE) || (Role == LIST) )
+				isFound = TRUE;
+			pParentAcc = pRParentContext->getAccessibleParent();
+		}
+
+		if( isFound )
+		{
+			Reference< XAccessible> pTempAcc = pRContext->getAccessibleParent();
+			pRParentContext = pTempAcc->getAccessibleContext();
+			*groupLevel = level;
+			*similarItemsInGroup = pRParentContext->getAccessibleChildCount();
+			*positionInGroup = pRContext->getAccessibleIndexInParent() + 1;
+		}
+		else
+		{
+			*groupLevel = 0;
+			*similarItemsInGroup = 0;
+			*positionInGroup = 0;
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_extendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+
+		return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_uniqueID(long __RPC_FAR *uniqueID)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(uniqueID == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		*uniqueID = m_dChildID;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_windowHandle(HWND __RPC_FAR *windowHandle)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(windowHandle == NULL)
+		{
+			return E_INVALIDARG;
+		}
+
+		HWND nHwnd = m_hwnd;
+		IAccessible* pParent = m_pIParent;
+		CMAccessible* pChild = this;
+		while((nHwnd==0) && pParent)
+		{
+			pChild = (CMAccessible*)pParent;
+			if(pChild)
+			{
+				pParent = (IAccessible*)pChild->m_pIParent;
+				nHwnd = (HWND)pChild->m_hwnd;
+			}
+			else
+				pParent = NULL;
+		}
+
+		*windowHandle = nHwnd;
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Get XAccessibleContext directly from UNO by the stored XAccessible pointer
+* @param	pXAcc, UNO XAccessible object point.
+* @return   XAccessibleContext*, the context of the pXAcc.
+*/
+XAccessibleContext* CMAccessible::GetContextByXAcc( XAccessible* pXAcc )
+{
+	Reference< XAccessibleContext > pRContext;
+	if( pXAcc == NULL)
+		return NULL;
+
+	pRContext = pXAcc->getAccessibleContext();
+	if( !pRContext.is() )
+		return NULL;
+	return pRContext.get();
+}
+
+/**
+* Return the member variable m_pXAccessibleSelection, instead of 
+* get XAccessibleSelection according to XAccessibleContext because if so,it will 
+* depend on the UNO implementation code,so when COM is created, put XAccessibleSelection
+* by bridge management system
+* @return   XAccessibleSelection*, the selection of the current object.
+*/
+Reference< XAccessibleSelection > CMAccessible::GetSelection()
+{
+	if( pUNOInterface == NULL )
+		return NULL;
+	Reference< XAccessibleContext > pRContext = pUNOInterface->getAccessibleContext();
+	if(pRContext.is())
+	{
+		Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+		return pRSelection;
+	}
+	return NULL;
+}
+
+/**
+* Select one XAccessible item, for accSelect implementation
+* @param	pItem, the item should be selected.
+* @return  S_OK if successful.
+*/
+HRESULT CMAccessible::SelectChild(XAccessible* pItem)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface );
+	XAccessibleContext* pContext = GetContextByXAcc( pItem );
+	if( pParentContext == NULL || pContext == NULL )
+		return E_FAIL;
+
+	Reference< XAccessibleSelection > pRSelection = GetSelection();
+	if( !pRSelection.is() )
+		return E_FAIL;
+	long Index = pContext->getAccessibleIndexInParent();
+	pRSelection->selectAccessibleChild( Index );
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Deselect one XAccessible item, for accSelect implimentation
+* @param	pItem, the item should be deselected.
+* @return  S_OK if successful.
+*/
+HRESULT CMAccessible::DeSelectChild(XAccessible* pItem)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		XAccessibleContext* pParentContext = GetContextByXAcc( pUNOInterface );
+	;
+	XAccessibleContext* pContext = GetContextByXAcc( pItem );
+	if( pParentContext == NULL || pContext == NULL )
+		return E_INVALIDARG;
+
+	Reference< XAccessibleSelection > pRSelection = GetSelection();
+	if( !pRSelection.is() )
+		return E_FAIL;
+	long Index = pContext->getAccessibleIndexInParent();
+	pRSelection->deselectAccessibleChild( Index );
+
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Select multiple XAccessible items,for implementation of accSelect
+* @param	pItem, the items should be selected.
+* @param	size, the size of the items.
+* @return  S_OK if successful.
+*/
+HRESULT	CMAccessible::SelectMutipleChidren( XAccessible** pItem,int size )
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pItem == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		for(int index = 0;index < size;index++)
+		{
+			SelectChild( pItem[index] );
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Deselect multiple XAccessible items,for implementation of accSelect
+* @param	pItem, the items should be selected.
+* @param	size, the size of the items.
+* @return  S_OK if successful.
+*/
+HRESULT CMAccessible::DeSelectMutipleChildren( XAccessible** pItem,int size )
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pItem == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		for(int index = 0;index < size;index++)
+		{
+			DeSelectChild( pItem[index] );
+		}
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* When COM is created, UNO set XAccessible pointer to it
+* in order to COM can operate UNO information
+* @param	pXAcc, the XAccessible object of current object.
+* @return  S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::SetXAccessible(long pXAcc)
+{
+	pUNOInterface = (XAccessible*)pXAcc;
+	pRef = pUNOInterface;
+	m_pEnumVar->PutSelection(/*XAccessibleSelection*/(long)pUNOInterface);
+
+	pRContext = pUNOInterface->getAccessibleContext();
+	pRContextInterface = (XAccessibleContext*)pRContext.is();
+
+	return S_OK;
+}
+
+/**
+* accSelect method has many optional flags, needs to process comprehensively
+* Mozilla and Microsoft do not implement SELFLAG_EXTENDSELECTION flag. 
+* The implementation of this flag is a little trouble-shooting,so we also
+* do not implement it now
+* @param	flagsSelect, the selection flag of the select action.
+* @param	varChild, the child object pointer of current action.
+* @return  S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::accSelect(long flagsSelect, VARIANT varChild)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if( (flagsSelect&SELFLAG_ADDSELECTION) &&
+			(SELFLAG_REMOVESELECTION&flagsSelect) )
+			return E_INVALIDARG;
+
+	if ( (flagsSelect&SELFLAG_TAKESELECTION) &&
+		(
+		(flagsSelect&SELFLAG_ADDSELECTION) ||
+		(flagsSelect&SELFLAG_REMOVESELECTION) ||
+		(flagsSelect&SELFLAG_EXTENDSELECTION )
+		)
+		)
+		return E_INVALIDARG;
+
+	if ( varChild.vt !=	VT_I4 )
+		return E_INVALIDARG;
+
+	IMAccessible* pSelectAcc;
+	if( varChild.lVal == CHILDID_SELF )
+	{
+		pSelectAcc = this;
+		pSelectAcc->AddRef();
+	}
+	else
+	{
+		pSelectAcc = GetChildInterface(varChild.lVal);
+	}
+
+	if( pSelectAcc == NULL )
+		return E_INVALIDARG;
+
+	if( flagsSelect&SELFLAG_TAKEFOCUS )
+	{
+		long pTempUNO = 0;
+		pSelectAcc->GetUNOInterface( &pTempUNO);
+
+		if( pTempUNO == NULL )
+			return NULL;
+
+		Reference< XAccessibleContext > pRContext = ( (XAccessible*)pTempUNO)->getAccessibleContext();
+		Reference< XAccessibleComponent > pRComponent(pRContext,UNO_QUERY);
+		Reference< XAccessible > pRParentXAcc = pRContext->getAccessibleParent();
+		Reference< XAccessibleContext > pRParentContext = pRParentXAcc->getAccessibleContext();
+		Reference< XAccessibleComponent > pRParentComponent(pRParentContext,UNO_QUERY);
+		Reference< XAccessibleSelection > pRParentSelection(pRParentContext,UNO_QUERY);
+
+
+		pRComponent->grabFocus();
+
+		if( flagsSelect & SELFLAG_TAKESELECTION )
+		{
+			pRParentSelection->clearAccessibleSelection();
+			pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+		}
+
+		if( flagsSelect & SELFLAG_ADDSELECTION  )
+		{
+			pRParentSelection->selectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+		}
+
+		if( flagsSelect & SELFLAG_REMOVESELECTION )
+		{
+			pRParentSelection->deselectAccessibleChild( pRContext->getAccessibleIndexInParent() );
+		}
+
+		if( flagsSelect & SELFLAG_EXTENDSELECTION  )
+		{
+			long indexInParrent = pRContext->getAccessibleIndexInParent();
+
+			if( pRParentSelection->isAccessibleChildSelected( indexInParrent + 1 ) ||
+				pRParentSelection->isAccessibleChildSelected( indexInParrent - 1 ) )
+			{
+				pRParentSelection->selectAccessibleChild( indexInParrent );
+			}
+		}
+
+	}
+
+	pSelectAcc->Release();
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* Return XAccessible interface pointer when needed
+* @param pXAcc, [in, out] the Uno interface of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::GetUNOInterface(long* pXAcc)
+{
+	// #CHECK#
+	if(pXAcc == NULL)
+		return E_INVALIDARG;
+
+	*pXAcc = (long)pUNOInterface;
+	return S_OK;
+}
+
+/**
+* Helper method for Implementation of get_accDefaultAction
+* @param pAction, the default action point of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::SetDefaultAction(long pAction)
+{
+	m_pXAction = (XAccessibleAction*)pAction;
+	return S_OK;
+}
+
+/**
+* This method is called when AT open some UI elements initially
+* the UI element takes the default action defined here
+* @param varChild, the child id of the defaultaction.
+* @param pszDefaultAction,[in/out] the description of the current action.
+* @return S_OK if successful.
+*/
+HRESULT STDMETHODCALLTYPE CMAccessible::get_accDefaultAction(VARIANT varChild, BSTR *pszDefaultAction)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(pszDefaultAction == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		if(varChild.vt==VT_I4)
+		{
+			if(varChild.lVal==CHILDID_SELF)
+			{
+				if( m_pXAction == NULL )
+					return DISP_E_MEMBERNOTFOUND;
+				SAFE_SYSFREESTRING(*pszDefaultAction);
+				*pszDefaultAction = SysAllocString(m_pszActionDescription);
+				return S_OK;
+			}
+
+			long lVal = varChild.lVal;
+			varChild.lVal = CHILDID_SELF;
+			IMAccessible *pChild = this->GetChildInterface(lVal);
+			if(!pChild)
+				return E_FAIL;
+			return pChild->get_accDefaultAction(varChild,pszDefaultAction);
+		}
+		return S_FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* AT call this method to operate application
+* @param varChild, the child id of the action object.
+* @return S_OK if successful.
+*/
+HRESULT STDMETHODCALLTYPE CMAccessible::accDoDefaultAction(VARIANT varChild)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if( varChild.vt != VT_I4 )
+			return E_INVALIDARG;
+	if( m_pXAction == NULL )
+		return E_FAIL;
+	if( m_pXAction->getAccessibleActionCount() == 0 )
+		return E_FAIL;
+
+	if(varChild.lVal==CHILDID_SELF)
+	{
+		if(m_pXAction->getAccessibleActionCount() > 0)
+			m_pXAction->doAccessibleAction(0);
+		return S_OK;
+	}
+
+	long lVal = varChild.lVal;
+	varChild.lVal = CHILDID_SELF;
+	IMAccessible *pChild = this->GetChildInterface(lVal);
+	if(!pChild)
+		return E_FAIL;
+	return pChild->accDoDefaultAction( varChild );
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+/**
+* UNO set description information for action to COM.
+* @param szAction, the action description of the current object.
+* @return S_OK if successful.
+*/
+STDMETHODIMP CMAccessible::Put_ActionDescription( const OLECHAR* szAction)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(szAction == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		SAFE_SYSFREESTRING(m_pszActionDescription );
+		m_pszActionDescription = SysAllocString( szAction );
+		return S_OK;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+BOOL CMAccessible::GetXInterfaceFromXAccessible(XAccessible* pXAcc, XInterface** ppXI, int index)
+{
+	Reference< XAccessibleContext > pRContext;
+
+	switch(index)
+	{
+	case XI_COMPONENT:
+		QUERYXINTERFACE(AccessibleComponent)
+			break;
+	case XI_TEXT:
+		QUERYXINTERFACE(AccessibleText)
+			break;
+	case XI_EDITABLETEXT:
+		QUERYXINTERFACE(AccessibleEditableText)
+			break;
+	case XI_TABLE:
+		QUERYXINTERFACE(AccessibleTable)
+			break;
+	case XI_SELECTION:
+		QUERYXINTERFACE(AccessibleSelection)
+			break;
+	case XI_EXTENDEDCOMP:
+		QUERYXINTERFACE(AccessibleExtendedComponent)
+			break;
+	case XI_KEYBINDING:
+		QUERYXINTERFACE(AccessibleKeyBinding)
+			break;
+	case XI_ACTION:
+		QUERYXINTERFACE(AccessibleAction)
+			break;
+	case XI_VALUE:
+		QUERYXINTERFACE(AccessibleValue)
+			break;
+	case XI_HYPERTEXT:
+		QUERYXINTERFACE(AccessibleHypertext)
+			break;
+	case XI_HYPERLINK:
+		QUERYXINTERFACE(AccessibleHyperlink)
+			break;
+	case XI_IMAGE:
+		QUERYXINTERFACE(AccessibleImage)
+			break;
+	default:
+		break;
+	}
+
+	return FALSE;
+}
+
+HRESULT WINAPI CMAccessible::SmartQI(void* pv, REFIID iid, void** ppvObject)
+{
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if( ImplIsEqualGUID(iid,IID_IAccIdentity) ||
+			ImplIsEqualGUID(iid,IID_IStdMarshalInfo) ||
+			ImplIsEqualGUID(iid,IID_IMarshal) ||
+			ImplIsEqualGUID(iid,IID_IExternalConnection)||
+			ImplIsEqualGUID(iid,IID_IOleWindow))
+			return E_FAIL;
+
+
+	_UNO_AGGMAP_ENTRY* pMap = _GetAggEntries();
+	while(pMap && pMap->piid)
+	{
+		if(ImplIsEqualGUID(iid, *pMap->piid))
+		{
+			XInterface* pXI = NULL;
+			BOOL bFound = GetXInterfaceFromXAccessible(pUNOInterface,&pXI,pMap->XIFIndex);
+			if(!bFound)
+			{
+				return E_FAIL;
+			}
+
+			XGUIDToComObjHash::iterator pIndTemp = m_containedObjects.find( iid );
+			if ( pIndTemp != m_containedObjects.end() )
+			{
+				return pIndTemp->second.p->QueryInterface( iid, ppvObject );
+			}
+			else
+			{
+				ActivateActContext();
+				HRESULT hr = pMap->pfnCreateInstance(pv, iid, ppvObject);
+				DeactivateActContext();
+				if(hr == S_OK)
+				{
+					m_containedObjects.insert(XGUIDToComObjHash::value_type(*pMap->piid,(IUnknown*)*ppvObject));
+					IUNOXWrapper* wrapper = NULL;
+					((IUnknown*)*ppvObject)->QueryInterface(IID_IUNOXWrapper, (void**)&wrapper);
+					if(wrapper)
+					{
+						wrapper->put_XInterface((long)pUNOInterface);
+						wrapper->Release();
+					}
+					return S_OK;
+				}
+			}
+			return E_FAIL;
+		}
+		pMap++;
+	}
+	return E_FAIL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+BOOL CMAccessible::get_IAccessibleFromXAccessible(long pXAcc, IAccessible **ppIA)
+{
+
+	ENTER_PROTECTED_BLOCK
+
+		// #CHECK#
+		if(ppIA == NULL)
+		{
+			return E_INVALIDARG;
+		}
+		BOOL isGet = FALSE;
+		if(g_pAgent)
+			isGet = g_pAgent->GetIAccessibleFromXAccessible((XAccessible*)pXAcc,ppIA);
+
+		if(isGet)
+			return TRUE;
+		else
+			return FALSE;
+
+		LEAVE_PROTECTED_BLOCK
+}
+
+void CMAccessible::get_OLECHARFromAny(Any& pAny, OLECHAR* pChar)
+{
+	// #CHECK#
+	if(pChar == NULL)
+		return;
+
+	switch(pAny.getValueTypeClass())
+	{
+	case TypeClass_CHAR:
+		{
+			sal_Int8 val;
+			pAny >>= val;
+			swprintf( pChar, L"%d", val);
+			break;
+		}
+	case TypeClass_BOOLEAN:
+		{
+			sal_Bool val;
+			pAny >>= val;
+			swprintf( pChar, L"%d", val);
+			break;
+		}
+	case TypeClass_BYTE:
+		{
+			sal_Int8 val;
+			pAny >>= val;
+			swprintf( pChar, L"%d", val);
+			break;
+		}
+	case TypeClass_SHORT:
+		{
+			SHORT val;
+			pAny >>= val;
+			swprintf( pChar, L"%d", val);
+			break;
+		}
+	case TypeClass_UNSIGNED_SHORT:
+		{
+			USHORT val;
+			pAny >>= val;
+			swprintf( pChar, L"%d", val);
+			break;
+		}
+	case TypeClass_LONG:
+		{
+			LONG val;
+			pAny >>= val;
+			swprintf( pChar, L"%ld", val);
+			break;
+		}
+	case TypeClass_UNSIGNED_LONG:
+		{
+			ULONG val;
+			pAny >>= val;
+			swprintf( pChar, L"%ld", val);
+			break;
+		}
+	case TypeClass_FLOAT:
+		{
+			FLOAT val;
+			pAny >>= val;
+			swprintf( pChar, L"%.3f", val);
+			break;
+		}
+	case TypeClass_DOUBLE:
+		{
+			DOUBLE val;
+			pAny >>= val;
+			swprintf( pChar, L"%.6lf", val);
+			break;
+		}
+	case TypeClass_STRING:
+		{
+			::rtl::OUString val;
+			pAny >>= val;
+			wcscpy(pChar, val.getStr());
+			break;
+		}
+	case TypeClass_SEQUENCE:
+		{
+			if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) )
+			{
+				Sequence < ::rtl::OUString > val;
+				pAny >>= val;
+
+				::rtl::OUString pString;
+
+				int count = val.getLength();
+
+				for( int iIndex = 0;iIndex < count;iIndex++ )
+				{
+					pString += val[iIndex];
+				}
+				wcscpy(pChar, pString.getStr());
+			}
+			else if (pAny.getValueType() == getCppuType( (Sequence< ::com::sun::star::style::TabStop >* )0 ) )
+			{
+				Sequence < ::com::sun::star::style::TabStop > val;
+				pAny >>= val;
+				int count = val.getLength();
+
+				for( int iIndex = 0;iIndex < count;iIndex++ )
+				{
+					OLECHAR pAttrs[512] = {NULL};
+
+					OLECHAR pAttrsPosition[512] = {NULL};
+					OLECHAR pAttrsDescimalChar[512] = {NULL};
+					OLECHAR pAttrsFillChar[512] = {NULL};
+
+					::com::sun::star::style::TabStop sigleVal = val[iIndex];
+
+					swprintf( pAttrsPosition, L"Position=%ld,TabAlign=%ld",
+						sigleVal.Position, sigleVal.Alignment);
+
+					if(sigleVal.DecimalChar==';' || sigleVal.DecimalChar == ':' || sigleVal.DecimalChar == ',' ||
+						sigleVal.DecimalChar == '=' || sigleVal.DecimalChar == '\\')
+						swprintf( pAttrsDescimalChar, L"DecimalChar=\\%c",sigleVal.DecimalChar);
+					else
+						swprintf( pAttrsDescimalChar, L"DecimalChar=%c",sigleVal.DecimalChar);
+
+					if(sigleVal.FillChar==';' || sigleVal.FillChar == ':' || sigleVal.FillChar == ',' ||
+						sigleVal.FillChar == '=' || sigleVal.FillChar == '\\')
+						swprintf( pAttrsFillChar, L"FillChar=\\%c",sigleVal.FillChar);
+					else
+						swprintf( pAttrsFillChar, L"FillChar=%c",sigleVal.FillChar);
+
+					swprintf( pAttrs, L"%s,%s,%s,",pAttrsPosition,pAttrsDescimalChar,pAttrsFillChar);
+
+					wcscat(pChar,pAttrs);
+				}
+			}
+			break;
+		}
+	case TypeClass_ENUM:
+		{
+			if (pAny.getValueType() == getCppuType( (::com::sun::star::awt::FontSlant* )0 ) )
+			{
+				com::sun::star::awt::FontSlant val;
+				pAny >>= val;
+				swprintf( pChar, L"%d", val);
+			}
+		}
+	case TypeClass_STRUCT:
+		{
+			if (pAny.getValueType() == getCppuType( (::com::sun::star::style::LineSpacing* )0 ) )
+			{
+				com::sun::star::style::LineSpacing val;
+				pAny >>= val;
+				swprintf( pChar, L"Mode=%ld,Height=%ld,", val.Mode, val.Height);
+			}
+			else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) )
+			{
+				com::sun::star::accessibility::TextSegment val;
+				pAny >>= val;
+				::rtl::OUString realVal(val.SegmentText);
+				wcscpy(pChar, realVal.getStr());
+			}
+			break;
+		}
+	case TypeClass_VOID:
+	case TypeClass_HYPER:
+	case TypeClass_UNSIGNED_HYPER:
+	case TypeClass_TYPE:
+	case TypeClass_ANY:
+	case TypeClass_TYPEDEF:
+	case TypeClass_UNION:
+	case TypeClass_EXCEPTION:
+	case TypeClass_ARRAY:
+	case TypeClass_INTERFACE:
+	case TypeClass_SERVICE:
+	case TypeClass_MODULE:
+	case TypeClass_INTERFACE_METHOD:
+	case TypeClass_INTERFACE_ATTRIBUTE:
+	case TypeClass_UNKNOWN:
+	case TypeClass_PROPERTY:
+	case TypeClass_CONSTANT:
+	case TypeClass_CONSTANTS:
+	case TypeClass_SINGLETON:
+	case TypeClass_MAKE_FIXED_SIZE:
+		break;
+	default:
+		break;
+	}
+}
+
+void CMAccessible::get_OLECHAR4Numbering(const Any& pAny, short numberingLevel,const OUString& numberingPrefix,OLECHAR* pChar)
+{
+	if(pChar == NULL)
+		return;
+	Reference< ::com::sun::star::container::XIndexReplace > pXIndex;
+	if((pAny>>=pXIndex) && (numberingLevel !=-1))//numbering level is -1,means invalid value
+	{
+		Any aAny = pXIndex->getByIndex(numberingLevel);
+		Sequence< ::com::sun::star::beans::PropertyValue > aProps;
+		aAny >>= aProps;
+		const ::com::sun::star::beans::PropertyValue* pPropArray = aProps.getConstArray();
+		sal_Int32 nCount = aProps.getLength();
+		swprintf(pChar,L"Numbering:NumberingLevel=%d,",numberingLevel);
+		for( sal_Int32 i=0; i<nCount; i++ )
+		{
+			::com::sun::star::beans::PropertyValue rProp = pPropArray[i];
+			if(	(rProp.Name.compareTo(OUString::createFromAscii("BulletChar"))==0)||
+				(rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)||
+				(rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0))
+			{
+				OLECHAR propStr[512] = {NULL};
+				swprintf(propStr,L"%s=",rProp.Name.getStr());
+				OLECHAR pTemp[256] = {NULL};
+				CMAccessible::get_OLECHARFromAny(rProp.Value,pTemp);
+				if(rProp.Name.compareTo(OUString::createFromAscii("GraphicURL"))==0)
+				{
+					OLECHAR* pOccur = wcschr(pTemp,':');
+					if(pOccur)
+						*pOccur = '.';
+				}
+				wcscat(propStr,pTemp);
+				wcscat(pChar,propStr);
+				wcscat(pChar,L",");
+
+				if(rProp.Name.compareTo(OUString::createFromAscii("NumberingType"))==0)
+				{
+					if(numberingPrefix.getLength()!=0)
+					{
+						swprintf(pTemp,L"NumberingPrefix=%s,",numberingPrefix.getStr());
+						wcscat(pChar,pTemp);
+					}
+				}
+			}
+		}
+	}
+
+	//Because now have three types numbering level:
+	//1.real numbering list,numbering level>=0 and numbering Rule !=NULL;
+	//2.common paragraph, numbering level >=0, and numbering Rule == NULL;
+	//3.TOC paragraph, numbering level >0, and numbering Rule ==NULL;
+	// IAText:numberinglevel base on 0, but TOC's level base on 1,
+	// so NumberingLevel value will be decreased 1 in bridge code.
+	else if(numberingLevel >0)
+	{
+		swprintf(pChar,L"Numbering:NumberingLevel=%d,NumberingType=4,NumberingPrefix=,",numberingLevel-1);
+	}
+	else
+	{
+		swprintf(pChar,L"Numbering:");
+	}
+}
+
+void CMAccessible::ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData)
+{
+	if(rAnyVal.hasValue())
+	{
+		// Clear VARIANT variable.
+		VariantClear(pvData);
+
+		// Set value according to value type.
+		switch(rAnyVal.getValueTypeClass())
+		{
+		case TypeClass_CHAR:
+			pvData->vt = VT_UI1;
+			memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Char));
+			break;
+
+		case TypeClass_BOOLEAN:
+			pvData->vt = VT_BOOL;
+			memcpy(&pvData->boolVal, rAnyVal.getValue(), sizeof(sal_Bool));
+			break;
+
+		case TypeClass_BYTE:
+			pvData->vt = VT_UI1;
+			memcpy(&pvData->bVal, rAnyVal.getValue(), sizeof(sal_Int8));
+			break;
+
+		case TypeClass_SHORT:
+			pvData->vt = VT_I2;
+			memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_Int16));
+			break;
+
+		case TypeClass_UNSIGNED_SHORT:
+			pvData->vt = VT_I2;
+			memcpy(&pvData->iVal, rAnyVal.getValue(), sizeof(sal_uInt16));
+			break;
+
+		case TypeClass_LONG:
+			pvData->vt = VT_I4;
+			memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_Int32));
+			break;
+
+		case TypeClass_UNSIGNED_LONG:
+			pvData->vt = VT_I4;
+			memcpy(&pvData->lVal, rAnyVal.getValue(), sizeof(sal_uInt32));
+			break;
+
+		case TypeClass_FLOAT:
+			pvData->vt = VT_R4;
+			memcpy(&pvData->fltVal, rAnyVal.getValue(), sizeof(float));
+			break;
+
+		case TypeClass_DOUBLE:
+			pvData->vt = VT_R8;
+			memcpy(&pvData->dblVal, rAnyVal.getValue(), sizeof(double));
+			break;
+
+		case TypeClass_STRING:
+			{
+				pvData->vt = VT_BSTR;
+				::rtl::OUString val;
+				rAnyVal >>= val;
+				pvData->bstrVal = SysAllocString((OLECHAR *)val.getStr());
+				break;
+			}
+
+		case TypeClass_VOID:
+		case TypeClass_HYPER:
+		case TypeClass_UNSIGNED_HYPER:
+		case TypeClass_TYPE:
+		case TypeClass_ANY:
+		case TypeClass_ENUM:
+		case TypeClass_TYPEDEF:
+		case TypeClass_STRUCT:
+		case TypeClass_UNION:
+		case TypeClass_EXCEPTION:
+		case TypeClass_SEQUENCE:
+		case TypeClass_ARRAY:
+		case TypeClass_INTERFACE:
+			{
+				Reference< XAccessible > pXAcc;
+				if(rAnyVal >>= pXAcc)
+				{
+					if(pXAcc.is())
+					{
+						IAccessible* pIAcc = NULL;
+						get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc);
+						if(pIAcc == NULL)
+						{
+							Reference< XAccessibleContext > pXAccContext = pXAcc->getAccessibleContext();
+							g_pAgent->InsertAccObj(pXAcc.get(),pXAccContext->getAccessibleParent().get());
+							get_IAccessibleFromXAccessible((long)pXAcc.get(), &pIAcc);
+						}
+						if(pIAcc)
+						{
+							pIAcc->AddRef();
+
+							pvData->vt = VT_UNKNOWN;
+							pvData->pdispVal = (IAccessible2*)pIAcc;
+							break;
+						}
+					}
+				}
+			}
+		case TypeClass_SERVICE:
+		case TypeClass_MODULE:
+		case TypeClass_INTERFACE_METHOD:
+		case TypeClass_INTERFACE_ATTRIBUTE:
+		case TypeClass_UNKNOWN:
+		case TypeClass_PROPERTY:
+		case TypeClass_CONSTANT:
+		case TypeClass_CONSTANTS:
+		case TypeClass_SINGLETON:
+		case TypeClass_MAKE_FIXED_SIZE:
+			// Output the type string, if there is other uno value type.
+			pvData->vt = VT_BSTR;
+			pvData->bstrVal = SysAllocString(rAnyVal.getValueTypeName().getStr());
+			break;
+
+		default:
+			break;
+		}
+	}
+	else
+	{
+		VariantClear(pvData);
+	}
+}
+
+STDMETHODIMP CMAccessible::Get_XAccChildID(long* childID)
+{
+	// #CHECK#
+	if(childID == NULL)
+	{
+		return E_FAIL;
+	}
+	*childID = m_dChildID;
+	return S_OK;
+}
+STDMETHODIMP CMAccessible:: get_states(AccessibleStates __RPC_FAR *states )
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK XInterface#
+		if( !pRContext.is() )
+			return E_FAIL;
+
+	Reference<XAccessibleStateSet> pRStateSet = pRContext.get()->getAccessibleStateSet();
+	if(!pRStateSet.is())
+	{
+		return S_OK;
+	}
+	Sequence<short> pStates = pRStateSet->getStates();
+
+
+	long count = pStates.getLength() ;
+	*states = 0x0;
+	for( int i = 0; i < count; i++  )
+	{
+		for( int j = 0; j < sizeof(UNO_STATES) / sizeof(UNO_STATES[0]); j++ )
+		{
+			if( pStates[i] == UNO_STATES[j] )
+			{
+				*states |= IA2_STATES[j];
+				break;
+			}
+		}
+	}
+	return S_OK;
+
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+// return the UNO roles
+STDMETHODIMP CMAccessible:: get_extendedRole( BSTR __RPC_FAR *  )
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+
+		return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+STDMETHODIMP CMAccessible:: get_localizedExtendedRole( BSTR __RPC_FAR *  )
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_nExtendedStates( long __RPC_FAR * )
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+
+		return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_localizedExtendedStates( long, BSTR __RPC_FAR *__RPC_FAR *, long __RPC_FAR *)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		return E_NOTIMPL;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible:: get_indexInParent( long __RPC_FAR *accParentIndex)
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		// #CHECK#
+		if(accParentIndex == NULL)
+			return E_INVALIDARG;
+
+	// #CHECK XInterface#
+	if( !pRContext.is() )
+		return E_FAIL;
+
+	*accParentIndex = pRContext.get()->getAccessibleIndexInParent();
+	return S_OK;
+
+
+	LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_locale( IA2Locale __RPC_FAR *locale  )
+{
+
+	CHECK_ENABLE_INF
+		ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(locale == NULL)
+			return E_INVALIDARG;
+	// #CHECK XInterface#
+
+	if( !pRContext.is() )
+		return E_FAIL;
+
+	::com::sun::star::lang::Locale unoLoc = pRContext.get()->getLocale();
+	locale->language = SysAllocString((OLECHAR*)unoLoc.Language.getStr());
+	locale->country = SysAllocString((OLECHAR*)unoLoc.Country.getStr());
+	locale->variant = SysAllocString((OLECHAR*)unoLoc.Variant.getStr());
+
+	return S_OK;
+
+	LEAVE_PROTECTED_BLOCK
+}
+
+DWORD GetMSAAStateFromUNO(short xState)
+{
+	DWORD IState = STATE_SYSTEM_UNAVAILABLE;
+	switch( xState )
+	{
+	case /*AccessibleStateType::*/AccessibleStateType::BUSY:
+		IState = STATE_SYSTEM_BUSY;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::CHECKED:
+		IState = STATE_SYSTEM_CHECKED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::DEFUNC:
+		IState = STATE_SYSTEM_UNAVAILABLE;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::EXPANDED:
+		IState = STATE_SYSTEM_EXPANDED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::FOCUSABLE:
+		IState = STATE_SYSTEM_FOCUSABLE;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::FOCUSED:
+		IState = STATE_SYSTEM_FOCUSED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::INDETERMINATE:
+		IState = STATE_SYSTEM_MIXED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::MULTI_SELECTABLE:
+		IState = STATE_SYSTEM_MULTISELECTABLE;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::PRESSED:
+		IState = STATE_SYSTEM_PRESSED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::RESIZABLE:
+		IState = STATE_SYSTEM_SIZEABLE;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::SELECTABLE:
+		IState = STATE_SYSTEM_SELECTABLE;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::SELECTED:
+		IState = STATE_SYSTEM_SELECTED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::ARMED:
+		IState = STATE_SYSTEM_FOCUSED;
+		break;
+	case /*AccessibleStateType::*/AccessibleStateType::EXPANDABLE:
+		IState = STATE_SYSTEM_COLLAPSED;
+		break;
+	default:
+		break;
+	}
+	return IState;
+}
+
+STDMETHODIMP CMAccessible:: get_appName( BSTR __RPC_FAR *name)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(name == NULL)
+			return E_INVALIDARG;
+
+	*name = SysAllocString(OLESTR("Hannover"));
+	return S_OK;
+	LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_appVersion(BSTR __RPC_FAR *version)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(version == NULL)
+			return E_INVALIDARG;
+	*version=SysAllocString(OLESTR("3.0"));
+	return S_OK;
+	LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_toolkitName(BSTR __RPC_FAR *name)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(name == NULL)
+			return E_INVALIDARG;
+	*name = SysAllocString(OLESTR(" "));
+	return S_OK;
+	LEAVE_PROTECTED_BLOCK
+}
+STDMETHODIMP CMAccessible:: get_toolkitVersion(BSTR __RPC_FAR *version)
+{
+
+	ENTER_PROTECTED_BLOCK
+		ISDESTROY()
+		if(version == NULL)
+			return E_INVALIDARG;
+	*version = SysAllocString(OLESTR(" "));
+	return S_OK;
+	LEAVE_PROTECTED_BLOCK
+}
+
+
+STDMETHODIMP CMAccessible::get_attributes(/*[out]*/ BSTR *pAttr)
+{
+	CHECK_ENABLE_INF
+		Reference<XAccessibleContext> pRContext = pUNOInterface->getAccessibleContext();
+	if( !pRContext.is() )
+	{
+		return E_FAIL;
+	}
+	Reference<XAccessibleExtendedAttributes> pRXI(pRContext,UNO_QUERY);
+	if( !pRXI.is() )
+		return E_FAIL;
+	else
+	{
+		com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleExtendedAttributes> pRXAttr;
+		pRXAttr = pRXI.get();
+		::com::sun::star::uno::Any	anyVal = pRXAttr->getExtendedAttributes();
+
+		::rtl::OUString val;
+		anyVal >>= val;
+
+		if(*pAttr)
+			SAFE_SYSFREESTRING(*pAttr);
+		*pAttr = SysAllocString((OLECHAR *)val.getStr());
+
+		return S_OK;
+	}
+}
+
diff --git a/main/winaccessibility/source/UAccCOM/MAccessible.h b/main/winaccessibility/source/UAccCOM/MAccessible.h
new file mode 100644
index 0000000..0925e9c
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/MAccessible.h
@@ -0,0 +1,294 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __MACCESSIBLE_H_
+#define __MACCESSIBLE_H_
+
+#include <Windows.h>
+#include "resource.h"       // main symbols
+#include <vector>
+#include <map>
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/XAccessibleSelection.hpp>
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <AccObjectManagerAgent.hxx>
+#include "EnumVariant.h"
+#ifndef __ACCCOMMON_H_
+#include "acccommon.h"
+#endif
+#ifndef _RTL_USTRING_HXX_
+#include <rtl/ustring.hxx>
+#endif
+
+#define     CHILDID_SELF        0
+#define     OBJID_WINDOW        ((LONG)0x00000000)
+#define     OBJID_SYSMENU       ((LONG)0xFFFFFFFF)
+#define     OBJID_TITLEBAR      ((LONG)0xFFFFFFFE)
+#define     OBJID_MENU          ((LONG)0xFFFFFFFD)
+#define     OBJID_CLIENT        ((LONG)0xFFFFFFFC)
+#define     OBJID_VSCROLL       ((LONG)0xFFFFFFFB)
+#define     OBJID_HSCROLL       ((LONG)0xFFFFFFFA)
+#define     OBJID_SIZEGRIP      ((LONG)0xFFFFFFF9)
+#define     OBJID_CARET         ((LONG)0xFFFFFFF8)
+#define     OBJID_CURSOR        ((LONG)0xFFFFFFF7)
+#define     OBJID_ALERT         ((LONG)0xFFFFFFF6)
+#define     OBJID_SOUND         ((LONG)0xFFFFFFF5)
+#define     OBJID_QUERYCLASSNAMEIDX ((LONG)0xFFFFFFF4)
+#define     OBJID_NATIVEOM      ((LONG)0xFFFFFFF0)
+
+using namespace rtl;
+/**
+ *This class implements IMAccessible interface, which inherits from IAccessible2, and
+ *in turn inherits from IAccessible. So its methods include the methods defined only in
+ *IAccessible, plus the methods defined only in IAccessible2, plus the methods defined 
+ *only in IMAccessible.
+ */
+class ATL_NO_VTABLE CMAccessible :
+            public CComObjectRoot,
+            public CComCoClass<CMAccessible, &CLSID_MAccessible>,
+            public IDispatchImpl<IMAccessible, &IID_IMAccessible, &LIBID_UACCCOMLib>,
+            public IServiceProvider,
+            public IAccessibleApplication
+{
+    typedef map< const GUID, CComPtr<IUnknown> ,ltComp > XGUIDToComObjHash;
+
+    typedef HRESULT (WINAPI _UNO_AGGCREATORFUNC)(void*, REFIID, LPVOID*);
+
+    struct _UNO_AGGMAP_ENTRY
+    {
+        const IID* piid;
+        _UNO_AGGCREATORFUNC* pfnCreateInstance;
+        int XIFIndex;
+    };
+
+    enum XInterfaceIndex {
+        XI_COMPONENT	= 0x01,
+        XI_TEXT			= 0x02,
+        XI_TABLE		= 0x03,
+        XI_EDITABLETEXT	= 0x04,
+        XI_IMAGE		= 0x05,
+        XI_SELECTION	= 0x06,
+        XI_EXTENDEDCOMP	= 0x07,
+        XI_VALUE		= 0x08,
+        XI_KEYBINDING	= 0x09,
+        XI_ACTION		= 0x0A,
+        XI_HYPERTEXT	= 0x0B,
+        XI_HYPERLINK	= 0x0C,
+        XI_ATTRIBUTE	= 0x0D,
+        XI_NULL			= -1
+    };
+
+public:
+    CMAccessible();
+    virtual ~CMAccessible();
+    DECLARE_REGISTRY_RESOURCEID(IDR_MACCESSIBLE)
+
+    DECLARE_GET_CONTROLLING_UNKNOWN()
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(CMAccessible)
+    COM_INTERFACE_ENTRY(IMAccessible)
+    COM_INTERFACE_ENTRY(IAccessible)
+    COM_INTERFACE_ENTRY(IAccessible2)
+    COM_INTERFACE_ENTRY(IDispatch)
+    COM_INTERFACE_ENTRY(IAccessibleApplication)
+    COM_INTERFACE_ENTRY(IServiceProvider)
+    COM_INTERFACE_ENTRY_FUNC_BLIND(NULL,_SmartQI)
+    END_COM_MAP()
+
+    // AGGREGATE OBJECT MAP
+    BEGIN_AGGOBJECT_MAP(CMAccessible)
+    AGGOBJECT_ENTRY(IID_IAccessibleComponent, CLSID_AccComponent, COMPONENT)
+    AGGOBJECT_ENTRY(IID_IAccessibleText, CLSID_AccText, TEXT)
+    AGGOBJECT_ENTRY(IID_IAccessibleEditableText, CLSID_AccEditableText, EDITABLETEXT)
+    AGGOBJECT_ENTRY(IID_IAccessibleImage, CLSID_AccImage, IMAGE)
+    AGGOBJECT_ENTRY(IID_IAccessibleTable, CLSID_AccTable, TABLE)
+    AGGOBJECT_ENTRY(IID_IAccessibleAction, CLSID_AccAction, ACTION)
+    AGGOBJECT_ENTRY(IID_IAccessibleValue, CLSID_AccValue, VALUE)
+    AGGOBJECT_ENTRY(IID_IAccessibleHypertext, CLSID_AccHypertext, HYPERTEXT)
+    AGGOBJECT_ENTRY(IID_IAccessibleHyperlink, CLSID_AccHyperLink, HYPERLINK)
+
+
+    END_AGGOBJECT_MAP()
+
+    // IMAccessible
+    STDMETHOD(put_accValue)(VARIANT varChild,BSTR szValue);
+    STDMETHOD(put_accName)(VARIANT varChild,BSTR szName);
+    STDMETHOD(accDoDefaultAction)(VARIANT varChild);
+    STDMETHOD(accHitTest)(long xLeft,long yTop,VARIANT *pvarChild);
+    STDMETHOD(accNavigate)(long navDir,VARIANT varStart,VARIANT *pvarEndUpAt);
+    STDMETHOD(accLocation)(long *pxLeft,long *pyTop,long *pcxWidth,long *pcyHeight,VARIANT varChild);
+    STDMETHOD(accSelect)(long flagsSelect,VARIANT varChild);
+    STDMETHOD(get_accDefaultAction)( VARIANT varChild,BSTR *pszDefaultAction);
+    STDMETHOD(get_accSelection)(VARIANT *pvarChildren);
+    STDMETHOD(get_accFocus)(VARIANT *pvarChild);
+    STDMETHOD(get_accKeyboardShortcut)( VARIANT varChild,BSTR *pszKeyboardShortcut);
+    STDMETHOD(get_accHelpTopic)(BSTR *pszHelpFile,VARIANT varChild,long *pidTopic);
+    STDMETHOD(get_accHelp)(VARIANT varChild,BSTR *pszHelp);
+    STDMETHOD(get_accState)(VARIANT varChild,VARIANT *pvarState);
+    STDMETHOD(get_accRole)(VARIANT varChild,VARIANT *pvarRole);
+    STDMETHOD(get_accDescription)(VARIANT varChild,BSTR *pszDescription);
+    STDMETHOD(get_accValue)( VARIANT varChild,BSTR *pszValue);
+    STDMETHOD(get_accName)(VARIANT varChild,BSTR *pszName);
+    STDMETHOD(get_accChild)(VARIANT varChild,IDispatch **ppdispChild);
+    STDMETHOD(get_accChildCount)(long *pcountChildren);
+    STDMETHOD(get_accParent)( IDispatch **ppdispParent);
+
+    // methods which are defined only in the IAccessible2
+    // These methods only declare here, and their implementation bodies are empty now.
+    STDMETHOD(get_nRelations)( long __RPC_FAR *nRelations) ;
+    STDMETHOD(get_relation)( long relationIndex, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation) ;
+    STDMETHOD(get_relations)( long maxRelations, IAccessibleRelation __RPC_FAR *__RPC_FAR *relation, long __RPC_FAR *nRelations) ;
+    STDMETHOD(role)(long __RPC_FAR *role);
+    STDMETHOD(get_nActions)(long __RPC_FAR *nActions);
+    STDMETHOD(scrollTo)(enum IA2ScrollType scrollType);
+    STDMETHOD(scrollToPoint)(enum IA2CoordinateType coordinateType, long x, long y);
+    STDMETHOD(get_groupPosition)(long __RPC_FAR *groupLevel,long __RPC_FAR *similarItemsInGroup,long __RPC_FAR *positionInGroup);
+    STDMETHOD(get_states)( AccessibleStates __RPC_FAR *states );
+    STDMETHOD(get_extendedRole)( BSTR __RPC_FAR *extendedRole );
+    STDMETHOD(get_localizedExtendedRole)( BSTR __RPC_FAR *localizedExtendedRole );
+    STDMETHOD(get_nExtendedStates)( long __RPC_FAR *nExtendedStates);
+    STDMETHOD(get_extendedStates)( long maxExtendedStates, BSTR __RPC_FAR *__RPC_FAR *extendedStates, long __RPC_FAR *nExtendedStates);
+    STDMETHOD(get_localizedExtendedStates)(long maxLocalizedExtendedStates,BSTR __RPC_FAR *__RPC_FAR *localizedExtendedStates,long __RPC_FAR *nLocalizedExtendedStates);
+    STDMETHOD(get_uniqueID)(long __RPC_FAR *uniqueID);
+    STDMETHOD(get_windowHandle)(HWND __RPC_FAR *windowHandle);
+    STDMETHOD(get_indexInParent)( long __RPC_FAR *accParentIndex );
+    STDMETHOD(get_locale)( IA2Locale __RPC_FAR *locale );
+    STDMETHOD(get_attributes)(/*[out]*/ BSTR *pAttr);
+
+    //IServiceProvider.
+    STDMETHOD(QueryService)(REFGUID guidService, REFIID riid, void** ppvObject);
+
+    //IAccessibleApplication
+    STDMETHOD(get_appName)(BSTR __RPC_FAR *name);
+    STDMETHOD(get_appVersion)(BSTR __RPC_FAR *version);
+    STDMETHOD(get_toolkitName)(BSTR __RPC_FAR *name);
+    STDMETHOD(get_toolkitVersion)(BSTR __RPC_FAR *version);
+
+    // methods which are defined only in IMAccessible
+    // These methods are provided for UNO management system.
+    // The UNO management system use these methods to put Accessibility
+    // information to COM.
+    STDMETHOD(Put_XAccName)(const OLECHAR __RPC_FAR *pszName);
+    STDMETHOD(Put_XAccRole)(unsigned short pRole);
+    STDMETHOD(DecreaseState)(DWORD pXSate);
+    STDMETHOD(IncreaseState)(DWORD pXSate);
+    STDMETHOD(SetState)(DWORD pXSate);
+    STDMETHOD(Put_XAccDescription)(const OLECHAR __RPC_FAR *pszDescription);
+    STDMETHOD(Put_XAccValue)(const OLECHAR __RPC_FAR *pszAccValue);
+    STDMETHOD(Put_XAccLocation)(const Location sLocation);
+    STDMETHOD(Put_XAccFocus)(long dChildID);
+    STDMETHOD(Put_XAccParent)(IMAccessible __RPC_FAR *pIParent);
+    STDMETHOD(Put_XAccWindowHandle)(HWND hwnd);
+    STDMETHOD(Put_XAccChildID)(long dChildID);
+    STDMETHOD(Put_XAccAgent)(long pAgent);
+    STDMETHOD(NotifyDestroy)(BOOL isDestroy);
+    STDMETHOD(Put_ActionDescription)( const OLECHAR* szAction);
+    STDMETHOD(SetDefaultAction)(long pAction);
+    STDMETHOD(GetUNOInterface)(long*);
+    STDMETHOD(SetXAccessible)(long);
+
+private:
+    OLECHAR* m_pszName;
+    OLECHAR* m_pszValue;
+    OLECHAR* m_pszActionDescription;
+    unsigned short m_iRole;
+    DWORD	m_dState;
+    OLECHAR* m_pszDescription;
+    IMAccessible* m_pIParent;
+    Location m_sLocation;
+
+    // identify a COM object/Acc object uniquely
+    long m_dChildID;
+    // specify the focus child ID in object self and its direct children
+
+    long m_dFocusChildID;
+    // parent window handle,will be used in the future application, its value comes from UNO
+
+    HWND m_hwnd;
+
+    // the COM class which implements IEnumVARIANT interface,currently only used in
+    // the implementation of get_accSelection
+    CEnumVariant* m_pEnumVar;
+
+    // specify if the XAccessible is invalid
+    BOOL m_isDestroy;
+
+    XAccessible*  pUNOInterface;
+    Reference< XAccessible > pRef;
+    XAccessible*  pAchorUNOInterface;
+    XAccessibleAction*    m_pXAction;
+    XAccessibleContext*  pRContextInterface;
+    Reference<XAccessibleContext> pRContext;
+
+private:
+
+    // the helper methods in order to implement the above public methods
+    IMAccessible* GetChildInterface(long dChildIndex);//notice here the parameter is child index,not child id
+    IMAccessible* GetNavigateChildForDM(VARIANT varCur,short flags);//for decendant manage
+    HRESULT GetFirstChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+    HRESULT GetLastChild(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+    HRESULT GetNextSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+    HRESULT GetPreSibling(VARIANT varStart,VARIANT* pvarEndUpAt);//for accNavigate implementation
+    BOOL IsDecendantManage();//identify whether the current COM belongs to manage_decendant roles
+
+    // the following private methods are used to implement accSelect method
+    HRESULT SelectChild(XAccessible* pItem);
+    HRESULT DeSelectChild(XAccessible* pItem);
+    HRESULT	SelectMutipleChidren( XAccessible** pItem,int size );
+    HRESULT DeSelectMutipleChildren( XAccessible** pItem,int size );
+    XAccessibleContext* GetContextByXAcc( XAccessible* pXAcc );
+    Reference< XAccessibleSelection > GetSelection();
+    // end accSelect implementation methods
+    BOOL GetXInterfaceFromXAccessible(XAccessible*, XInterface**, int);
+    HRESULT WINAPI SmartQI(void* pv, REFIID iid, void** ppvObject);
+
+public:
+    STDMETHOD(Get_XAccChildID)(/*[out,retval]*/ long* childID);
+    // AccObjectManagerAgent is a management object in UNO, here keep its pointer for
+    // the implementation of accNavigate when decendant manage happens for List,Tree, or Table
+    // AccObjectManagerAgent and the following UNO objects XAccessble,XAccessibleSelection,
+    // XAccessibleAction are all used to operate UNO accessiblility information directly when
+    // implement some specific MSAA methods,such as accSelection,accNavigate
+    static AccObjectManagerAgent* g_pAgent;
+
+    static BOOL get_IAccessibleFromXAccessible(long pXAcc,IAccessible** ppIA);
+    BOOL m_bRequiresSave;
+    XGUIDToComObjHash m_containedObjects;
+
+    static HRESULT WINAPI _SmartQI(void* pv,
+                                   REFIID iid, void** ppvObject, DWORD)
+    {
+        return ((CMAccessible*)pv)->SmartQI(pv,iid,ppvObject);
+    }
+
+    static void get_OLECHARFromAny(Any& pAny, OLECHAR* pChar);
+
+    static void get_OLECHAR4Numbering(const Any& pAny, short numberingLevel, const OUString& numberingPrefix,OLECHAR* pChar);
+
+    // Helper function for data conversion.
+    static void ConvertAnyToVariant(const ::com::sun::star::uno::Any &rAnyVal, VARIANT *pvData);
+};
+
+
+
+#endif //__MACCESSIBLE_H_
diff --git a/main/winaccessibility/source/UAccCOM/MAccessible.rgs b/main/winaccessibility/source/UAccCOM/MAccessible.rgs
new file mode 100644
index 0000000..10bd2c0
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/MAccessible.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+	UAccCOM.MAccessible.1 = s 'MAccessible Class'
+	{
+		CLSID = s '{CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F}'
+	}
+	UAccCOM.MAccessible = s 'MAccessible Class'
+	{
+		CLSID = s '{CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F}'
+		CurVer = s 'UAccCOM.MAccessible.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F} = s 'MAccessible Class'
+		{
+			ProgID = s 'UAccCOM.MAccessible.1'
+			VersionIndependentProgID = s 'UAccCOM.MAccessible'
+			ForceRemove 'Programmable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'Both'
+			}
+			'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/Resource.h b/main/winaccessibility/source/UAccCOM/Resource.h
new file mode 100644
index 0000000..fe71c6a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/Resource.h
@@ -0,0 +1,70 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by UAccCOM.rc
+//
+#define WNT
+
+#define IDS_PROJNAME                    100
+#define IDR_MACCESSIBLE                 101
+#define IDR_ENUMVARIANT                 106
+#define IDR_UNOXWRAPPER                 107
+#define IDS_ACCCOMPONENT_DESC           108
+#define IDR_AccComponent                109
+#define IDS_ACCCONTEXT_DESC             110
+#define IDR_AccContext                  111
+#define IDR_ACCRELATION                 112
+#define IDR_ACCACTION                   113
+#define IDS_ACCFONT_DESC                114
+#define IDR_AccFont                     115
+#define IDS_ACCSELECTION_DESC           116
+#define IDR_AccSelection                117
+#define IDS_ACCEXTENDEDCOMPONENT_DESC   118
+#define IDR_AccExtendedComponent        119
+#define IDS_ACCTEXT_DESC                120
+#define IDR_AccText                     121
+#define IDS_ACCEDITABLETEXT_DESC        122
+#define IDR_AccEditableText             123
+#define IDS_ACCHYPERTEXT_DESC           124
+#define IDR_AccHypertext                125
+#define IDS_ACCIMAGE_DESC               126
+#define IDR_AccImage                    127
+#define IDS_ACCVALUE_DESC               128
+#define IDR_AccValue                    129
+#define IDS_ACCTABLE_DESC               130
+#define IDR_ACCTABLE                    131
+#define IDS_ACCHYPERLINK_DESC           132
+#define IDR_AccHyperLink                133
+#define IDS_ACCKEYBINDING_DESC          134
+#define IDR_AccKeyBinding               135
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE        203
+#define _APS_NEXT_COMMAND_VALUE         32768
+#define _APS_NEXT_CONTROL_VALUE         201
+#define _APS_NEXT_SYMED_VALUE           137
+#endif
+#endif
diff --git a/main/winaccessibility/source/UAccCOM/StdAfx.cpp b/main/winaccessibility/source/UAccCOM/StdAfx.cpp
new file mode 100644
index 0000000..ed52d68
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/StdAfx.cpp
@@ -0,0 +1,29 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+
+#ifdef _ATL_STATIC_REGISTRY
+#include <statreg.h>
+#include <statreg.cpp>
+#endif
+
+#include <atlimpl.cpp>
diff --git a/main/winaccessibility/source/UAccCOM/UAccCOM.cpp b/main/winaccessibility/source/UAccCOM/UAccCOM.cpp
new file mode 100644
index 0000000..7fd4a2e
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UAccCOM.cpp
@@ -0,0 +1,109 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "resource.h"
+#include <initguid.h>
+#include "UAccCOM2.h"
+
+#include "UAccCOM_i.c"
+#include "ia2_api_all_i.c"
+
+#include "MAccessible.h"
+#include "EnumVariant.h"
+#include "UNOXWrapper.h"
+#include "AccComponent.h"
+#include "AccRelation.h"
+#include "AccAction.h"
+#include "AccText.h"
+#include "AccEditableText.h"
+#include "AccImage.h"
+#include "AccValue.h"
+#include "AccTable.h"
+#include "AccHyperLink.h"
+#include "AccHyperText.h"
+
+
+CComModule _Module;
+
+BEGIN_OBJECT_MAP(ObjectMap)
+OBJECT_ENTRY(CLSID_MAccessible, CMAccessible)
+OBJECT_ENTRY(CLSID_EnumVariant, CEnumVariant)
+OBJECT_ENTRY(CLSID_AccComponent, CAccComponent)
+OBJECT_ENTRY(CLSID_AccRelation, CAccRelation)
+OBJECT_ENTRY(CLSID_AccAction, CAccAction)
+OBJECT_ENTRY(CLSID_AccText, CAccText)
+OBJECT_ENTRY(CLSID_AccEditableText, CAccEditableText)
+OBJECT_ENTRY(CLSID_AccImage, CAccImage)
+OBJECT_ENTRY(CLSID_AccValue, CAccValue)
+OBJECT_ENTRY(CLSID_AccTable, CAccTable)
+OBJECT_ENTRY(CLSID_AccHyperLink, CAccHyperLink)
+OBJECT_ENTRY(CLSID_AccHypertext, CAccHypertext)
+END_OBJECT_MAP()
+
+/////////////////////////////////////////////////////////////////////////////
+// DLL Entry Point
+
+extern "C"
+    BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
+{
+    if (dwReason == DLL_PROCESS_ATTACH)
+    {
+        _Module.Init(ObjectMap, hInstance, &LIBID_UACCCOMLib);
+        DisableThreadLibraryCalls(hInstance);
+    }
+    else if (dwReason == DLL_PROCESS_DETACH)
+        _Module.Term();
+    return TRUE;    // ok
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Used to determine whether the DLL can be unloaded by OLE
+
+STDAPI DllCanUnloadNow(void)
+{
+    return (_Module.GetLockCount()==0) ? S_OK : E_FAIL;
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// Returns a class factory to create an object of the requested type
+
+STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
+{
+    return _Module.GetClassObject(rclsid, riid, ppv);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllRegisterServer - Adds entries to the system registry
+
+STDAPI DllRegisterServer(void)
+{
+    // registers object, typelib and all interfaces in typelib
+    return _Module.RegisterServer(TRUE);
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// DllUnregisterServer - Removes entries from the system registry
+
+STDAPI DllUnregisterServer(void)
+{
+    return _Module.UnregisterServer(TRUE);
+}
diff --git a/main/winaccessibility/source/UAccCOM/UAccCOM.def b/main/winaccessibility/source/UAccCOM/UAccCOM.def
new file mode 100644
index 0000000..575a281
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UAccCOM.def
@@ -0,0 +1,7 @@
+LIBRARY      "UAccCOM.DLL"
+
+EXPORTS
+	DllCanUnloadNow     PRIVATE
+	DllGetClassObject   PRIVATE
+	DllRegisterServer   PRIVATE
+	DllUnregisterServer	PRIVATE
diff --git a/main/winaccessibility/source/UAccCOM/UAccCOM.rc b/main/winaccessibility/source/UAccCOM/UAccCOM.rc
new file mode 100644
index 0000000..bab7d46
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UAccCOM.rc
@@ -0,0 +1,149 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Chinese (P.R.C.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
+#ifdef _WIN32
+LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
+#pragma code_page(936)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// REGISTRY
+//
+
+IDR_MACCESSIBLE         REGISTRY DISCARDABLE    "MAccessible.rgs"
+IDR_ENUMVARIANT         REGISTRY DISCARDABLE    "EnumVariant.rgs"
+IDR_UNOXWRAPPER         REGISTRY DISCARDABLE    "UNOXWrapper.rgs"
+IDR_AccComponent        REGISTRY DISCARDABLE    "AccComponent.rgs"
+IDR_AccExtendedComponent REGISTRY DISCARDABLE    "AccExtendedComponent.rgs"
+IDR_ACCRELATION         REGISTRY DISCARDABLE    "AccRelation.rgs"
+IDR_ACCACTION           REGISTRY DISCARDABLE    "AccAction.rgs"
+IDR_AccFont             REGISTRY DISCARDABLE    "AccFont.rgs"
+IDR_AccSelection        REGISTRY DISCARDABLE    "AccSelection.rgs"
+IDR_AccText             REGISTRY DISCARDABLE    "AccText.rgs"
+IDR_AccEditableText     REGISTRY DISCARDABLE    "AccEditableText.rgs"
+IDR_AccImage            REGISTRY DISCARDABLE    "AccImage.rgs"
+IDR_AccValue            REGISTRY DISCARDABLE    "AccValue.rgs"
+IDR_ACCTABLE            REGISTRY DISCARDABLE    "AccTable.rgs"
+IDR_AccHyperLink        REGISTRY DISCARDABLE    "AccHyperLink.rgs"
+IDR_AccHypertext        REGISTRY DISCARDABLE    "AccHypertext.rgs"
+IDR_AccKeyBinding       REGISTRY DISCARDABLE    "AccKeyBinding.rgs"
+#endif    // Chinese (P.R.C.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "#include ""winres.h""\r\n"
+    "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE 
+BEGIN
+    "1 TYPELIB ""UAccCOM.tlb""\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+//
+// String Table
+//
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_PROJNAME            "UAccCOM"
+    IDS_ACCCOMPONENT_DESC   "AccComponent Class"
+    IDS_ACCCONTEXT_DESC     "AccContext Class"
+END
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_ACCFONT_DESC        "AccFont Class"
+    IDS_ACCSELECTION_DESC   "AccSelection Class"
+    IDS_ACCEXTENDEDCOMPONENT_DESC "AccExtendedComponent Class"
+    IDS_ACCTEXT_DESC        "AccText Class"
+    IDS_ACCEDITABLETEXT_DESC "AccEditableText Class"
+    IDS_ACCHYPERTEXT_DESC   "AccHypertext Class"
+    IDS_ACCIMAGE_DESC       "AccImage Class"
+END
+
+STRINGTABLE DISCARDABLE 
+BEGIN
+    IDS_ACCVALUE_DESC       "AccValue Class"
+    IDS_ACCTABLE_DESC       "AccTable Class"
+    IDS_ACCHYPERLINK_DESC   "AccHyperLink Class"
+    IDS_ACCKEYBINDING_DESC  "AccKeyBinding Class"
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+1 TYPELIB "UAccCOM.tlb"
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+
diff --git a/main/winaccessibility/source/UAccCOM/UNOXWrapper.cpp b/main/winaccessibility/source/UAccCOM/UNOXWrapper.cpp
new file mode 100644
index 0000000..a641c2a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UNOXWrapper.cpp
@@ -0,0 +1,27 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "stdafx.h"
+#include "UAccCOM2.h"
+#include "UNOXWrapper.h"
+
+/////////////////////////////////////////////////////////////////////////////
+// CUNOXWrapper
diff --git a/main/winaccessibility/source/UAccCOM/UNOXWrapper.h b/main/winaccessibility/source/UAccCOM/UNOXWrapper.h
new file mode 100644
index 0000000..c0d28d0
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UNOXWrapper.h
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __UNOXWRAPPER_H_
+#define __UNOXWRAPPER_H_
+
+#define WNT
+
+#include "resource.h"       // main symbols
+
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include "UAccCOM2.h"
+
+/**
+ * CUNOXWrapper implements IUNOXWrapper interface.
+ */
+class ATL_NO_VTABLE CUNOXWrapper : public IUNOXWrapper
+{
+public:
+    CUNOXWrapper()
+    {	}
+
+public:
+    // IUNOXWrapper
+
+    STDMETHOD(put_XInterface)(long pXInterface)
+    {
+        pUNOInterface = (com::sun::star::accessibility::XAccessible*)pXInterface;
+        return S_OK;
+    }
+
+    STDMETHOD(put_XSubInterface)(long)
+    {
+        return S_OK;
+    }
+
+    STDMETHOD(get_XInterface)(/*[out,retval]*/long *pXInterface)
+    {
+        *pXInterface = (long)pUNOInterface;//.get();
+        return S_OK;
+    }
+
+    STDMETHOD(get_XSubInterface)(/*[out,retval]*/long *)
+    {
+        return S_OK;
+    }
+
+protected:
+
+    com::sun::star::accessibility::XAccessible* pUNOInterface;
+};
+
+#endif //__UNOXWRAPPER_H_
diff --git a/main/winaccessibility/source/UAccCOM/UNOXWrapper.rgs b/main/winaccessibility/source/UAccCOM/UNOXWrapper.rgs
new file mode 100644
index 0000000..8a52b08
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/UNOXWrapper.rgs
@@ -0,0 +1,26 @@
+HKCR
+{
+	UAccCOM.UNOXWrapper.1 = s 'UNOXWrapper Class'
+	{
+		CLSID = s '{AA360FB0-BC98-41C1-A885-BB921F5ED601}'
+	}
+	UAccCOM.UNOXWrapper = s 'UNOXWrapper Class'
+	{
+		CLSID = s '{AA360FB0-BC98-41C1-A885-BB921F5ED601}'
+		CurVer = s 'UAccCOM.UNOXWrapper.1'
+	}
+	NoRemove CLSID
+	{
+		ForceRemove {AA360FB0-BC98-41C1-A885-BB921F5ED601} = s 'UNOXWrapper Class'
+		{
+			ProgID = s 'UAccCOM.UNOXWrapper.1'
+			VersionIndependentProgID = s 'UAccCOM.UNOXWrapper'
+			ForceRemove 'Programmable'
+			InprocServer32 = s '%MODULE%'
+			{
+				val ThreadingModel = s 'Apartment'
+			}
+			'TypeLib' = s '{19ECB1B0-9376-4FF9-B580-223FC9C200B8}'
+		}
+	}
+}
diff --git a/main/winaccessibility/source/UAccCOM/acccommon.h b/main/winaccessibility/source/UAccCOM/acccommon.h
new file mode 100644
index 0000000..a7e5df2
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/acccommon.h
@@ -0,0 +1,95 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#ifndef __ACCCOMMON_H_
+#define __ACCCOMMON_H_
+
+
+//using namespace com::sun::star::accessibility;
+//using namespace com::sun::star::uno;
+
+
+//for MAccessible.cpp
+struct ltComp
+{
+    bool operator()(REFGUID  rguid1, REFGUID  rguid2) const
+    {
+        if(((PLONG) &rguid1)[0] < ((PLONG) &rguid2)[0])
+            return TRUE;
+        else if(((PLONG) &rguid1)[0] > ((PLONG) &rguid2)[0])
+            return FALSE;
+        if(((PLONG) &rguid1)[1] < ((PLONG) &rguid2)[1])
+            return TRUE;
+        else if(((PLONG) &rguid1)[1] > ((PLONG) &rguid2)[1])
+            return FALSE;
+        if(((PLONG) &rguid1)[2] < ((PLONG) &rguid2)[2])
+            return TRUE;
+        else if(((PLONG) &rguid1)[2] > ((PLONG) &rguid2)[2])
+            return FALSE;
+        if(((PLONG) &rguid1)[3] < ((PLONG) &rguid2)[3])
+            return TRUE;
+        else if(((PLONG) &rguid1)[3] > ((PLONG) &rguid2)[3])
+            return FALSE;
+        return FALSE;
+    }
+};
+
+#define BEGIN_AGGOBJECT_MAP(x) \
+	static _UNO_AGGMAP_ENTRY* WINAPI _GetAggEntries() { \
+	static _UNO_AGGMAP_ENTRY _aggentries[] = {
+#define END_AGGOBJECT_MAP()   {NULL, NULL,NULL}}; \
+	return _aggentries;}
+#define AGGOBJECT_ENTRY(iid, clsid, ifindex) {&iid, \
+	CComAggregateCreator< CComObject<CMAccessible>, &clsid >::CreateInstance,\
+	XI_##ifindex},
+
+enum DM_NIR {
+    DM_FIRSTCHILD = 0x00,
+    DM_LASTCHILD = 0x01,
+    DM_NEXTCHILD = 0x02,
+    DM_PREVCHILD = 0x03
+};
+
+inline BOOL ImplIsEqualGUID(REFGUID rguid1, REFGUID rguid2)
+{
+    return (
+               ((PLONG) &rguid1)[0] == ((PLONG) &rguid2)[0] &&
+               ((PLONG) &rguid1)[1] == ((PLONG) &rguid2)[1] &&
+               ((PLONG) &rguid1)[2] == ((PLONG) &rguid2)[2] &&
+               ((PLONG) &rguid1)[3] == ((PLONG) &rguid2)[3]);
+}
+#define InlineIsEqualGUID ImplIsEqualGUID
+//End
+
+//for AccAction.cpp
+#define CODEENTRY(key) \
+	{KEYCODE_##key, L#key}
+#define countof(x)	(sizeof(x)/sizeof(x[0]))
+
+#define SELECT       L"Select"
+#define PRESS        L"Press"
+#define UNCHECK      L"UnCheck"
+#define CHECK        L"Check"
+//End
+
+static DWORD GetMSAAStateFromUNO(short xState);
+
+#endif
diff --git a/main/winaccessibility/source/UAccCOM/makefile.mk b/main/winaccessibility/source/UAccCOM/makefile.mk
new file mode 100644
index 0000000..d4d5882
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/makefile.mk
@@ -0,0 +1,142 @@
+#**************************************************************
+#  
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+#**************************************************************
+
+PRJ=..$/..
+PRJNAME=winaccessibility
+TARGET=UAccCOM
+
+# --- Settings -----------------------------------------------------
+.IF "$(GUI)" == "WNT" && "$(DISABLE_ATL)"==""
+PROF_EDITION=TRUE
+.ENDIF
+
+.INCLUDE :	settings.mk
+
+.IF "$(GUI)" == "WNT" && "$(DISABLE_ATL)"==""
+
+VERSIONOBJ=
+LIBTARGET=NO
+USE_DEFFILE=YES
+UWINAPILIB=
+
+INCPRE+=$(foreach,i,$(ATL_INCLUDE) -I$(i)) \
+    -I$(MISC) \
+
+CFLAGS+=-D_UNICODE -DUNICODE
+
+# --- Files --------------------------------------------------------
+.IF "$(PRODUCT)"!=""
+RC+=-DPRODUCT
+.ENDIF
+.IF "$(USE_STLP_DEBUG)"!=""
+CDEFS+=-D_DEBUG
+.ENDIF # "$(USE_STLP_DEBUG)"!=""
+
+RCFILES=\
+        $(TARGET).rc
+#RCDEPN=$(MISC)$/envsettings.h
+
+SLOFILES=\
+	$(SLO)$/AccAction.obj \
+	$(SLO)$/AccActionBase.obj \
+	$(SLO)$/AccComponent.obj \
+	$(SLO)$/AccComponentBase.obj \
+	$(SLO)$/AccEditableText.obj \
+	$(SLO)$/AccHyperLink.obj \
+	$(SLO)$/AccHypertext.obj \
+	$(SLO)$/AccImage.obj \
+	$(SLO)$/AccRelation.obj \
+	$(SLO)$/AccText.obj \
+	$(SLO)$/AccValue.obj \
+	$(SLO)$/EnumVariant.obj \
+	$(SLO)$/StdAfx.obj \
+	$(SLO)$/UAccCOM.obj \
+	$(SLO)$/UNOXWrapper.obj \
+	$(SLO)$/AccTable.obj \
+	$(SLO)$/AccTextBase.obj \
+	$(SLO)$/MAccessible.obj \
+	$(SLO)$/CheckEnableAccessible.obj \
+	
+EXCEPTIONSFILES= \
+	$(SLO)$/AccAction.obj \
+	$(SLO)$/AccActionBase.obj \
+	$(SLO)$/AccComponent.obj \
+	$(SLO)$/AccComponentBase.obj \
+	$(SLO)$/AccEditableText.obj \
+	$(SLO)$/AccHyperLink.obj \
+	$(SLO)$/AccHypertext.obj \
+	$(SLO)$/AccImage.obj \
+	$(SLO)$/AccRelation.obj \
+	$(SLO)$/AccText.obj \
+	$(SLO)$/AccValue.obj \
+	$(SLO)$/EnumVariant.obj \
+	$(SLO)$/StdAfx.obj \
+	$(SLO)$/UAccCOM.obj \
+	$(SLO)$/UNOXWrapper.obj \
+	$(SLO)$/AccTable.obj \
+	$(SLO)$/AccTextBase.obj \
+	$(SLO)$/MAccessible.obj \
+
+SHL1TARGET=$(TARGET)
+SHL1STDLIBS=\
+    $(ICUUCLIB)\
+    $(ICUINLIB)\
+    $(CPPULIB)\
+    $(VCLLIB) \
+	$(SALLIB)\
+	$(KERNEL32LIB) \
+	$(USER32LIB) \
+	$(ADVAPI32LIB) \
+	$(OLE32LIB) \
+	$(OLEAUT32LIB) \
+	$(SHLWAPILIB) \
+	$(UUIDLIB) \
+	oleacc.lib
+	
+.IF "$(COM)"!="GCC"
+.IF "$(CCNUMVER)" > "001300000000"
+.IF "$(USE_STLP_DEBUG)" != ""
+    SHL1STDLIBS+= $(ATL_LIB)$/atlsd.lib
+.ELSE
+    SHL1STDLIBS+= $(ATL_LIB)$/atls.lib
+.ENDIF
+.ENDIF
+.ENDIF 
+    
+SHL1OBJS=$(SLOFILES)
+SHL1DEF=$(TARGET).def 
+SHL1RES=$(RES)/$(TARGET).res 
+
+DEF1NAME= $(TARGET)
+#DEF1EXPORTFILE=	exports.dxp
+
+.ENDIF
+
+# --- Targets ----------------------------------
+.INCLUDE : target.mk
+
+ALLTAR : \
+    $(MISC)/$(TARGET).manifest \
+
+$(MISC)/$(TARGET).manifest: $(BIN)$/$(TARGET)$(DLLPOST)
+	cat *.rgs > $(MISC)$/$(TARGET).rgs
+	mt.exe -rgs:$(MISC)$/$(TARGET).rgs -tlb:$(MISC)$/$(TARGET).tlb -dll:$(TARGET).dll -out:$(MISC)$/$(TARGET).manifest
+	mt.exe -manifest $(MISC)$/$(TARGET).manifest -outputresource:$(BIN)$/$(TARGET)$(DLLPOST)\;\#97
\ No newline at end of file
diff --git a/main/winaccessibility/source/UAccCOM/stdafx.h b/main/winaccessibility/source/UAccCOM/stdafx.h
new file mode 100644
index 0000000..a4fa626
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOM/stdafx.h
@@ -0,0 +1,64 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+// stdafx.h : include file for standard system include files,
+//      or project specific include files that are used frequently,
+//      but are changed infrequently
+
+#if !defined(AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED_)
+#define AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED_
+
+#if _MSC_VER > 1000
+#pragma once
+#endif // _MSC_VER > 1000
+
+#define STRICT
+#ifndef _WIN32_WINNT
+#define _WIN32_WINNT 0x0400
+#endif
+//#define _ATL_APARTMENT_THREADED
+
+#include <atlbase.h>
+// You may derive a class from CComModule and use it if you want to override
+// something, but do not change the name of _Module
+extern CComModule _Module;
+#include <atlcom.h>
+
+#define ENTER_PROTECTED_BLOCK	\
+	try							\
+	{
+
+#define LEAVE_PROTECTED_BLOCK	\
+	}							\
+	catch(...)					\
+	{							\
+		return E_FAIL;			\
+	}
+
+#define SAFE_SYSFREESTRING(x) { ::SysFreeString(x); x=NULL; }
+
+#include <windows.h>
+#undef OPAQUE 
+#include "CheckEnableAccessible.h"
+//{{AFX_INSERT_LOCATION}}
+// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
+
+#endif // !defined(AFX_STDAFX_H__5E2F9072_190F_47C7_8003_4D44FD308CB9__INCLUDED)
diff --git a/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl b/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl
new file mode 100644
index 0000000..253216a
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyBinding.idl
@@ -0,0 +1,66 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+import "objidl.idl";
+import "oaidl.idl";
+import "oleacc.idl";
+import "AccessibleKeyStroke.idl";
+        
+[object, uuid(6B1923AC-3E9A-4336-99E1-A69EA4E946E9)]
+interface IAccessibleKeyBinding : IUnknown
+{
+  ///
+  /// get number of key bindings for this object
+  ///
+  [propget] HRESULT nKeyBindings
+    (
+     [out, retval] long *nKeyBindings
+     );
+
+  ///
+  /// get length of keystroke sequence for specified key binding
+  ///
+  [propget] HRESULT keyStrokeSequenceLength
+    (
+     [in] long keyBindingIndex,
+     [out] long *sequenceLength
+     );
+
+  ///
+  /// The returned sequence of key strokes describes one method
+  /// to invoke the associated action (the one from which you
+  /// obtained the object at which you called this method) by
+  /// pressing keys. The keys specified by each of the returned
+  /// key strokes have to be pressed at the same time (the
+  /// Control-key and the A-key for example). The keys of one key
+  /// stroke have to be released before pressing those of the next.
+  /// The order of the key strokes in the sequence define the order
+  /// in which to press them.
+  ///
+  [propget] HRESULT keyBinding
+    (
+     [in] long keyBindingIndex,
+     [in] long keyStrokeSequenceLength,
+     [out, size_is(,keyStrokeSequenceLength), length_is(,*actualKeyStrokeSequenceLength)]
+       ACCESSIBLE_KEYSTROKE **keyStroke,
+     [out, retval] long *actualKeyStrokeSequenceLength
+     );
+}
diff --git a/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl b/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl
new file mode 100644
index 0000000..0ac329f
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/AccessibleKeyStroke.idl
@@ -0,0 +1,149 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+        
+typedef struct _ACCESSIBLE_KEYSTROKE {
+  short modifiers;
+  short keyCode;
+  char keyChar;
+  short keyFunc;
+} ACCESSIBLE_KEYSTROKE;
+
+const short MODIFIER_SHIFT = 1;
+const short MODIFIER_CTRL = 2;
+const short MODIFIER_ALT = 4;
+
+const short KEYCODE_NUM0 = 256;
+const short KEYCODE_NUM1 = 257;
+const short KEYCODE_NUM2 = 258;
+const short KEYCODE_NUM3 = 259;
+const short KEYCODE_NUM4 = 260;
+const short KEYCODE_NUM5 = 261;
+const short KEYCODE_NUM6 = 262;
+const short KEYCODE_NUM7 = 263;
+const short KEYCODE_NUM8 = 264;
+const short KEYCODE_NUM9 = 265;
+const short KEYCODE_A = 512;
+const short KEYCODE_B = 513;
+const short KEYCODE_C = 514;
+const short KEYCODE_D = 515;
+const short KEYCODE_E = 516;
+const short KEYCODE_F = 517;
+const short KEYCODE_G = 518;
+const short KEYCODE_H = 519;
+const short KEYCODE_I = 520;
+const short KEYCODE_J = 521;
+const short KEYCODE_K = 522;
+const short KEYCODE_L = 523;
+const short KEYCODE_M = 524;
+const short KEYCODE_N = 525;
+const short KEYCODE_O = 526;
+const short KEYCODE_P = 527;
+const short KEYCODE_Q = 528;
+const short KEYCODE_R = 529;
+const short KEYCODE_S = 530;
+const short KEYCODE_T = 531;
+const short KEYCODE_U = 532;
+const short KEYCODE_V = 533;
+const short KEYCODE_W = 534;
+const short KEYCODE_X = 535;
+const short KEYCODE_Y = 536;
+const short KEYCODE_Z = 537;
+const short KEYCODE_F1 = 768;
+const short KEYCODE_F2 = 769;
+const short KEYCODE_F3 = 770;
+const short KEYCODE_F4 = 771;
+const short KEYCODE_F5 = 772;
+const short KEYCODE_F6 = 773;
+const short KEYCODE_F7 = 774;
+const short KEYCODE_F8 = 775;
+const short KEYCODE_F9 = 776;
+const short KEYCODE_F10 = 777;
+const short KEYCODE_F11 = 778;
+const short KEYCODE_F12 = 779;
+const short KEYCODE_F13 = 780;
+const short KEYCODE_F14 = 781;
+const short KEYCODE_F15 = 782;
+const short KEYCODE_F16 = 783;
+const short KEYCODE_F17 = 784;
+const short KEYCODE_F18 = 785;
+const short KEYCODE_F19 = 786;
+const short KEYCODE_F20 = 787;
+const short KEYCODE_F21 = 788;
+const short KEYCODE_F22 = 789;
+const short KEYCODE_F23 = 790;
+const short KEYCODE_F24 = 791;
+const short KEYCODE_F25 = 792;
+const short KEYCODE_F26 = 793;
+const short KEYCODE_DOWN = 1024;
+const short KEYCODE_UP = 1025;
+const short KEYCODE_LEFT = 1026;
+const short KEYCODE_RIGHT = 1027;
+const short KEYCODE_HOME = 1028;
+const short KEYCODE_END = 1029;
+const short KEYCODE_PAGEUP = 1030;
+const short KEYCODE_PAGEDOWN = 1031;
+const short KEYCODE_RETURN = 1280;
+const short KEYCODE_ESCAPE = 1281;
+const short KEYCODE_TAB = 1282;
+const short KEYCODE_BACKSPACE = 1283;
+const short KEYCODE_SPACE = 1284;
+const short KEYCODE_INSERT = 1285;
+const short KEYCODE_DELETE = 1286;
+const short KEYCODE_ADD = 1287;
+const short KEYCODE_SUBTRACT = 1288;
+const short KEYCODE_MULTIPLY = 1289;
+const short KEYCODE_DIVIDE = 1290;
+const short KEYCODE_POINT = 1291;
+const short KEYCODE_COMMA = 1292;
+const short KEYCODE_LESS = 1293;
+const short KEYCODE_GREATER = 1294;
+const short KEYCODE_EQUAL = 1295;
+const short KEYCODE_OPEN = 1296;
+const short KEYCODE_CUT = 1297;
+const short KEYCODE_COPY = 1298;
+const short KEYCODE_PASTE = 1299;
+const short KEYCODE_UNDO = 1300;
+const short KEYCODE_REPEAT = 1301;
+const short KEYCODE_FIND = 1302;
+const short KEYCODE_PROPERTIES = 1303;
+const short KEYCODE_FRONT = 1304;
+const short KEYCODE_CONTEXTMENU = 1305;
+const short KEYCODE_HELP = 1306;
+
+const short SHORTCUT_DONTKNOW = 0;
+const short NEW = 1;
+const short OPEN = 2;
+const short SAVE = 3;
+const short SAVEAS = 4;
+const short PRINT = 5;
+const short CLOSE = 6;
+const short QUIT = 7;
+const short CUT = 8;
+const short COPY = 9;
+const short PASTE = 10;
+const short UNDO = 11;
+const short REDO = 12;
+const short UNODELETE = 13;
+const short REPEAT = 14;
+const short FIND = 15;
+const short FINDBACKWARD = 16;
+const short PROPERTIES = 17;
+const short FRONT = 18;
diff --git a/main/winaccessibility/source/UAccCOMIDL/Charset.idl b/main/winaccessibility/source/UAccCOMIDL/Charset.idl
new file mode 100644
index 0000000..349723c
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/Charset.idl
@@ -0,0 +1,33 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+
+

+const short CHARSET_DONTKNOW = 0;
+const short ANSI = 1;
+const short MAC = 2;
+const short IBMPC_437 = 3;
+const short IBMPC_850 = 4;
+const short IBMPC_860 = 5;
+const short IBMPC_861 = 6;
+const short IBMPC_863 = 7;
+const short IBMPC_865 = 8;
+const short CHARSET_SYSTEM = 9;
+const short SYMBOL = 10;
diff --git a/main/winaccessibility/source/UAccCOMIDL/UAccCOM.idl b/main/winaccessibility/source/UAccCOMIDL/UAccCOM.idl
new file mode 100644
index 0000000..5248d5b
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/UAccCOM.idl
@@ -0,0 +1,209 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+import "oaidl.idl";
+import "ocidl.idl";
+
+import "ia2_api_all.idl";
+import "defines.idl";
+
+	[
+		object,
+		uuid(D00F5EB7-588A-487F-A6F6-0B5D7D1815AA),
+		dual,
+		helpstring("IMAccessible Interface"),
+		pointer_default(unique)
+	]
+	interface IMAccessible : IAccessible2
+	{
+		[id(1), helpstring("method Put_XAccName")] HRESULT Put_XAccName(const OLECHAR* pszName);
+		[id(2), helpstring("method Put_XAccRole")] HRESULT Put_XAccRole(unsigned short pRole);
+		[id(3), helpstring("method DecreaseState")] HRESULT DecreaseState(DWORD pXSate);
+		[id(4), helpstring("method IncreaseState")] HRESULT IncreaseState(DWORD pXSate);
+		[id(5), helpstring("method Put_XDescription")] HRESULT Put_XAccDescription(const OLECHAR* pszDescription);
+		[id(6), helpstring("method Put_XAccValue")] HRESULT Put_XAccValue(const OLECHAR* pszAccValue);
+		[id(7), helpstring("method SetState")] HRESULT SetState(DWORD pXSate);
+		[id(8), helpstring("method Put_XAccLocation")] HRESULT Put_XAccLocation(const Location sLocation);
+		[id(9), helpstring("method Put_XAccFocus")] HRESULT Put_XAccFocus(long dChildID);
+		[id(10), helpstring("method Put_XAccParent")] HRESULT Put_XAccParent(IMAccessible* pIParent);	
+		[id(13), helpstring("method Put_XAccWindowHandle")] HRESULT Put_XAccWindowHandle(HWND hwnd);
+		[id(14), helpstring("method Put_XAccChildID")] HRESULT Put_XAccChildID(long dChildID);
+		[id(19), helpstring("method SetXAccessible")] HRESULT SetXAccessible( long XAccessible);
+		[id(20), helpstring("method GetUNOInterface")] HRESULT GetUNOInterface(long* UNOInterface);
+		[id(23), helpstring("method SetDefaultAction")] HRESULT SetDefaultAction(long pAction);
+		[id(24), helpstring("method Put_ActionDescription")] HRESULT Put_ActionDescription( const OLECHAR* szAction);
+		[id(25), helpstring("method Put_XAccAgent")] HRESULT Put_XAccAgent(long pAgent);
+		[id(26), helpstring("method NotifyDestroy")] HRESULT NotifyDestroy(BOOL isDestroy);
+		[id(30), helpstring("method Get_XAccChildID")] HRESULT Get_XAccChildID([out,retval] long* childID);
+	};
+	[
+		object,
+		uuid(951299EE-1841-4249-9E07-812C0739E489),
+		dual,
+		helpstring("IEnumVariant Interface"),
+		pointer_default(unique)
+	]
+	interface IEnumVariant : IEnumVARIANT
+	{
+		[id(1), helpstring("method ClearEnumeration")] HRESULT ClearEnumeration();
+		[id(2), helpstring("method PutSelection")] HRESULT PutSelection(long pXSeletion);	
+	};
+	[
+		object,
+		uuid(6641185C-E099-4C45-B753-3FBC0EE40646),
+		dual,
+		helpstring("IUNOXWrapper Interface"),
+		pointer_default(unique)
+	]
+	interface IUNOXWrapper : IUnknown
+	{
+		[id(1), helpstring("method put_XInterface")] HRESULT put_XInterface(long pXInterface);
+		[id(2), helpstring("method put_XSubInterface")] HRESULT put_XSubInterface(long pXSubInterface);
+		[id(3), helpstring("method get_XInterface")] HRESULT get_XInterface([out,retval]long* pXInterface);
+		[id(4), helpstring("method get_XSubInterface")] HRESULT get_XSubInterface([out,retval]long* pXSubInterface);
+	};
+
+[
+	uuid(19ECB1B0-9376-4FF9-B580-223FC9C200B8),
+	version(1.0),
+	helpstring("UAccCOM 1.0 Type Library")
+]
+library UACCCOMLib
+{
+	importlib("stdole32.tlb");
+	importlib("stdole2.tlb");
+	importlib("oleacc.dll");
+
+	[
+		uuid(CF8DF8BA-44FE-4B10-BD2E-8C8CB322485F),
+		helpstring("MAccessible Class")
+	]
+	coclass MAccessible
+	{
+		[default] interface IMAccessible;
+	};
+	[
+		uuid(152884E0-268B-4481-9AE7-1B372D3AA97F),
+		helpstring("EnumVariant Class")
+	]
+	coclass EnumVariant
+	{
+		[default] interface IEnumVariant;
+	};
+	[
+		uuid(AA360FB0-BC98-41C1-A885-BB921F5ED601),
+		helpstring("UNOXWrapper Class")
+	]
+	coclass UNOXWrapper
+	{
+		[default] interface IUNOXWrapper;
+	};
+	
+	[
+		uuid(9FD9BA47-70AF-4160-99F1-526F2B9F111B),
+		helpstring("AccComponent Class")
+	]
+	coclass AccComponent
+	{
+		[default] interface IAccessibleComponent;
+	};
+
+    [
+		uuid(8745CF0C-3104-4BAE-B7D0-D7B1717C006E),
+		helpstring("AccRelation Class")
+	]
+	coclass AccRelation
+	{
+		[default] interface IAccessibleRelation;
+	};
+	[
+		uuid(AA49F20E-BB4E-400D-A5B0-6F5B7B770227),
+		helpstring("AccAction Class")
+	]
+	coclass AccAction
+	{
+		[default] interface IAccessibleAction;
+	};
+
+	[
+		uuid(6D8AB08B-CCE9-471E-8A41-35773D5263F5),
+		helpstring("AccText Class")
+	]
+	coclass AccText
+	{
+		[default] interface IAccessibleText;
+	};
+	
+	[
+		uuid(79CE1450-1F61-48E2-BF76-C07BD10105E2),
+		helpstring("AccEditableText Class")
+	]
+	coclass AccEditableText
+	{
+		[default] interface IAccessibleEditableText;
+	};	
+
+	[
+		uuid(CC55D71B-1828-4EE0-89E2-C3749CF9C9AB),
+		helpstring("AccHypertext Class")
+	]
+	coclass AccHypertext
+	{
+		[default] interface IAccessibletext;
+	};
+
+	
+	[
+		uuid(73A45800-7A62-432C-A1A6-BF8852994331),
+		helpstring("AccImage Class")
+	]
+	coclass AccImage
+	{
+		[default] interface IAccessibleImage;
+	};
+	
+	[
+		uuid(730A561B-1AF6-49E1-9C04-9A2F48CD8512),
+		helpstring("AccValue Class")
+	]
+	coclass AccValue
+	{
+		[default] interface IAccessibleValue;
+	};
+	[
+		uuid(92BAA62D-535A-4EAB-9ABB-BFA60B7A6DB6),
+		helpstring("AccTable Class")
+	]
+	coclass AccTable
+	{
+		[default] interface IAccessibleTable;
+	};
+	
+	[
+		uuid(519A64CD-F6A6-4793-BE50-4E36C4C593EF),
+		helpstring("AccHyperLink Class")
+	]
+	coclass AccHyperLink
+	{
+		[default] interface IAccessibleAction;
+	};
+	
+};
diff --git a/main/winaccessibility/source/UAccCOMIDL/defines.idl b/main/winaccessibility/source/UAccCOMIDL/defines.idl
new file mode 100644
index 0000000..c82a832
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/defines.idl
@@ -0,0 +1,40 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+import "objidl.idl";
+import "oaidl.idl";
+import "oleacc.idl";
+
+interface IMAccessible;
+
+const long UACC_NO_FOCUS=0xFFFF;
+
+typedef struct {
+	long m_dChildID;//identify a unique child node
+	IMAccessible* m_pIMAccessible;
+}AccChildNode;
+
+typedef struct Location {
+	long m_dLeft;
+	long m_dTop;
+	long m_dWidth;
+	long m_dHeight;
+}Location;
diff --git a/main/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl b/main/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl
new file mode 100644
index 0000000..9b1c483
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/ia2_api_all.idl
@@ -0,0 +1,5473 @@
+/*************************************************************************

+ *

+ *  File Name (api_all_headers.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2013 Linux Foundation 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+import "objidl.idl";

+import "oaidl.idl";

+import "oleacc.idl";

+

+/*************************************************************************

+ *

+ *  File Name (IA2CommonTypes.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+ /** These constants control the scrolling of an object or substring into a window.

+

+ This enum is used in IAccessible2::scrollTo and IAccessibleText::scrollSubstringTo.

+*/

+enum IA2ScrollType {

+

+  /** Scroll the top left corner of the object or substring such that the top left

+   corner (and as much as possible of the rest of the object or substring) is within

+   the top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_TOP_LEFT, 		

+

+  /** Scroll the bottom right corner of the object or substring such that the bottom right

+   corner (and as much as possible of the rest of the object or substring) is within

+   the top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_BOTTOM_RIGHT,

+

+  /** Scroll the top edge of the object or substring such that the top edge 

+   (and as much as possible of the rest of the object or substring) is within the

+   top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_TOP_EDGE,

+

+  /** Scroll the bottom edge of the object or substring such that the bottom edge 

+   (and as much as possible of the rest of the object or substring) is within the

+   top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_BOTTOM_EDGE, 

+

+  /** Scroll the left edge of the object or substring such that the left edge 

+   (and as much as possible of the rest of the object or substring) is within the

+   top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_LEFT_EDGE, 

+

+  /** Scroll the right edge of the object or substring such that the right edge 

+   (and as much as possible of the rest of the object or substring) is within the

+   top level window.  In cases where the entire object or substring fits within 

+   the top level window, the placement of the object or substring is dependent on 

+   the application.  For example, the object or substring may be scrolled to the 

+   closest edge, the furthest edge, or midway between those two edges.  In cases

+   where there is a hierarchy of nested scrollable controls, more than one control

+   may have to be scrolled.

+  */

+  IA2_SCROLL_TYPE_RIGHT_EDGE,

+

+  /** Scroll the object or substring such that as much as possible of the 

+   object or substring is within the top level window.  The placement of 

+   the object is dependent on the application.  For example, the object or

+   substring may be scrolled to to closest edge, the furthest edge, or midway

+   between those two edges.

+  */

+  IA2_SCROLL_TYPE_ANYWHERE

+};

+

+/** These constants define which coordinate system a point is located in.

+ 

+ This enum is used in IAccessible2::scrollToPoint, IAccessibleImage::imagePosition,

+ IAccessibleText::characterExtents, and IAccessibleText::offsetAtPoint, and 

+ IAccessibleText::scrollSubstringToPoint.

+*/

+enum IA2CoordinateType {

+

+  /// The coordinates are relative to the screen.

+  IA2_COORDTYPE_SCREEN_RELATIVE, 

+

+  /** The coordinates are relative to the upper left corner of the bounding box

+   of the immediate parent.

+  */

+  IA2_COORDTYPE_PARENT_RELATIVE  

+

+};

+

+/** Special offsets for use in IAccessibleText and IAccessibleEditableText methods

+  

+  Refer to @ref _specialOffsets 

+  "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+  for more information.

+*/

+enum IA2TextSpecialOffsets {

+  IA2_TEXT_OFFSET_LENGTH = -1,	/**< This offset is equivalent to the length of the string.  It eliminates

+								 the need to call IAccessibleText::nCharacters. */

+  IA2_TEXT_OFFSET_CARET = -2	/**< This offset signifies that the text related to the physical location

+								 of the caret should be used. */

+};

+

+/** These constants specify the kind of change made to a table.

+

+   This enum is used in the IA2TableModelChange struct which in turn is used by

+   IAccessibleTable::modelChange and IAccessibleTable2::modelChange.

+*/

+enum IA2TableModelChangeType {

+  IA2_TABLE_MODEL_CHANGE_INSERT,  // = 0;

+  IA2_TABLE_MODEL_CHANGE_DELETE,

+  IA2_TABLE_MODEL_CHANGE_UPDATE

+};

+

+/** A structure defining the type of and extents of changes made to a table

+ 

+ IAccessibleTable::modelChange and IAccessibleTable2::modelChange return this struct.

+ In the case of an insertion or change the row and column offsets define the boundaries

+ of the inserted or changed subtable after the operation.  In the case of a deletion

+ the row and column offsets define the boundaries of the subtable being removed before

+ the removal.

+*/

+typedef struct IA2TableModelChange {

+  enum IA2TableModelChangeType type;	// insert, delete, update

+  long firstRow;		///< 0 based, inclusive

+  long lastRow;			///< 0 based, inclusive

+  long firstColumn;		///< 0 based, inclusive

+  long lastColumn;		///< 0 based, inclusive

+} IA2TableModelChange;

+/*************************************************************************

+ *

+ *  File Name (AccessibleRelation.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+

+/** @defgroup grpRelations Relations 

+  Use the following constants to compare against the BSTRs returned by 

+  IAccessibleRelation::relationType.

+*/ 

+///@{

+

+/** The target object is the containing application object. */

+const WCHAR *const IA2_RELATION_CONTAINING_APPLICATION = L"containingApplication";

+

+/** The target object is the containing document object. The target object implements

+ the IAccessibleDocument interface.

+*/

+const WCHAR *const IA2_RELATION_CONTAINING_DOCUMENT = L"containingDocument";

+

+/** The target object is the containing tab pane object. */

+const WCHAR *const IA2_RELATION_CONTAINING_TAB_PANE = L"containingTabPane";

+

+/** The target object is the containing window object. */

+const WCHAR *const IA2_RELATION_CONTAINING_WINDOW = L"containingWindow";

+

+/** Some attribute of this object is affected by a target object. */

+const WCHAR *const IA2_RELATION_CONTROLLED_BY = L"controlledBy";

+

+/** This object is interactive and controls some attribute of a target object. */

+const WCHAR *const IA2_RELATION_CONTROLLER_FOR = L"controllerFor";

+

+/** This object is described by the target object. */

+const WCHAR *const IA2_RELATION_DESCRIBED_BY = L"describedBy";

+

+/** This object is describes the target object. */

+const WCHAR *const IA2_RELATION_DESCRIPTION_FOR = L"descriptionFor";

+

+/** This object is embedded by a target object. */

+const WCHAR *const IA2_RELATION_EMBEDDED_BY = L"embeddedBy";

+

+/** This object embeds a target object. This relation can be used on the

+ OBJID_CLIENT accessible for a top level window to show where the content 

+ areas are.

+*/

+const WCHAR *const IA2_RELATION_EMBEDS = L"embeds";

+

+/** Content flows to this object from a target object. 

+ This relation and IA2_RELATION_FLOWS_TO are useful to tie text and non-text

+ objects together in order to allow assistive technology to follow the

+ intended reading order.

+*/

+const WCHAR *const IA2_RELATION_FLOWS_FROM = L"flowsFrom";

+

+/** Content flows from this object to a target object. */

+const WCHAR *const IA2_RELATION_FLOWS_TO = L"flowsTo";

+

+/** This object is label for a target object. */

+const WCHAR *const IA2_RELATION_LABEL_FOR = L"labelFor";

+

+/** This object is labelled by a target object. Note that the double L spelling

+ which follows is preferred.  Please use it instead.  This single L version may

+ be removed in a later version.

+*/

+const WCHAR *const IA2_RELATION_LABELED_BY = L"labelledBy";

+

+/** This object is labelled by a target object. */

+const WCHAR *const IA2_RELATION_LABELLED_BY = L"labelledBy";

+

+/** This object is a member of a group of one or more objects. When 

+ there is more than one object in the group each member may have one and the 

+ same target, e.g. a grouping object.  It is also possible that each member has 

+ multiple additional targets, e.g. one for every other member in the group.

+*/

+const WCHAR *const IA2_RELATION_MEMBER_OF = L"memberOf";

+

+/** The target object is the next object in the tab order. */

+const WCHAR *const IA2_RELATION_NEXT_TABBABLE = L"nextTabbable";

+

+/** This object is a logical child of a target object.  This relation is the reciprocal

+ of the IA2_RELATION_NODE_PARENT_OF relation. In some cases an application's accessible

+ tree is such that objects can be in a logical parent-child relationship which is

+ different from the hierarchy of the accessible tree. */

+const WCHAR *const IA2_RELATION_NODE_CHILD_OF = L"nodeChildOf";

+

+/** This object is a logical parent of a target object. This relation is the reciprocal

+ of the IA2_RELATION_NODE_CHILD_OF relation. In some cases an application's accessible

+ tree is such that objects can be in a logical parent-child relationship which is

+ different from the hierarchy of the accessible tree. */

+const WCHAR *const IA2_RELATION_NODE_PARENT_OF = L"nodeParentOf";

+

+/** This object is a parent window of the target object. */

+const WCHAR *const IA2_RELATION_PARENT_WINDOW_OF = L"parentWindowOf";

+

+/** This object is a transient component related to the target object. 

+ When this object is activated the target object doesn't lose focus.

+*/

+const WCHAR *const IA2_RELATION_POPUP_FOR = L"popupFor";

+

+/** The target object is the previous object in the tab order. */

+const WCHAR *const IA2_RELATION_PREVIOUS_TABBABLE = L"previousTabbable";

+

+/** This object is a sub window of a target object. */

+const WCHAR *const IA2_RELATION_SUBWINDOW_OF = L"subwindowOf";

+

+///@}

+

+/** This interface gives access to an object's set of relations.

+*/

+[object, uuid(7CDF86EE-C3DA-496a-BDA4-281B336E1FDC)]

+interface IAccessibleRelation : IUnknown

+{

+  /** @brief Returns the type of the relation.

+   @param [out] relationType

+    The strings returned are defined @ref grpRelations "in this section of the documentation".

+   @retval S_OK

+  */

+  [propget] HRESULT relationType

+    (

+     [out, retval] BSTR *relationType

+    );

+

+  /** @brief Returns a localized version of the relation type.

+   @param [out] localizedRelationType

+   @retval S_OK

+  */

+  [propget] HRESULT localizedRelationType

+    (

+     [out, retval] BSTR *localizedRelationType

+    );

+

+  /** @brief Returns the number of targets for this relation.

+   @param [out] nTargets

+   @retval S_OK

+  */

+  [propget] HRESULT nTargets

+    (

+     [out, retval] long *nTargets

+    );

+

+  /** @brief Returns one accessible relation target.

+   @param [in] targetIndex

+    0 based index

+   @param [out] target

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Use QueryInterface to get IAccessible2.

+  */

+  [propget] HRESULT target

+    (

+     [in] long targetIndex,

+     [out, retval] IUnknown **target 

+    );

+

+  /** @brief Returns multiple accessible relation targets

+   @param [in] maxTargets

+    maximum size of the array allocated by the client

+   @param [out] targets

+    The array of target objects.  Note that this array is to be allocated by the

+	client and freed when no longer needed.  Refer to @ref _arrayConsideration 

+	"Special Consideration when using Arrays" for more details.  You will need to use 

+	QueryInterface on the IUnknown to get the IAccessible2.

+   @param [out] nTargets

+	actual number of targets in the returned array (not more than maxTargets)

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, e.g. a negative value

+  */

+  [propget] HRESULT targets

+    (

+     [in] long maxTargets, 

+     [out, size_is(maxTargets), length_is(*nTargets)]

+       IUnknown **targets, 

+     [out, retval] long *nTargets 

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleAction.idl)

+ *

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+

+/** This enum defines values which are predefined actions for use when implementing

+ support for media.

+

+ This enum is used when specifying an action for IAccessibleAction::doAction.

+*/

+

+enum IA2Actions {

+  IA2_ACTION_OPEN = -1,         /**< Used to inform the server that the client will

+                                signal via IA2_ACTION_COMPLETE when it has consumed

+                                the content provided by the object.  This action

+                                allows the object's server to wait for all clients

+                                to signal their readiness for additional content.

+                                Any form of content generation that requires

+                                synchronization with an AT would require use of this

+                                action.  One example is the generation of text describing

+                                visual content not obvious from a video's sound track.

+                                In this scenario the Text to Speech or Braille output

+                                may take more time than the related length of silence

+                                in the video's sound track. */

+  IA2_ACTION_COMPLETE = -2,  	/**< Used by the client to inform the server that it has

+                                consumed the most recent content provided by this object. */

+  IA2_ACTION_CLOSE = -3         /**< Used to inform the server that the client no longer

+                                requires synchronization. */

+};

+        

+/** @brief This interface gives access to actions that can be executed

+  for accessible objects.

+

+ Every accessible object that can be manipulated via the native GUI beyond the 

+  methods available either in the MSAA IAccessible interface or in the set of 

+  IAccessible2 interfaces (other than this IAccessibleAction interface) should 

+  support the IAccessibleAction interface in order to provide Assistive Technology

+  access to all the actions that can be performed by the object.  Each action can 

+  be performed or queried for a name, description or associated key bindings.  

+  Actions are needed more for ATs that assist the mobility impaired, such as

+  on-screen keyboards and voice command software.  By providing actions directly,

+  the AT can present them to the user without the user having to perform the extra

+  steps to navigate a context menu.

+

+ The first action should be equivalent to the MSAA default action.  If there is 

+  only one action, %IAccessibleAction should also be implemented.

+*/

+[object, uuid(B70D9F59-3B5A-4dba-AB9E-22012F607DF5)]

+interface IAccessibleAction : IUnknown

+{

+

+  /** @brief Returns the number of accessible actions available in this object.

+    

+   If there are more than one, the first one is considered the

+    "default" action of the object.

+   @param [out] nActions

+    The returned value of the number of actions is zero if there are

+    no actions.

+   @retval S_OK

+   @note This method is missing a [propget] prefix in the IDL.  The result is the

+    method is named nActions in generated C++ code instead of get_nActions.

+  */

+  HRESULT nActions

+    (

+     [out,retval] long* nActions

+    );

+

+  /** @brief Performs the specified Action on the object.

+   @param [in] actionIndex

+    0 based index specifying the action to perform.  If it lies outside

+    the valid range no action is performed.

+   @retval S_OK

+   @retval S_FALSE if action could not be performed

+   @retval E_INVALIDARG if bad [in] passed

+   @note If implementing support for media, refer to the predefined constants in the ::IA2Actions enum.

+    */

+  HRESULT doAction

+    (

+     [in] long actionIndex

+    );

+

+  /** @brief Returns a description of the specified action of the object.

+   @param [in] actionIndex

+    0 based index specifying which action's description to return.

+    If it lies outside the valid range an empty string is returned.

+   @param [out] description

+    The returned value is a localized string of the specified action.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed

+    */

+  [propget] HRESULT description

+    (

+     [in] long actionIndex,

+     [out, retval] BSTR *description

+    );

+

+  /** @brief Returns an array of BSTRs describing one or more key bindings, if

+   there are any, associated with the specified action.

+

+   The returned strings are the localized human readable key sequences to be

+   used to activate each action, e.g. "Ctrl+Shift+D".  Since these key

+   sequences are to be used when the object has focus, they are like

+   mnemonics (access keys), and not like shortcut (accelerator) keys.

+

+   There is no need to implement this method for single action controls since

+   that would be redundant with the standard MSAA programming practice of

+   getting the mnemonic from get_accKeyboardShortcut.

+

+   An AT such as an On Screen Keyboard might not expose these bindings but

+   provide alternative means of activation.

+

+   Note: the client allocates and passes in an array of pointers.  The server

+   allocates the BSTRs and passes back one or more pointers to these BSTRs into

+   the array of pointers allocated by the client.  The client is responsible 

+   for deallocating the BSTRs.

+

+   @param [in] actionIndex

+    0 based index specifying which action's key bindings should be returned.

+   @param [in] nMaxBindings

+    This parameter is ignored. Refer to @ref _arrayConsideration

+	"Special Consideration when using Arrays" for more details.

+   @param [out] keyBindings

+    An array of BSTRs, allocated by the server, one for each key binding.

+	The client must free it with CoTaskMemFree.

+   @param [out] nBindings

+    The number of key bindings returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are no key bindings, [out] values are NULL and 0 respectively 

+   @retval E_INVALIDARG if bad [in] passed

+	*/

+  [propget] HRESULT keyBinding

+    (

+     [in] long actionIndex,

+     [in] long nMaxBindings,

+     [out, size_is(,nMaxBindings), length_is(,*nBindings)] BSTR **keyBindings,

+	 [out, retval] long *nBindings

+    );

+

+  /** @brief Returns the non-localized name of specified action.

+   @param [in] actionIndex

+    0 based index specifying which action's non-localized name should be returned.

+   @param [out] name

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed

+   */

+  [propget] HRESULT name

+    (

+     [in] long actionIndex,

+     [out, retval] BSTR *name

+    );

+

+  /** @brief Returns the localized name of specified action.

+   @param [in] actionIndex

+    0 based index specifying which action's localized name should be returned.

+   @param [out] localizedName

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed

+   */

+  [propget] HRESULT localizedName

+    (

+     [in] long actionIndex,

+     [out, retval] BSTR *localizedName

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleRole.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+

+/** Collection of roles

+

+  This enumerator defines an extended set of accessible roles of objects implementing

+  the %IAccessible2 interface. These roles are in addition to the MSAA roles obtained

+  through the MSAA get_accRole method.  Examples are 'footnote', 'heading', and 

+  'label'. You obtain an object's %IAccessible2 roles by calling IAccessible2::role.

+*/

+enum IA2Role {

+

+  /** Unknown role. The object contains some Accessible information, but its 

+   role is not known.

+  */

+  IA2_ROLE_UNKNOWN = 0,

+

+  /** An object that can be drawn into and to manage events from the objects

+   drawn into it.  Also refer to ::IA2_ROLE_FRAME,

+   ::IA2_ROLE_GLASS_PANE, and ::IA2_ROLE_LAYERED_PANE. 

+  */

+  IA2_ROLE_CANVAS = 0x401,

+

+  /// A caption describing another object.

+  IA2_ROLE_CAPTION,

+

+  /// Used for check buttons that are menu items.

+  IA2_ROLE_CHECK_MENU_ITEM,

+

+  /// A specialized dialog that lets the user choose a color.

+  IA2_ROLE_COLOR_CHOOSER,

+

+  /// A date editor.

+  IA2_ROLE_DATE_EDITOR,

+

+  /** An iconified internal frame in an ::IA2_ROLE_DESKTOP_PANE. 

+   Also refer to ::IA2_ROLE_INTERNAL_FRAME.

+  */

+  IA2_ROLE_DESKTOP_ICON,

+

+  /** A desktop pane. A pane that supports internal frames and iconified 

+   versions of those internal frames.  Also refer to ::IA2_ROLE_INTERNAL_FRAME.

+  */

+  IA2_ROLE_DESKTOP_PANE,

+

+  /** A directory pane. A pane that allows the user to navigate through 

+   and select the contents of a directory. May be used by a file chooser.   

+   Also refer to ::IA2_ROLE_FILE_CHOOSER.

+  */

+  IA2_ROLE_DIRECTORY_PANE,

+

+  /** An editable text object in a toolbar. <b>Deprecated.</b>

+   The edit bar role was meant for a text area in a tool bar. However, to detect

+   a text area in a tool bar the AT can query the parent.

+  */

+  IA2_ROLE_EDITBAR,

+

+  /// Embedded (OLE) object.

+  IA2_ROLE_EMBEDDED_OBJECT,

+

+  /// Text that is used as an endnote (footnote at the end of a chapter or section).

+  IA2_ROLE_ENDNOTE,

+

+  /** A file chooser. A specialized dialog that displays the files in the 

+   directory and lets the user select a file, browse a different directory, 

+   or specify a filename. May use the directory pane to show the contents of 

+   a directory.  

+   Also refer to ::IA2_ROLE_DIRECTORY_PANE.

+  */

+  IA2_ROLE_FILE_CHOOSER,

+

+  /** A font chooser. A font chooser is a component that lets the user pick 

+   various attributes for fonts.

+  */

+  IA2_ROLE_FONT_CHOOSER,

+

+  /** Footer of a document page.

+   Also refer to ::IA2_ROLE_HEADER.

+  */

+  IA2_ROLE_FOOTER,

+

+  /// Text that is used as a footnote.  Also refer to ::IA2_ROLE_ENDNOTE.

+  IA2_ROLE_FOOTNOTE,

+

+  /** A container of form controls.  An example of the use of this role is to

+   represent an HTML FORM tag.

+  */

+  IA2_ROLE_FORM,

+

+  /** Frame role. A top level window with a title bar, border, menu bar, etc.  

+   It is often used as the primary window for an application.  Also refer to

+   ::IA2_ROLE_CANVAS and the MSAA roles of dialog and window.

+  */

+  IA2_ROLE_FRAME,

+

+  /** A glass pane. A pane that is guaranteed to be painted on top of all panes

+   beneath it.  Also refer to ::IA2_ROLE_CANVAS, ::IA2_ROLE_INTERNAL_FRAME, and

+   ::IA2_ROLE_ROOT_PANE.

+  */

+  IA2_ROLE_GLASS_PANE,

+

+  /** Header of a document page.

+   Also refer to ::IA2_ROLE_FOOTER.

+  */

+  IA2_ROLE_HEADER,

+

+  /// Heading.  Use the IAccessible2::attributes level attribute to determine the heading level.

+  IA2_ROLE_HEADING,

+

+  /// A small fixed size picture, typically used to decorate components.

+  IA2_ROLE_ICON,

+

+  /** An image map object.  Usually a graphic with multiple hotspots, where 

+   each hotspot can be activated resulting in the loading of another document

+   or section of a document.

+  */

+  IA2_ROLE_IMAGE_MAP,

+

+  /** An object which is used to allow input of characters not found on a keyboard,

+   such as the input of Chinese characters on a Western keyboard.

+  */

+  IA2_ROLE_INPUT_METHOD_WINDOW,

+

+  /** An internal frame. A frame-like object that is clipped by a desktop pane.  

+   The desktop pane, internal frame, and desktop icon objects are often used to 

+   create multiple document interfaces within an application.

+   Also refer to ::IA2_ROLE_DESKTOP_ICON, ::IA2_ROLE_DESKTOP_PANE, and ::IA2_ROLE_FRAME.

+  */

+  IA2_ROLE_INTERNAL_FRAME,

+

+  /// An object used to present an icon or short string in an interface.

+  IA2_ROLE_LABEL,

+

+  /** A layered pane. A specialized pane that allows its children to be drawn 

+   in layers, providing a form of stacking order. This is usually the pane that 

+   holds the menu bar as  well as the pane that contains most of the visual 

+   components in a window.

+   Also refer to ::IA2_ROLE_CANVAS, ::IA2_ROLE_GLASS_PANE, and ::IA2_ROLE_ROOT_PANE.

+  */

+  IA2_ROLE_LAYERED_PANE,

+

+  /** A section whose content is parenthetic or ancillary to the main content

+   of the resource.

+  */

+  IA2_ROLE_NOTE,

+

+ /** A specialized pane whose primary use is inside a dialog.

+   Also refer to MSAA's dialog role.

+  */

+  IA2_ROLE_OPTION_PANE,

+

+  /** An object representing a page of document content.  It is used in documents

+   which are accessed by the user on a page by page basis.

+  */

+  IA2_ROLE_PAGE,

+

+  /// A paragraph of text.

+  IA2_ROLE_PARAGRAPH,

+

+  /** A radio button that is a menu item.

+   Also refer to MSAA's button and menu item roles.

+  */

+  IA2_ROLE_RADIO_MENU_ITEM,

+

+  /** An object which is redundant with another object in the accessible hierarchy.

+   ATs typically ignore objects with this role.

+  */

+  IA2_ROLE_REDUNDANT_OBJECT,

+

+  /** A root pane. A specialized pane that has a glass pane and a layered pane 

+   as its children.

+   Also refer to ::IA2_ROLE_GLASS_PANE and ::IA2_ROLE_LAYERED_PANE

+  */

+  IA2_ROLE_ROOT_PANE,

+

+  /** A ruler such as those used in word processors.

+  */

+  IA2_ROLE_RULER,

+

+  /** A scroll pane. An object that allows a user to incrementally view a large 

+   amount of information.  Its children can include scroll bars and a viewport.

+   Also refer to ::IA2_ROLE_VIEW_PORT and MSAA's scroll bar role.

+  */

+  IA2_ROLE_SCROLL_PANE,

+

+  /** A container of document content.  An example of the use of this role is to

+   represent an HTML DIV tag.  A section may be used as a region.  A region is a 

+   group of elements that together form a perceivable unit.  A region does not 

+   necessarily follow the logical structure of the content, but follows the 

+   perceivable structure of the page.  A region may have an attribute in the set 

+   of IAccessible2::attributes which indicates that it is "live".  A live region 

+   is content that is likely to change in response to a timed change, a user 

+   event, or some other programmed logic or event.

+  */

+  IA2_ROLE_SECTION,

+

+  /// Object with graphical representation used to represent content on draw pages.

+  IA2_ROLE_SHAPE,

+

+  /** A split pane. A specialized panel that presents two other panels at the 

+   same time. Between the two panels is a divider the user can manipulate to make 

+   one panel larger and the other panel smaller.

+  */

+  IA2_ROLE_SPLIT_PANE,

+

+  /** An object that forms part of a menu system but which can be "undocked" 

+   from or "torn off" the menu system to exist as a separate window.

+  */

+  IA2_ROLE_TEAR_OFF_MENU,

+

+  /// An object used as a terminal emulator.

+  IA2_ROLE_TERMINAL,

+

+  /// Collection of objects that constitute a logical text entity.

+  IA2_ROLE_TEXT_FRAME,

+

+  /** A toggle button. A specialized push button that can be checked or unchecked, 

+   but does not provide a separate indicator for the current state.

+   Also refer to MSAA's roles of push button, check box, and radio button.

+   <BR><B>Note:</B> IA2_ROLE_TOGGLE_BUTTON should not be used.  Instead, use MSAA's 

+   ROLE_SYSTEM_PUSHBUTTON and STATE_SYSTEM_PRESSED.

+  */

+  IA2_ROLE_TOGGLE_BUTTON,

+

+  /** A viewport. An object usually used in a scroll pane. It represents the 

+   portion of the entire data that the user can see. As the user manipulates 

+   the scroll bars, the contents of the viewport can change.

+   Also refer to ::IA2_ROLE_SCROLL_PANE.

+  */

+  IA2_ROLE_VIEW_PORT,

+

+  /** An object containing content which is complementary to the main content of

+   a document, but remains meaningful when separated from the main content.  There

+   are various types of content that would appropriately have this role.  For example,

+   in the case where content is delivered via a web portal to a web browser, this may

+   include but not be limited to show times, current weather, related articles, or

+   stocks to watch.  The complementary role indicates that contained content is relevant

+   to the main content.  If the complementary content is completely separable main

+   content, it may be appropriate to use a more general role.

+  */

+  IA2_ROLE_COMPLEMENTARY_CONTENT

+  

+};

+/*************************************************************************

+ *

+ *  File Name (AccessibleStates.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+

+typedef long AccessibleStates;

+

+/** %IAccessible2 specific state bit constants

+

+  This enum defines the state bits returned by IAccessible2::states.  The 

+  %IAccessible2 state bits are in addition to those returned by MSAA.

+*/

+enum IA2States {

+

+/** Indicates a window is currently the active window, or is an active subelement 

+  within a container or table.

+

+ This state can be used to indicate the current active item in a container, even 

+  if the container itself is not currently active. In other words this would indicate

+  the item that will get focus if you tab to the container.

+

+ This information is important for knowing what to report for trees and potentially 

+  other containers in a virtual buffer.

+

+ Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.

+*/

+IA2_STATE_ACTIVE =					0x1,

+

+/** Indicates that the object is armed.

+

+ Used to indicate that the control is "pressed" and will be invoked when the 

+  actuator, e.g. a mouse button, is "released".  An AT which either monitors the 

+  mouse or synthesizes mouse events might need to know that, and possibly a talking

+  interface would even let the user know about it.  It could also potentially be

+  useful to on screen keyboards or test tools since the information does indicate

+  something about the state of the interface, for example, code operating asynchronously

+  might need to wait for the armed state to change before doing something else.

+

+*/

+IA2_STATE_ARMED =					0x2,

+

+/** Indicates the user interface object corresponding to this object no longer exists. */

+IA2_STATE_DEFUNCT =					0x4,

+

+/** An object with this state has a caret and implements the IAccessibleText interface.

+  

+ Such fields may be read-only, so STATE_SYSTEM_READONLY is valid in combination

+  with IA2_STATE_EDITABLE.

+

+*/

+IA2_STATE_EDITABLE =				0x8,

+

+/** Indicates the orientation of this object is horizontal. */

+IA2_STATE_HORIZONTAL =				0x10,

+

+/** Indicates this object is minimized and is represented only by an icon. */

+IA2_STATE_ICONIFIED =				0x20,

+

+/** Indicates an input validation failure. */

+IA2_STATE_INVALID_ENTRY =			0x40,

+

+/** Indicates that this object manages its children.

+

+ Note: Due to the fact that MSAA's WinEvents don't allow the active child index

+  to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event, the manages

+  descendants	scheme can't be used.  Instead the active child object has to fire

+  MSAA's EVENT_OBJECT_FOCUS.  In a future release a new event mechanism may be

+  added to provide for event specific data to be passed with the event.  At that

+  time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and

+  IA2_STATE_MANAGES_DESCENDANTS state would be useful.

+*/

+IA2_STATE_MANAGES_DESCENDANTS =		0x80,

+

+/** Indicates that an object is modal.

+

+ Modal objects have the behavior that something must be done with the object 

+  before the user can interact with an object in a different window.

+*/

+IA2_STATE_MODAL =					0x100,

+

+/** Indicates this text object can contain multiple lines of text. */

+IA2_STATE_MULTI_LINE =				0x200,

+

+/** Indicates this object paints every pixel within its rectangular region. */

+IA2_STATE_OPAQUE =					0x400,

+

+/** Indicates that user interaction is required.

+

+ An example of when this state is used is when a field in a form must be filled 

+  before a form can be processed.

+*/

+IA2_STATE_REQUIRED =				0x800,

+

+/** Indicates an object which supports text selection.

+

+ Note: This is different than MSAA STATE_SYSTEM_SELECTABLE.

+*/

+IA2_STATE_SELECTABLE_TEXT =			0x1000,

+

+/** Indicates that this text object can contain only a single line of text. */

+IA2_STATE_SINGLE_LINE =				0x2000,

+

+/** Indicates that the accessible object is stale.

+

+ This state is used when the accessible object no longer accurately 

+  represents the state of the object which it is representing such as when an

+  object is transient or when an object has been or is in the process of being

+  destroyed or when the object's index in its parent has changed.

+*/

+IA2_STATE_STALE =					0x4000,

+

+/** Indicates that the object implements autocompletion.

+

+ This state indicates that a text control will respond to the input of 

+ one ore more characters and cause a sub-item to become selected.  The 

+ selection may also result in events fired on the parent object.

+*/

+IA2_STATE_SUPPORTS_AUTOCOMPLETION =	0x8000,

+

+/** Indicates this object is transient.

+

+ An object has this state when its parent object has the state ::IA2_STATE_MANAGES_DESCENDANTS.

+ For example, a list item object may be managed by its parent list object and may only 

+ exist as long as the object is actually rendered.  Similarly a table cell's accessible 

+ object may exist only while the cell has focus.  However, from the perspective of an 

+ assistive technology a transient object behaves like a non-transient object.  As a 

+ result it is likely that this state is not of use to an assistive technology, but it 

+ is provided in case an assistive technology determines that knowledge of the transient 

+ nature of the object is useful and also for harmony with the Linux accessibility API.

+

+ Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.

+ */

+IA2_STATE_TRANSIENT =				0x10000,

+

+/** Indicates the orientation of this object is vertical. */

+IA2_STATE_VERTICAL =				0x20000,

+

+/** Indicates this object is checkable.

+

+ The standard checkable objects are check boxes, radio buttons, check box menu

+ items, radio menu items, and toggle buttons.  Since assistive technology will

+ determine that these objects are checkable via the object's role the checkable

+ state is not required.  However, this state is necessary in those cases where

+ an object has a role which is not one of the previously mentioned roles.  An

+ example is a table cell which indicates whether or not an email has an attachment,

+ whether or not an mail is considered spam, and whether or not an email has been read.

+ */

+IA2_STATE_CHECKABLE =				0x40000,

+

+/** Indicates this object is pinned.

+

+ This state indicates that an object is fixed at a certain location.  One example

+ is a browser tab that when pinned cannot be moved until unpinned.  Another example

+ is a movable or floating object that when pinned remains in its pinned location

+ until being unpinned.

+ */

+IA2_STATE_PINNED =					0x80000

+

+};

+/*************************************************************************

+ *

+ *  File Name (Accessible2.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+/** @mainpage

+

+ @section _interfaces Interfaces

+  IAccessible2\n

+  IAccessible2_2\n

+  IAccessibleAction\n

+  IAccessibleApplication\n

+  IAccessibleComponent\n

+  IAccessibleDocument\n

+  IAccessibleEditableText\n

+  IAccessibleHypertext\n

+  IAccessibleHypertext2\n

+  IAccessibleHyperlink\n

+  IAccessibleImage\n

+  IAccessibleRelation\n

+  IAccessibleTable [Deprecated]\n

+  IAccessibleTable2\n

+  IAccessibleTableCell\n

+  IAccessibleText\n

+  IAccessibleText2\n

+  IAccessibleValue

+

+ @section _structs Structs

+  IA2Locale\n

+  IA2TableModelChange\n

+  IA2TextSegment

+

+ @section _enums Enums

+  ::IA2Actions values are predefined actions for use when implementing support for HTML5 media.\n

+  ::IA2CoordinateType values define the requested coordinate type (screen or parent window).\n

+  ::IA2EventID values identify events.\n

+  ::IA2Role values defines roles which are in addition to the existing MSAA roles.\n

+  ::IA2ScrollType values define where to place an object or substring on the screen.\n

+  ::IA2States values define states which are in addition to the existing MSAA states.\n

+  ::IA2TableModelChangeType values describe the kinds of changes made to a table (insert, delete, update).\n

+  ::IA2TextBoundaryType values define the requested text unit (character, word, sentence, line, paragraph).\n

+  ::IA2TextSpecialOffsets values define special offsets for use in the text interfaces.

+

+ @section _constants Constants

+  @ref grpRelations

+

+ @section _misc Miscellaneous

+  @ref _licensePage "BSD License"\n

+  @ref _generalInfo "General Information"\n

+

+ @page _licensePage BSD License

+  %IAccessible2 IDL Specification

+

+  Copyright (c) 2007, 2013 Linux Foundation\n

+  Copyright (c) 2006 IBM Corporation\n

+  Copyright (c) 2000, 2006 Sun Microsystems, Inc.\n

+  All rights reserved.

+

+  Redistribution and use in source and binary forms, with or without 

+  modification, are permitted provided that the following conditions 

+  are met: 

+    

+   1. Redistributions of source code must retain the above copyright 

+      notice, this list of conditions and the following disclaimer. 

+ 

+   2. Redistributions in binary form must reproduce the above 

+      copyright notice, this list of conditions and the following 

+      disclaimer in the documentation and/or other materials 

+      provided with the distribution. 

+ 

+   3. Neither the name of the Linux Foundation nor the names of its 

+      contributors may be used to endorse or promote products 

+      derived from this software without specific prior written 

+      permission. 

+ 

+  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ 

+  This BSD License conforms to the Open Source Initiative "Simplified 

+  BSD License" as published at: 

+  http://www.opensource.org/licenses/bsd-license.php 

+ 

+  %IAccessible2 is a trademark of the Linux Foundation. The %IAccessible2 

+  mark may be used in accordance with the

+  <a href="http://www.linuxfoundation.org/collaborate/workgroups/accessibility/trademark-policy">

+  Linux Foundation Trademark Policy</a> to indicate compliance with the %IAccessible2 specification. 

+

+ @page _generalInfo General Information 

+  The following information is applicable to two or more interfaces.

+

+ @ref _errors\n

+ @ref _memory\n

+ &nbsp;&nbsp;@ref _arrayConsideration\n

+ @ref _indexes\n

+ @ref _enumBase\n

+ @ref _specialOffsets\n

+ @ref _dicoveringInterfaces\n

+ @ref _changingInterfaces\n

+ @ref _applicationInfo\n

+ @ref _childIDs\n

+ @ref _variants\n

+ @ref _iaaction-iahyperlink\n

+ @ref _trademark

+

+ @section _errors Error Handling

+  HRESULT values are defined by the Microsoft&reg; Win32&reg; API.  For more information, refer to

+  <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137%28v=vs.85%29.aspx">

+  Interpreting HRESULT Values</a> in MSDN&reg;.

+

+  Note that the S_FALSE return value is considered a non-error value and the 

+  SUCCEEDED macro will return TRUE.  S_FALSE is used when there is no failure

+  but there was nothing valid to return, e.g. in IAccessible2::attributes when

+  there are no attributes.  When S_FALSE is returned [out] pointer types should 

+  be NULL and [out] longs should generally be 0, but sometimes -1 is used such

+  as IAccessible2::indexInParent, IAccessibleText::caretOffset, and

+  IAccessibleHypertext::hyperlinkIndex.

+

+  Note that for BSTR [out] variables common COM practice is that the server does 

+  the SysAllocString and the client does the SysFreeString.  Also note that when

+  NULL is returned there is no need for the client to call SysFreeString.  Please

+  refer to the documentation for each method for more details regarding error handling.

+

+ @section _memory Memory Management

+  The following memory management issues should be considered:

+  @li Although [out] BSTR variables are declared by the client, their space is 

+   allocated by the server.  They need to be freed with SysFreeString by the 

+   client at end of life; the same is true when BSTRs are used in structs or 

+   arrays which are passed to the server.

+  @li If there is no valid [out] BSTR to return, the server should return S_FALSE and 

+   assign NULL to the output, e.g. *theOutBSTR = NULL;. 

+  @li COM interfaces need to be referenced with AddRef when used and dereferenced

+   with Release at end of life.

+  @li Single [out] longs, HWNDs, booleans, and structs are declared by the caller

+   and passed by reference. The marshaller does all the memory management.

+  

+  The following articles may be helpful for understanding memory management issues:

+  @li An article by Don Box in a

+   <a href="http://www.microsoft.com/msj/1196/activex1196.aspx">Q & A section</a>

+   of the November 1996 edition of the Microsoft Systems Journal.

+  @li A posting to a CodeGuru forum, 

+   <a href="http://www.codeguru.com/forum/showthread.php?t=364511">Windows SDK 

+   String: What are the rules for BSTR allocation and deallocation?</a>

+

+ @subsection _arrayConsideration Special Consideration when using Arrays

+  There are several methods which return arrays.  In the case of IAccessible2::relations

+  and IAccessibleRelation::targets the client must allocate and free the arrays.

+

+  For the remaining methods which return arrays, the server must allocate the array

+  and the client must free the array when no longer needed.  These methods are

+  IAccessible2::extendedStates, IAccessible2::localizedExtendedStates,

+  IAccessible2_2::relationTargetsOfType, IAccessibleAction::keyBinding, 

+  IAccessibleHypertext2::hyperlinks, IAccessibleTable::selectedChildren, 

+  IAccessibleTable::selectedColumns, IAccessibleTable::selectedRows,

+  IAccessibleTable2::selectedCells, IAccessibleTable2::selectedColumns,

+  IAccessibleTable2::selectedRows, IAccessibleTableCell::columnHeaderCells,

+  and IAccessibleTableCell::rowHeaderCells.

+  For those methods, the server must allocate both the top level array and any storage 

+  associated with it, e.g. for BSTRs.  The server must allocate the arrays with 

+  CoTaskMemAlloc and any BSTRs with SysAllocString.  The client must use CoTaskMemFree

+  to free the array and any BSTRs must be freed with SysFreeString.  

+  

+  Also, the IDL for IAccessible2::extendedStates, IAccessible2::localizedExtendedStates, 

+  IAccessibleAction::keyBinding, IAccessibleTable::selectedChildren, 

+  IAccessibleTable::selectedColumns, and IAccessibleTable::selectedRows includes an

+  extraneous [in] parameter for the caller to specify the max size of the array.

+  This parameter will be ignored by the COM server.

+

+ @section _indexes Zero and One Based Indexes

+  Unless otherwise specified all offsets and indexes are 0 based. 

+

+ @section _enumBase Enum Base

+  Note that enums start at 0.

+

+ @section _specialOffsets Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods

+  IAccessibleText and IAccessibleEditableText can use one or more of the following

+  special offset values.  They are defined in the ::IA2TextSpecialOffsets enum.

+  @li Using ::IA2_TEXT_OFFSET_LENGTH (-1) as an offset in any of the IAccessibleText or

+   IAccessibleEditableText methods is the same as specifying the length of the string.

+  @li Using ::IA2_TEXT_OFFSET_CARET (-2) as an offset for IAccessibleText::textBeforeOffset, 

+   IAccessibleText::textAtOffset, and IAccessibleText::textAfterOffset indicates that the 

+   text related to the physical location of the caret should be used.  This is needed for 

+   applications that consider the character offset of the end of one line (as reached by 

+   pressing the End key) the same as the offset of the first character on the next line.

+   Since the same offset is associated with two different lines a special means is needed 

+   to fetch text from the line where the caret is physically located.

+

+ @section _dicoveringInterfaces Discovery of Interfaces

+  In general AT (Assistive Technology) should try IAccessible2 interfaces, followed by using 

+  the MSAA (Microsoft&reg; Active Accessibility&reg;) interfaces.  (In cases where the an application

+  is known to have custom interfaces which provide information not supplied by IAccessible2

+  or MSAA, then those custom interfaces can be used.)  The AT can then, by default, support

+  unknown IAccessible2/MSAA applications, without the application developers having to request

+  AT vendors for support on an individual application by application basis.

+

+  When you have a reference to an IAccessible and require a reference to an IAccessible2 use 

+  QueryService as follows:

+  @code

+  // pAcc is a reference to the accessible object's IAccessible interface. 

+  IServiceProvider *pService = NULL; 

+  hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pService); 

+  if(SUCCEEDED(hr)) { 

+    IAccessible2 *pIA2 = NULL; 

+    hr = pService->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pIA2); 

+    if (SUCCEEDED(hr) && pIA2) { 

+      // The control supports IAccessible2. 

+      // pIA2 is the reference to the accessible object's IAccessible2 interface.

+    } 

+  } 

+  @endcode

+

+  @section _changingInterfaces Changing between Accessible Interfaces

+  Note that developers must always implement MSAA's IAccessible and, if needed, some

+  of the interfaces in the set of IAccessible2 interfaces.  Although the IAccessible2

+  IDL is coded such that IAccessible2 is a subclass of MSAA's IAccessible, none of

+  MSAA's IAccessible methods are redefined by IAccessible2.

+

+  QueryService must be used to switch from a reference to an MSAA IAccessible interface 

+  to another interface.  This has been 

+  <a href="http://www.atia.org/files/public/Introducing_IAccessibleEx.doc">

+  documented</a> and the pertinent facts have been extracted below: 

+

+  @par 

+   Why use QueryService instead of just using QueryInterface to get IAccessibleEx 

+   directly? The reason is that since MSAA 2.0, clients don't talk to a server's 

+   IAccessible interface directly; instead they talk to an intermediate MSAA-provided 

+   wrapper that calls through to the original IAccessible. This wrapper provides services 

+   such as implementing IDispatch, supplying information from MSAA 2.0's Dynamic Annotation 

+   service, and scaling locations when running on Windows Vista with DPI scaling enabled. 

+   QueryService is the supported way to expose additional interfaces from an existing 

+   IAccessible and was originally used by MSHTML to expose IHTMLElement objects corresponding 

+   to IAccessibles. QueryService is often more convenient for servers to implement than 

+   QueryInterface because it does not have the same requirements for preserving object 

+   identity or symmetry/transitivity as QueryInterface, so QueryService allows servers to 

+   easily implement the interface on the same object or a separate object. The latter is 

+   often hard to do with QueryInterface unless the original object supports aggregation. 

+

+  Two related references in MSDN&reg; are: 

+  @li <a href="http://msdn.microsoft.com/en-us/library/ms696078(VS.85).aspx">

+  "Using QueryService to expose a native object model interface for an IAccessible object"</a>

+  @li <a href="http://msdn.microsoft.com/en-us/library/ms528415.aspx#acc_obj"> 

+  "Accessing the Internet Explorer Object Associated with an Accessible Object"</a>

+

+  Based on this information from Microsoft, QueryService must be used to switch back and forth 

+  between a reference to an MSAA IAccessible interface and any of the IAccessible2 interfaces. 

+

+  Regarding switching between any of the IAccessible2 interfaces, applications implementing

+  IAccessible2 should implement the IAccessible2 interfaces on a single object since ATs

+  will be using QueryInterface to switch between the IAccessilbe2 interfaces.  Implementing

+  the IAccessible2 interfaces on separate objects would require the use of QueryService.

+  There is one exception, IAccessibleApplication can be implemented on a separate object so

+  its common code doesn't have to be included in each accessible object.  ATs should use

+  QueryService to access IAccessibleApplication.

+

+ @section _applicationInfo Access to Information about the Application

+  Servers implementing IAccessible2 should provide access to the IAccessibleApplication 

+  interface via QueryService from any object so that ATs can easily determine specific 

+  information about the application such as its name or version.

+

+ @section _childIDs Child IDs

+  The IAccessible2 interfaces do not support child IDs, i.e. simple child elements.

+  Full accessible objects must be created for each object that supports IAccessible2.

+  Therefore MSAA's get_accChild should never return a child ID (other than CHILDID_SELF)

+  for an object that implements any of the IAccessible2 interfaces.

+

+  Microsoft's UI Automation specification has the same limitation and this was resolved

+  in the UI Automation Express specification by adding IAccessibleEx::GetObjectForChild

+  and IAccessibleEx::GetIAccessiblePair.  These methods allow mapping back and forth 

+  between an IAccessibleEx and an {IAccessible, Child ID} pair.  A future version of 

+  IAccessible2 may include similar methods to map back and forth between an IAccessible2

+  and an {IAccessible, Child ID} pair.

+

+ @section _variants VARIANTs

+  Some methods return a VARIANT.  Implementers need to make sure that the return type is 

+  specified, i.e. VT_I4, VT_IDISPATCH, etc.  The methods that return VARIANTs are 

+  IAccessibleHyperlink::anchor, IAccessibleHyperlink::anchorTarget, IAccessibleValue::currentValue,

+  IAccessibleValue::maximumValue, IAccessibleValue::minimumValue.

+

+ @section _iaaction-iahyperlink IAccessibleHyperlink as subclass of IAccessibleAction

+  In this version of the IDL, IAccessibleHyperlink is a subclass of IAccessibleAction.  

+  However, there is no practical need for that inheritance and in some cases, such as

+  an image map of smart tags, it doesn't make sense because such an image map doesn't 

+  have actionable objects; it's the secondary smart tags that are actionable.  As a 

+  result, implementations should not rely on the inheritance as it may be removed in 

+  a later version of the IDL.

+

+ @section _trademark Trademark Attribution

+  The names of actual companies and products mentioned herein may be the trademarks of

+  their respective owners.  In particular, Active Accessibility, Microsoft, MSDN, and Win32

+  are trademarks of the Microsoft group of companies in the U.S.A. and/or other countries.

+

+**/

+

+
+
+
+
+
+
+

+/** A structure defining the locale of an accessible object.

+ 

+IAccessible2::locale returns this struct.

+*/

+typedef struct IA2Locale {

+  BSTR language; ///< ISO 639-1 Alpha-2 two character language code

+  BSTR country;  ///< ISO 3166-1 Alpha-2 two character country code

+  BSTR variant;  ///< Application specific variant of the locale

+} IA2Locale;

+

+/** @brief This interface exposes the primary set of information about an

+ IAccessible2 enabled accessible object.

+

+ This interface must always be provided for objects that support some

+ portion of the collection of the %IAccessible2 interfaces.

+

+ Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces"

+ for special considerations related to use of the MSAA IAccessible interface and 

+ the set of %IAccessible2 interfaces.

+ */

+[object, uuid(E89F726E-C4F4-4c19-BB19-B647D7FA8478)]

+interface IAccessible2 : IAccessible

+{

+

+  /** @brief Returns the number of accessible relations for this object.

+   @param [out] nRelations

+   @retval S_OK

+  */

+  [propget] HRESULT nRelations

+    (

+     [out, retval] long *nRelations

+    );

+

+  /** @brief Returns one accessible relation for this object.

+   @param [in] relationIndex

+     0 based

+   @param [out] relation

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT relation

+    (

+     [in] long relationIndex,

+     [out, retval] IAccessibleRelation **relation

+    );

+

+  /** @brief Returns multiple accessible relations for this object.

+   @param [in] maxRelations

+     maximum size of the array allocated by the client

+   @param [out] relations

+    The array of accessible relation objects.  Note that this array is to be

+	allocated by the client and freed when no longer needed.  Refer to @ref 

+	_arrayConsideration "Special Consideration when using Arrays" for more details.

+   @param [out] nRelations 

+    actual number of relations in the returned array (not more than maxRelations)

+   @retval S_OK

+   @retval S_FALSE if there are no relations, nRelations is set to 0

+   @note As a performant alternative, client code should consider using IAccessible2_2::relationTargetsOfType.

+  */

+  [propget] HRESULT relations

+    (

+     [in] long maxRelations, 

+     [out, size_is(maxRelations), length_is(*nRelations)]

+       IAccessibleRelation **relations, 

+     [out, retval] long *nRelations 

+    );

+

+  /** @brief Returns the role of an %IAccessible2 object.

+   @param [out] role

+    The role of an %IAccessible2 object.

+   @retval S_OK

+   @note 

+   @li For convenience MSAA roles are also passed through this method so the

+    AT doesn't have to also fetch roles through MSAA's get_accRole.

+   @li %IAccessible2 roles should not be passed through MSAA's get_accRole.

+   @li For compatibility with non IAccessible2 enabled ATs, IAccessible2 

+    applications should also add support to get_accRole to return the closest 

+	MSAA role or ROLE_SYSTEM_CLIENT (the MSAA defined default role) if there 

+	is not a good match.  

+   @li This method is missing a [propget] prefix in the IDL.  The result is the

+    method is named role in generated C++ code instead of get_role.

+  */

+  HRESULT role

+    (

+     [out, retval] long *role

+    );

+

+  /** @brief Makes an object visible on the screen.

+   @param [in] scrollType

+    Defines where the object should be placed on the screen.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT scrollTo

+    (

+     [in] enum IA2ScrollType scrollType 

+    );

+

+  /** @brief Moves the top left of an object to a specified location.

+

+   @param [in] coordinateType

+    Specifies whether the coordinates are relative to the screen or the parent object.

+   @param [in] x

+    Defines the x coordinate.

+   @param [in] y

+    Defines the y coordinate.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT scrollToPoint

+    (

+     [in] enum IA2CoordinateType coordinateType,

+	 [in] long x,

+	 [in] long y 

+    );

+

+  /** @brief Returns grouping information.

+   

+   Used for tree items, list items, tab panel labels, radio buttons, etc.

+   Also used for collections of non-text objects.

+

+   @param [out] groupLevel

+    1 based, 0 indicates that this value is not applicable

+   @param [out] similarItemsInGroup

+    1 based, 0 indicates that this value is not applicable

+   @param [out] positionInGroup

+    1 based, 0 indicates that this value is not applicable. This is an index

+    into the objects in the current group, not an index into all the objects

+    at the same group level.

+   @retval S_OK if at least one value is valid

+   @retval S_FALSE if no values are valid, [out] values are 0s

+   @note This method is meant to describe the nature of an object's containment

+    structure.  It's exposed by trees, tree grids, nested lists, nested menus,

+    but not headings, which uses the level object attribute.  It is also exposed

+    by radio buttons (with groupLevel == 0).

+   @note This is normally not implemented on a combo box to describe the nature

+    of its contents.  Normally an AT will get that information from its child list 

+    object.  However, in some cases when non-edit combo boxes are not able to be structured

+    such that the list is a child of the combo box, this method is implemented on

+    the combo box itself. ATs can use this interface if a child list is not found.

+	*/

+  [propget] HRESULT groupPosition

+    (

+     [out] long *groupLevel,

+     [out] long *similarItemsInGroup,

+     [out, retval] long *positionInGroup 

+    );

+

+  /** @brief Returns the bit strip containing any IAccessible2 states.

+  

+   The IAccessible2 states are in addition to the MSAA states and are defined in

+   the IA2States enum.

+

+   @param [out] states

+   @retval S_OK

+  */

+  [propget] HRESULT states

+    (

+	 [out, retval] AccessibleStates *states

+    );

+

+  /** @brief Returns the extended role.

+   

+   An extended role is a role which is dynamically generated by the application.

+   It is not predefined by the %IAccessible2 specification.

+   

+   @param [out] extendedRole

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT extendedRole

+    (

+	 [out, retval] BSTR *extendedRole

+    );

+

+  /** @brief Returns the localized extended role.

+   @param [out] localizedExtendedRole

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT localizedExtendedRole

+    (

+	 [out, retval] BSTR *localizedExtendedRole

+    );

+

+  /** @brief Returns the number of extended states.

+   @param [out] nExtendedStates

+   @retval S_OK

+  */

+  [propget] HRESULT nExtendedStates

+    (

+     [out, retval] long *nExtendedStates

+    );

+

+  /** @brief Returns the extended states (array of strings).

+

+   An extended state is a state which is dynamically generated by the application.

+   It is not predefined by the %IAccessible2 specification.

+

+   @param [in] maxExtendedStates

+    This parameter is ignored. Refer to @ref _arrayConsideration 

+	"Special Consideration when using Arrays" for more details.

+   @param [out] extendedStates

+    This array is allocated by the server.  The client must free it with CoTaskMemFree.

+   @param [out] nExtendedStates

+    The number of extended states returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively

+  */

+  [propget] HRESULT extendedStates

+    (

+     [in] long maxExtendedStates,

+     [out, size_is(,maxExtendedStates), length_is(,*nExtendedStates)] BSTR **extendedStates,

+     [out, retval] long *nExtendedStates

+    );

+

+  /** @brief Returns the localized extended states (array of strings).

+

+   @param [in] maxLocalizedExtendedStates

+    This parameter is ignored. Refer to @ref _arrayConsideration 

+	"Special Consideration when using Arrays" for more details.

+   @param [out] localizedExtendedStates

+    This array is allocated by the server.  The client must free it with CoTaskMemFree. 

+   @param [out] nLocalizedExtendedStates

+    The number of localized extended states returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are no states, [out] values are NULL and 0 respectively

+  */

+  [propget] HRESULT localizedExtendedStates

+    (

+     [in] long maxLocalizedExtendedStates,

+     [out, size_is(,maxLocalizedExtendedStates), length_is(,*nLocalizedExtendedStates)] BSTR **localizedExtendedStates,

+     [out, retval] long *nLocalizedExtendedStates

+    );

+

+  /** @brief Returns the unique ID.

+   

+   The uniqueID is an identifier for this object, is unique within the

+   current window, and remains the same for the lifetime of the accessible

+   object. 

+   

+   The uniqueID is not related to:

+   - the MSAA objectID which is used by the server to disambiguate between

+   IAccessibles per HWND or

+   - the MSAA childID which is used to disambiguate between children being

+   managed by an IAccessible.

+

+   This value is provided so the AT can have access to a unique runtime persistent 

+   identifier even when not handling an event for the object.

+   

+   An example of when this value is useful is if the AT wants to build a cache. 

+   The AT could cache the uniqueIDs in addition to other data being cached. 

+   When an event is fired the AT could map the uniqueID to its internal model.

+   Thus, if there's a REORDER/SHOW/HIDE event the AT knows which part of the 

+   internal structure has been invalidated and can refetch just that part.

+

+   This value can also be used by an AT to determine when the current control

+   has changed. If the role is the same for two controls that are adjacent in 

+   the tab order, this can be used to detect the new control.

+

+   Another use of this value by an AT is to identify when a grouping object has 

+   changed, e.g. when moving from a radio button in one group to a radio button in a 

+   different group.

+

+   One means of implementing this would be to create a factory with a 32 bit number 

+   generator and a reuse pool.  The number generator would emit numbers starting 

+   at 1.  Each time an object's life cycle ended, its number would be saved into a 

+   reuse pool.  The number generator would be used whenever the reuse pool was empty.

+

+   Another way to create a unique ID is to generate it from a pointer value, e.g. an

+   object's address. That would be unique because no two active objects can use the

+   same allocated memory space.

+

+   @param [out] uniqueID

+   @retval S_OK

+  */

+  [propget] HRESULT uniqueID

+    (

+     [out, retval] long *uniqueID

+    );

+

+  /** @brief Returns the window handle for the parent window which contains this object.

+

+   This is the same window handle which will be passed for any events that occur on the 

+   object, but is cached in the accessible object for use when it would be helpful to 

+   access the window handle in cases where an event isn't fired on this object.

+

+   A use case is when a screen reader is grabbing an entire web page on a page load. 

+   Without the availability of windowHandle, the AT would have to get the window handle

+   by using WindowFromAccessibleObject on each IAccessible, which is slow because it's 

+   implemented by oleacc.dll as a loop which crawls up the ancestor chain and looks for 

+   a ROLE_WINDOW object, mapping that back to a window handle.

+   

+   @param [out] windowHandle

+   @retval S_OK

+  */

+  [propget] HRESULT windowHandle

+    (

+     [out, retval] HWND *windowHandle

+    );

+ 

+  /** @brief Returns the index of this object in its parent object.

+   @param [out] indexInParent

+     0 based; -1 indicates there is no parent; the upper bound is the value 

+	 returned by the parent's IAccessible::get_accChildCount.

+   @retval S_OK

+   @retval S_FALSE if no parent, [out] value is -1

+  */

+  [propget] HRESULT indexInParent

+    (

+     [out, retval] long *indexInParent

+    );

+

+  /** @brief Returns the IA2Locale of the accessible object. 

+   @param [out] locale

+   @retval S_OK

+  */

+  [propget] HRESULT locale

+    (

+     [out, retval] IA2Locale *locale

+    );

+

+  /** @brief Returns the attributes specific to this object, such as a cell's formula.

+   @param [out] attributes

+   @retval S_OK

+   @retval S_FALSE returned if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT attributes

+    (

+     [out, retval] BSTR *attributes

+    );

+

+}

+

+/*************************************************************************

+ *

+ *  File Name (Accessible2_2.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** @brief This interface exposes the primary set of information about an

+ IAccessible2 enabled accessible object.

+

+ This interface must always be provided for objects that support some

+ portion of the collection of the %IAccessible2 interfaces.

+

+ Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces"

+ for special considerations related to use of the MSAA IAccessible interface and 

+ the set of %IAccessible2 interfaces.

+ */

+[object, uuid(6C9430E9-299D-4E6F-BD01-A82A1E88D3FF)]

+interface IAccessible2_2 : IAccessible2

+{

+  /** @brief Returns the attribute value of a specified attribute specific to this object.

+   @param [in] name

+   @param [out] attribute

+   @retval S_OK

+   @retval S_FALSE returned if there is nothing to return, [out] value is NULL.

+   @retval E_INVALIDARG if bad [in] passed.

+   @note The output value is a VARIANT.  Typically it will be a VT_BSTR, but there

+     are some cases where it will be a VT_I4 or VT_BOOL.  Refer to the <a href=

+     "http://www.linuxfoundation.org/collaborate/workgroups/accessibility/iaccessible2/objectattributesIAccessible2">

+     Object Attributes specification</a> for more information.

+  */

+  [propget] HRESULT attribute

+    (

+     [in] BSTR name,

+     [out, retval] VARIANT *attribute

+    );

+

+  /** @brief Returns the deepest hypertext accessible in the subtree of this object, and the caret offset within it.

+   @param [out] accessible

+   @param [out] caretOffset

+   @retval S_OK

+   @retval S_FALSE returned if there is no caret in any of the objects in the subtree, [out] accessible is NULL and [out] caretOffset is -1.

+  */

+  [propget] HRESULT accessibleWithCaret

+    (

+     [out] IUnknown **accessible,

+     [out, retval] long *caretOffset

+    );

+

+  /** @brief Returns relation targets for a specified target type.

+   @param [in] type

+    The requested @ref grpRelations "relation type".

+   @param [in] maxTargets

+    The number of targets requested.  0 indicates that all targets should be returned.

+   @param [out] targets

+    This array is allocated by the server.  The client must free it with CoTaskMemFree.

+   @param [out] nTargets

+    The number of targets returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are no targets, [out] values are NULL and 0 respectively.

+   @retval E_INVALIDARG if bad [in] passed.

+  */

+  [propget] HRESULT relationTargetsOfType

+    (

+     [in] BSTR type,

+     [in] long maxTargets,

+     [out, size_is(,*nTargets)] IUnknown ***targets,

+     [out, retval] long *nTargets

+    );

+

+}

+

+/*************************************************************************

+ *

+ *  File Name (AccessibleComponent.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+

+/** A value specifying a color in ARGB format, where each 8 bit color component

+specifies alpha, red, green, and blue respectively.  The alpha value is optional.

+*/

+typedef long IA2Color;

+

+/** @brief This interface is implemented by any object that can be rendered 

+ on the screen.

+

+ This interface provides the standard mechanism for an assistive technology

+  to retrieve information concerning the graphical representation of an object. 

+  Coordinates used by the functions of this interface are specified in

+  different coordinate systems.  Their scale is the same and is equal to

+  that of the screen coordinate system.  In other words all coordinates

+  are measured in pixels.  They differ in their respective origin:

+  <ul>

+   <li>The screen coordinate system has its origin in the upper left

+    corner of the current screen.</li>

+   <li>The origin of the parent coordinate system is the upper left corner

+    of the parent's bounding box.  With no parent the screen coordinate

+    system is used instead.</li>

+  </ul>

+*/

+[object, uuid(1546D4B0-4C98-4bda-89AE-9A64748BDDE4)]

+interface IAccessibleComponent : IUnknown

+{

+

+  /** @brief Returns the location of the upper left corner of the object's

+    bounding box relative to the immediate parent object.

+	

+	The coordinates of the bounding box are given relative to the parent's 

+	coordinate system. The coordinates of the returned position are relative 

+	to this object's parent or relative to the screen on which this object

+    is rendered if it has no parent. If the object is not on any screen

+    the returned position is (0,0).

+   

+   @param [out] x

+   @param [out] y

+   @retval S_OK

+  */

+  [propget] HRESULT locationInParent

+    (

+	 [out] long *x,

+     [out, retval] long *y

+    );

+

+  /** @brief Returns the foreground color of this object.

+   @param [out] foreground

+    The returned color is the foreground color of this object or, if

+    that is not supported, the default foreground color.

+   @retval S_OK

+  */ 

+  [propget] HRESULT foreground

+    (

+     [out, retval] IA2Color *foreground

+    );

+

+   /** @brief Returns the background color of this object.

+    @param [out] background

+     The returned color is the background color of this object or, if

+     that is not supported, the default background color.

+    @retval S_OK

+   */ 

+  [propget] HRESULT background

+    (

+     [out, retval] IA2Color *background

+    );

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleValue.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+

+/** @brief This interface gives access to a single numerical value.

+

+ The %IAccessibleValue interface represents a single numerical value and should 

+  be implemented by any class that supports numerical value like progress bars 

+  and spin boxes.  This interface lets you access the value and its upper and 

+  lower bounds.

+*/

+[object, uuid(35855B5B-C566-4fd0-A7B1-E65465600394)]

+interface IAccessibleValue : IUnknown

+{

+

+  /** @brief Returns the value of this object as a number.

+        

+   The exact return type is implementation dependent.  Typical types are long and 

+    double.

+   @param [out] currentValue

+    Returns the current value represented by this object.  See the section about 

+	@ref _variants "VARIANTs" for additional information.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY

+  */

+  [propget] HRESULT currentValue

+    (

+     [out, retval] VARIANT *currentValue

+    );

+

+  /** @brief Sets the value of this object to the given number.

+        

+   The argument is clipped to the valid interval whose upper and lower 

+    bounds are returned by the methods IAccessibleValue::maximumValue and 

+	IAccessibleValue::minimumValue, i.e. if it is 	lower than the minimum 

+	value the new value will be the minimum and if it is greater than the 

+	maximum then the new value will be the maximum.

+

+   @param [in] value

+    The new value represented by this object.  The set of admissible types for 

+    this argument is implementation dependent.

+   @retval S_OK

+  */

+  HRESULT setCurrentValue

+    (

+     [in] VARIANT value

+    );

+

+  /** @brief Returns the maximal value that can be represented by this object.

+        

+   The type of the returned value is implementation dependent.  It does not have 

+    to be the same type as that returned by method IAccessibleValue::currentValue.

+

+   @param [out] maximumValue

+    Returns the maximal value in an implementation dependent type. If this object 

+    has no upper bound then an empty object is returned.  See the section about 

+	@ref _variants "VARIANTs" for additional information.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY

+  */

+  [propget] HRESULT maximumValue

+    (

+     [out, retval] VARIANT *maximumValue

+    );

+

+  /** @brief Returns the minimal value that can be represented by this object.

+        

+   The type of the returned value is implementation dependent.  It does not have 

+    to be the same type as that returned by method IAccessibleValue::currentValue.

+   

+   @param [out] minimumValue

+    Returns the minimal value in an implementation dependent type. If this object 

+    has no lower bound then an empty object is returned.  See the section about 

+	@ref _variants "VARIANTs" for additional information.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is a VARIANT with vt = VT_EMPTY

+  */

+  [propget] HRESULT minimumValue

+    (

+     [out, retval] VARIANT *minimumValue

+    );

+

+};

+/*************************************************************************

+ *

+ *  File Name (AccessibleText.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** A structure containing a substring and the start and end offsets in the enclosing string.

+ 

+ IAccessibleText::newText and IAccessibleText::oldText return this struct.

+*/

+typedef struct IA2TextSegment {

+  BSTR text;	///< A copy of a segment of text taken from an enclosing paragraph.

+  long start;	///< Index of the first character of the segment in the enclosing text.  

+  long end;		///< Index of the character following the last character of the segment in the enclosing text. 

+} IA2TextSegment;

+

+/** This enum defines values which specify a text boundary type.

+

+ IA2_TEXT_BOUNDARY_SENTENCE is optional.  When a method doesn't implement this 

+ method it must return S_FALSE.  Typically this feature would not be implemented

+ by an application.  However, if the application developer was not satisfied with

+ how screen readers have handled the reading of sentences this boundary type

+ could be implemented and screen readers could use the application's version of a 

+ sentence rather than the screen reader's.

+

+ The rest of the boundary types must be supported.

+

+ This enum is used in IAccessibleText::textBeforeOffset, IAccessibleText::textAtOffset,

+ and IAccessibleText::textAfterOffset.

+*/

+

+enum IA2TextBoundaryType {

+  IA2_TEXT_BOUNDARY_CHAR,       /**< Typically, a single character is returned.  In some cases more than

+                                 one character is returned, for example, when a document contains field

+                                 data such as a field containing a date, time, or footnote reference.

+                                 In this case the caret can move over several characters in one movement

+                                 of the caret.  Note that after the caret moves, the caret offset changes

+                                 by the number of characters in the field, e.g. by 8 characters in the 

+                                 following date: 03/26/07. */

+  IA2_TEXT_BOUNDARY_WORD,       /**< The range provided matches the range observed when the application

+                                 processes the Ctrl + left arrow and Ctrl + right arrow key sequences.

+                                 Typically this is from the start of one word to the start of the next, but

+                                 various applications are inconsistent in the handling of the end of a line. */

+  IA2_TEXT_BOUNDARY_SENTENCE,   ///< Range is from start of one sentence to the start of another sentence.

+  IA2_TEXT_BOUNDARY_PARAGRAPH,  ///< Range is from start of one paragraph to the start of another paragraph.

+  IA2_TEXT_BOUNDARY_LINE,       /**< Range is from start of one line to the start of another line. This

+                                 often means that an end-of-line character will appear at the end of the

+                                 range. However in the case of some applications an end-of-line character

+                                 indicates the end of a paragraph and the lines composing the paragraph,

+                                 other than the last line, do not contain an end of line character. */

+  IA2_TEXT_BOUNDARY_ALL         ///< Using this value will cause all text to be returned.

+};

+

+/** @brief This interface gives read-only access to text.

+

+ The %IAccessibleText interface should be implemented by all components 

+  that present textual information on the display like  buttons, 

+  text entry fields, or text portions of the document window.  The interface 

+  provides access to the text's content, attributes, and spatial location.  

+  However, text can not be modified with this interface.  That is the task 

+  of the IAccessibleEditableText interface.

+        

+ The text length, i.e. the number of characters in the text, is

+  returned by IAccessibleText::nCharacters. All methods that operate 

+  on particular characters (e.g. IAccessibleText::textAtOffset) use character 

+  indices from 0 to length-1. All methods that operate on character positions 

+  (e.g. IAccessibleText::text) use indices from 0 to length.

+

+ Please note that accessible text does not necessarily support selection.  

+  In this case it should behave as if there where no selection.  An empty 

+  selection is used for example to express the current cursor position.

+

+ Refer to @ref _specialOffsets 

+  "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+  for information about special offsets that can be used in %IAccessibleText methods.

+

+ E_FAIL is returned in the following cases

+ @li endOffset < startOffset

+ @li endoffset > length

+*/

+[object, uuid(24FD2FFB-3AAD-4a08-8335-A3AD89C0FB4B)]

+interface IAccessibleText : IUnknown

+{

+

+  /** @brief Adds a text selection

+   @param [in] startOffset

+    Starting offset ( 0 based).

+   @param [in] endOffset

+    Offset of first character after new selection (0 based).

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note  Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+  */

+  HRESULT addSelection

+    (

+     [in] long startOffset,

+     [in] long endOffset

+    );

+

+  /** @brief Returns text attributes.

+   @param [in] offset

+    Text offset (0 based).  Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @param [out] startOffset    

+    The starting offset of the character range over which all text attributes match 

+    those of offset. (0 based)

+   @param [out] endOffset    

+    The offset of the first character past the character range over which all text 

+    attributes match those of offset. (0 based)

+   @param [out] textAttributes  

+    A string of attributes describing the text.  The attributes are described in the

+    <a href="http://www.linuxfoundation.org/en/Accessibility/IAccessible2/TextAttributes">

+    text attributes specification</a> on the %IAccessible2 web site.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] values are 0s and NULL respectively 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT attributes

+    (

+     [in] long offset,	

+     [out] long *startOffset,

+     [out] long *endOffset,	

+     [out, retval] BSTR *textAttributes

+    );

+

+  /** @brief Returns the position of the caret.

+

+   Returns the 0-based offset of the caret within the text.  If the text is 

+   implemented as a tree of text objects with embed characters in higher levels

+   representing substrings of child text objects and the caret is in one of the 

+   child text objects, then the offset in the higher level text object would be

+   at the embed character representing child text object that contains the caret.

+

+   For example, if the string "one two three" is implemented as a two text objects,

+   with a top level text object containing an embed character "one ? three" and a

+   child text object containing "two" and if the caret is in the descendant object

+   just before the 'o' in "two", then:

+   <ul>

+   <li>the caretOffset for the "one ? three" object would be 4, matching the embed character</li>

+   <li>the caretOffset for "two" would be 2, matching the "o"</li>

+   </ul>

+   The caret position/offset is that of the character logically following it, e.g.

+   to the right of it in a left to right language, or to the left of it in a right

+   to left language.

+   @param [out] offset

+    The returned offset is relative to the text represented by this object.

+   @retval S_OK

+   @retval S_FALSE if the caret is not currently active on this object, i.e. the

+    caret is located on some other object.  The returned offset value will be -1.

+   @note S_FALSE (and an offset of -1) will not be returned if the caret is somewhere

+   in the text object or one of its descendants. 

+  */

+  [propget] HRESULT caretOffset

+    (

+     [out, retval] long *offset

+    );

+

+

+  /** @brief Returns the bounding box of the specified position.

+        

+   The virtual character after the last character of the represented

+    text, i.e. the one at position length is a special case. It represents the 

+    current input position and will therefore typically be queried by AT more 

+    often than other positions.  Because it does not represent an existing character 

+    its bounding box is defined in relation to preceding characters.  It should be 

+    roughly equivalent to the bounding box of some character when inserted at the 

+    end of the text.  Its height typically being the maximal height of all the

+    characters in the text or the height of the preceding character, its width being 

+    at least one pixel so that the bounding box is not degenerate.

+

+   Note that the index 'length' is not always valid.  Whether it is or not is 

+    implementation dependent.  It typically is when text is editable or otherwise 

+    when on the screen the caret can be placed behind the text.  You can be sure 

+    that the index is valid after you have received a ::IA2_EVENT_TEXT_CARET_MOVED

+    event for this index.

+   @param [in] offset

+    Index of the character for which to return its bounding box. The valid range 

+    is 0..length.  Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @param [in] coordType

+    Specifies if the coordinates are relative to the screen or to the parent window.

+   @param [out] x

+    X coordinate of the top left corner of the bounding box of the referenced character. 

+   @param [out] y

+    Y coordinate of the top left corner of the bounding box of the referenced character. 

+   @param [out] width

+    Width of the bounding box of the referenced character. 

+   @param [out] height

+    Height of the bounding box of the referenced character. 

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT characterExtents

+    (

+     [in] long offset,

+     [in] enum IA2CoordinateType coordType,

+     [out] long *x,

+     [out] long *y,

+     [out] long *width,

+     [out, retval] long *height

+    );

+

+

+  /** @brief Returns the number of active non-contiguous selections

+   @param [out] nSelections

+   @retval S_OK

+  */

+  [propget] HRESULT nSelections

+    (

+     [out, retval] long *nSelections

+    );

+

+  /** @brief Returns the text position for the specified screen position.

+    

+   Given a point return the zero-based index of the character under that

+   point.  The same functionality could be achieved by using the bounding

+   boxes for each character as returned by IAccessibleText::characterExtents.

+   The method IAccessibleText::offsetAtPoint, however, can be implemented 

+   more efficiently.

+            

+   @param [in] x

+    The position's x value for which to look up the index of the character that

+    is rendered on to the display at that point.

+   @param [in] y

+    The position's y value for which to look up the index of the character that

+    is rendered on to the display at that point.            

+   @param [in] coordType

+    Screen coordinates or window coordinates.

+   @param [out] offset

+    Index of the character under the given point or -1 if the point

+    is invalid or there is no character under the point.

+   @retval S_OK

+   @retval S_FALSE if nothing to return, [out] value is -1

+

+   @retval E_INVALIDARG if bad [in] passed

+    */

+  [propget] HRESULT offsetAtPoint

+    (

+     [in] long x,

+     [in] long y,

+     [in] enum IA2CoordinateType coordType,

+     [out, retval] long *offset

+    );

+

+  /** @brief Returns the character offsets of Nth active text selection

+

+   Returns the 0-based starting and ending offsets of the Nth selection.  If the

+   text is implemented as a tree of text objects with embed characters in higher

+   levels representing substrings of child text objects, consider the following.

+   If the starting selection offset is in one of the child text objects, then the

+   starting offset in the higher level text object would be at the embed character

+   representing the child text object that contains the starting selection offset.

+   If the ending selection offset is in one of the child text objects, then the

+   ending offset in the higher level text object would be just after the embed

+   character representing the child text object that contains the ending selection

+   offset.

+

+   For example, if the string "one two three" is implemented as a two text objects,

+   with a top level text object containing an embed character "one ? three" and a

+   child text object containing "two" and if the selection is the string "two" then:

+   <ul>

+   <li>the startOffset for the "one ? three" object would be 4, matching the embed character and the endOffset would be 5.</li>

+   <li>the startOffset for the "two" object would be 0, and the endOffset would be 3</li>

+   </ul>

+   Selection offsets are that of the character logically following it, e.g.

+   to the right of it in a left to right language or to the left of it in a right to left language.

+   @param [in] selectionIndex

+    Index of selection (0 based).

+   @param [out] startOffset

+    0 based offset of first selected character

+   @param [out] endOffset

+    0 based offset of one past the last selected character.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT selection

+    (

+     [in] long selectionIndex,

+     [out] long *startOffset,

+     [out, retval] long *endOffset

+    );

+

+  /** @brief Returns the substring between the two given indices.

+

+   The substring starts with the character at startOffset (inclusive) and up to 

+    the character at endOffset (exclusive), if startOffset is less or equal 

+    endOffset.  If endOffset is lower than startOffset, the result is the same 

+    as a call with the two arguments being exchanged.

+

+   The whole text can be requested by passing the indices zero and 

+    IAccessibleText::nCharacters. If both indices have the same value, an empty 

+    string is returned.

+   @param [in] startOffset

+    Index of the first character to include in the returned string. The valid range 

+    is 0..length.

+   @param [in] endOffset

+    Index of the last character to exclude in the returned string. The valid range 

+    is 0..length.

+   @param [out] text

+    Returns the substring starting with the character at startOffset (inclusive) 

+    and up to the character at endOffset (exclusive), if startOffset is less than 

+    or equal to endOffset.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note

+   @li The returned string may be longer than endOffset-startOffset bytes if text 

+    contains multi-byte characters.

+   @li Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+  */

+  [propget] HRESULT text

+    (

+     [in] long startOffset,

+     [in] long endOffset,

+     [out, retval] BSTR *text

+    );

+

+  /** @brief Returns a text portion before the given position.

+    

+   Returns the substring of the specified text type that is located before the 

+    given character and does not include it. The result of this method should be 

+    same as a result for IAccessibleText::textAtOffset with a suitably decreased 

+    index value.

+

+   For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete 

+    word that is closest to and located before offset is returned.

+

+   If the index is valid, but no text is found, S_FALSE is returned along with out

+    values of 0, 0, and a NULL pointer.  This would happen for boundary types other

+    than character when the text consists entirely of whitespace.

+

+   @param [in] offset

+    Index of the character for which to return the text part before it.  The index 

+    character will not be part of the returned string. The valid range is 0..length.

+    Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @param [in] boundaryType

+    The type of the text portion to return.  See ::IA2TextBoundaryType for the 

+    complete list.

+   @param [out] startOffset

+    0 based offset of first character.

+   @param [out] endOffset

+    0 based offset of one past the last character.

+   @param [out] text

+    Returns the requested text portion.  This portion may be empty or invalid when 

+    no appropriate text portion is found or text type is invalid.

+   @retval S_OK

+   @retval S_FALSE if the requested boundary type is not implemented, such as 

+    ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return; 

+    [out] values are 0s and NULL respectively 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT textBeforeOffset

+    (

+     [in] long offset,

+     [in] enum IA2TextBoundaryType boundaryType,

+     [out] long *startOffset,

+     [out] long *endOffset,

+     [out, retval] BSTR *text

+    );

+

+  /** @brief Returns a text portion after the given position.

+    

+   Returns the substring of the specified text type that is located after the 

+    given character and does not include it. The result of this method should be 

+    same as a result for IAccessibleText::textAtOffset with a suitably increased 

+    index value.

+

+   For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete 

+    word that is closest to and located after offset is returned.

+

+   If the index is valid, but no text is found, S_FALSE is returned along with out

+    values of 0, 0, and a NULL pointer.  This would happen for boundary types other

+    than character when the text consists entirely of whitespace.

+

+   @param [in] offset

+    Index of the character for which to return the text part after it.  The index 

+    character will not be part of the returned string. The valid range is 0..length.

+    Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @param [in] boundaryType

+    The type of the text portion to return.  See ::IA2TextBoundaryType for the complete 

+    list.

+   @param [out] startOffset

+    0 based offset of first character.

+   @param [out] endOffset

+    0 based offset of one past the last character.

+   @param [out] text

+    Returns the requested text portion.  This portion may be empty or invalid when 

+    no appropriate text portion is found or text type is invalid.

+   @retval S_OK

+   @retval S_FALSE if the requested boundary type is not implemented, such as 

+    ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return; 

+    [out] values are 0s and NULL respectively 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT textAfterOffset

+    (

+     [in] long offset,

+     [in] enum IA2TextBoundaryType boundaryType,

+     [out] long *startOffset,

+     [out] long *endOffset,

+     [out, retval] BSTR *text

+    );

+

+  /** @brief Returns a text portion that spans the given position.

+

+   Returns the substring defined by the specified boundary type at the specified

+    offset.  Refer to IA2TextBoundaryType for more details.

+

+   For the word boundary type the returned string will contain the word at the

+    offset if the offset is inside a word and will contain the word before the

+    offset if the offset is not inside a word.  All offsets from the first to the

+    last characters of a word are considered inside the word.  Boundary types of

+    sentence and paragraph should exhibit similar behavior.

+

+   If the index is valid, but no text is found, S_FALSE is returned along with out

+    values of 0, 0, and a NULL pointer.  This would happen for boundary types other

+    than character when the text consists entirely of whitespace.

+

+   @param [in] offset

+    Index of the character for which to return the text part it belongs to.  The valid

+    range is 0..length.

+    Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @param [in] boundaryType

+    The type of the text portion to return.  See ::IA2TextBoundaryType for the complete 

+    list.

+   @param [out] startOffset

+    0 based offset of first character.

+   @param [out] endOffset

+    0 based offset of one past the last character.

+   @param [out] text

+    Returns the requested text portion.  This portion may be empty or invalid when 

+    no appropriate text portion is found or text type is invalid.

+   @retval S_OK

+   @retval S_FALSE if the requested boundary type is not implemented, such as 

+    ::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return; 

+    [out] values are 0s and NULL respectively 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT textAtOffset

+    (

+     [in] long offset,

+     [in] enum IA2TextBoundaryType boundaryType,

+     [out] long *startOffset,

+     [out] long *endOffset,

+     [out, retval] BSTR *text

+    );

+

+  /** @brief Unselects a range of text.

+   @param [in] selectionIndex

+    Index of selection to remove (0 based).

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT removeSelection

+    (

+     [in] long selectionIndex

+    );

+

+  /** @brief Sets the position of the caret.

+

+   The caret position/offset is that of the character logically following it,

+   e.g. to the right of it in a left to right language.

+

+   Setting the caret position may or may not alter the current selection.  A 

+    change of the selection is notified to the accessibility event listeners with 

+    an ::IA2_EVENT_TEXT_SELECTION_CHANGED event.

+

+   When the new caret position differs from the old one (which, of course, is the 

+    standard case) this is notified to the accessibility event listeners with an

+    ::IA2_EVENT_TEXT_CARET_MOVED event.

+   @param [in] offset

+    The new index of the caret.  This caret is actually placed to the left side of 

+    the character with that index.  An index of 0 places the caret so that the next 

+    insertion goes before the first character.  An index of IAccessibleText::nCharacters 

+    leads to insertion after the last character.  Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+   @retval S_OK

+   @retval E_FAIL if the caret cannot be set

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT setCaretOffset

+    (

+     [in] long offset

+    );

+

+  /** @brief Changes the bounds of an existing selection.

+   @param [in] selectionIndex

+    Index of selection to change (0 based)

+   @param [in] startOffset

+    New starting offset (0 based)

+   @param [in] endOffset

+    New ending offset (0 based) - the offset of the character just past the last character of the selection.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+  */

+  HRESULT setSelection

+    (

+     [in] long selectionIndex,

+     [in] long startOffset,

+     [in] long endOffset

+    );

+

+  /** @brief Returns total number of characters.

+

+   Note that this may be different than the total number of bytes required to store the 

+    text, if the text contains multi-byte characters.

+   @param [out] nCharacters

+   @retval S_OK

+  */

+  [propget] HRESULT nCharacters

+    (

+     [out, retval] long *nCharacters

+    );

+

+  /** @brief Makes a specific part of string visible on screen.

+   @param [in] startIndex

+    0 based character offset.

+   @param [in] endIndex

+    0 based character offset - the offset of the character just past the last character of the string.

+   @param [in] scrollType

+    Defines where the object should be placed on the screen.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+  */

+  HRESULT scrollSubstringTo

+    (

+     [in] long startIndex,

+     [in] long endIndex,

+     [in] enum IA2ScrollType scrollType

+    );

+

+  /** @brief Moves the top left of a substring to a specified location.

+

+   @param [in] startIndex

+    0 based character offset.

+   @param [in] endIndex

+    0 based character offset - the offset of the character just past the last character of the string.

+   @param [in] coordinateType

+    Specifies whether the coordinates are relative to the screen or the parent object.

+   @param [in] x

+    Defines the x coordinate.

+   @param [in] y

+    Defines the y coordinate.

+   @retval S_OK

+   @retval S_FALSE if the object is already at the specified location.

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleText methods.

+  */

+  HRESULT scrollSubstringToPoint

+    (

+     [in] long startIndex,

+     [in] long endIndex,

+     [in] enum IA2CoordinateType coordinateType,

+     [in] long x,

+     [in] long y 

+    );

+

+  /** @brief Returns any inserted text.

+

+   Provided for use by the ::IA2_EVENT_TEXT_INSERTED and ::IA2_EVENT_TEXT_UPDATED 

+    event handlers.

+

+   This data is only guaranteed to be valid while the thread notifying the event 

+   continues. Once the handler has returned, the validity of the data depends on 

+   how the server manages the life cycle of its objects. Also, note that the server 

+   may have different life cycle management strategies for controls depending on 

+   whether or not a control manages its children. Lists, trees, and tables can have 

+   a large number of children and thus it's possible that the child objects for those 

+   controls would only be created as needed. Servers should document their life cycle 

+   strategy as this will be of interest to assistive technology or script engines 

+   accessing data out of process or from other threads. Servers only need to save the 

+   last inserted block of text and a scope of the entire application is adequate.

+

+   @param [out] newText

+    The text that was just inserted.

+   @retval S_OK

+   @retval S_FALSE If there is nothing to return, the values of IA2TextSegment

+    struct are set as follows:  text = NULL, start = 0, end = 0.

+

+  */

+  [propget] HRESULT newText

+    (

+     [out, retval] IA2TextSegment *newText

+    );

+

+  /** @brief Returns any removed text.

+

+   Provided for use by the IA2_EVENT_TEXT_REMOVED/UPDATED event handlers.

+   

+   This data is only guaranteed to be valid while the thread notifying the event 

+   continues. Once the handler has returned, the validity of the data depends on 

+   how the server manages the life cycle of its objects. Also, note that the server 

+   may have different life cycle management strategies for controls depending on 

+   whether or not a control manages its children. Lists, trees, and tables can have 

+   a large number of children and thus it's possible that the child objects for those 

+   controls would only be created as needed. Servers should document their life cycle 

+   strategy as this will be of interest to assistive technology or script engines 

+   accessing data out of process or from other threads. Servers only need to save the 

+   last removed block of text and a scope of the entire application is adequate.

+

+   @param [out] oldText

+    The text that was just removed.

+   @retval S_OK

+   @retval S_FALSE If there is nothing to return, the values of IA2TextSegment

+    struct are set as follows:  text = NULL, start = 0, end = 0.

+  */

+  [propget] HRESULT oldText

+    (

+     [out, retval] IA2TextSegment *oldText

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleText2.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+
+

+/** @brief This interface gives read-only access to text.

+

+ The %IAccessibleText2 interface extends the functionality of the

+ %IAccessibleText interface.

+*/

+[object, uuid(9690A9CC-5C80-4DF5-852E-2D5AE4189A54)]

+interface IAccessibleText2 : IAccessibleText

+{

+

+  /** @brief Returns the range and of the specified set of attributes.

+

+   Return the range (start and end offsets) and text attributes that correspond

+    to the given attributes filter at the given offset.

+

+   @param [in] offset

+    The offset at which to search for the attributes specified in the filter.

+   @param [in] filter

+    The requested attribute names.  The filter format is "attribute1, attribute2".

+   @param [out] startOffset

+    The starting (0-based) offset of the text containing the specified attributes.

+   @param [out] endOffset

+    The (0-based) offset one past the last character of the text containing the

+    specified attributes.

+   @param [out] attributeValues

+    The values of the requested attributes.

+   @retval S_OK

+   @retval S_FALSE if nothing to return, [out] values are -1, -1, NULL respectively.

+   @retval E_INVALIDARG if bad [in] passed.

+   */

+  [propget] HRESULT attributeRange

+    (

+     [in] long offset,

+     [in] BSTR filter,

+     [out] long *startOffset,

+     [out] long *endOffset,	

+     [out, retval] BSTR *attributeValues

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleEditableText.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2012 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** @brief This interface provides clipboard capability to text objects.

+

+ This interface is typically used in conjunction with the IAccessibleText 

+  interface and complements that interface with the additional capability of

+  clipboard operations.  Note that even a read only text object can support

+  the copy capability so this interface is not limited to editable objects.

+

+ The substrings used with this interface are specified as follows:

+  If startOffset is less than endOffset, the substring starts with the 

+  character at startOffset and ends with the character just before endOffset.

+  If endOffset is lower than startOffset,  the result is the same as a call 

+  with the two arguments exchanged. The whole text can be defined by passing 

+  the indices zero and IAccessibleText::nCharacters. If both indices have the 

+  same value, an empty string is defined. 

+

+ Refer to the @ref _specialOffsets

+  "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+  for information about a special offset constant that can be used in %IAccessibleEditableText methods.

+*/

+[object, uuid(A59AA09A-7011-4b65-939D-32B1FB5547E3)]

+interface IAccessibleEditableText : IUnknown

+{

+

+  /** @brief Copies the text range into the clipboard.

+    

+   The selection is set to the specified offsets and then selection is copied into

+   the system clipboard.

+        

+   @param [in] startOffset

+    Start index of the text to moved into the clipboard.

+    The valid range is 0..length.

+   @param [in] endOffset

+    End index of the text to moved into the clipboard.

+    The valid range is 0..length.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+   @deprecated This function is available via the application's GUI.

+  */

+  HRESULT copyText

+    (

+     [in] long startOffset, 

+     [in] long endOffset 

+    );

+

+  /** @brief Deletes a range of text.

+    

+   The text between and including the two given indices is deleted

+    from the text represented by this object.

+

+   @param [in] startOffset

+    Start index of the text to be deleted.

+    The valid range is 0..length.

+   @param [in] endOffset

+    End index of the text to be deleted.

+    The valid range is 0..length.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+  */

+  HRESULT deleteText

+    (

+     [in] long startOffset, 

+     [in] long endOffset 

+    );

+  

+  /** @brief Inserts text at the specified position.

+    

+   The specified string is inserted at the given index into the text

+    represented by this object.

+

+   @param [in] offset

+    Index at which to insert the text.

+    The valid range is 0..length.

+	Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+   @param [in] text

+    Text that is inserted.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT insertText

+    (

+     [in] long offset,

+     [in] BSTR *text

+    );

+  

+  /** @brief Deletes a range of text and copies it to the clipboard.

+    

+   The selection is set to the specified offsets, the selection is then copied into

+    the system clipboard, and then the selection is deleted.

+

+   @param [in] startOffset

+    Start index of the text to be deleted.

+    The valid range is 0..length.

+   @param [in] endOffset 	

+    End index of the text to be deleted.

+    The valid range is 0..length.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+   @deprecated This function is available via the application's GUI.

+  */

+  HRESULT cutText

+    (

+     [in] long startOffset,

+     [in] long endOffset

+    );

+

+  /** @brief Pastes content from the clipboard.

+    

+   Any existing selection is removed, the clipboard content is then pasted into 

+    this object's text at the given offset.  This method is similar to the insertText

+    method.  If the index is not valid the system clipboard content is not inserted. The

+    behavior is the same as	when Ctrl+V is used, i.e. the pasted contents are not

+    necessarily plain text.

+  

+   @param [in] offset

+    Index at which to insert the content from the system clipboard into

+    the text represented by this object.

+    The valid range is 0..length.

+	Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @deprecated This function is available via the application's GUI.

+  */

+  HRESULT pasteText

+    (

+     [in] long offset

+    );

+

+  /** @brief Replaces text.

+    

+   The text between the two given indices is replaced by the specified 

+    replacement string. This method is equivalent to calling first

+    IAccessibleEditableText::deleteText with the two indices and then 

+    calling IAccessibleEditableText::insertText with the replacement text

+	at the start index.

+       

+   @param [in] startOffset

+    Start index of the text to be replaced.

+    The valid range is 0..length.

+   @param [in] endOffset

+    End index of the text to be replaced.

+    The valid range is 0..length.

+   @param [in] text

+    The Text that replaces the text between the given indices.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+  */

+  HRESULT replaceText

+    (

+     [in] long startOffset,

+     [in] long endOffset,

+     [in] BSTR *text

+    );

+

+  /** @brief Replaces the attributes of a text range by the given set of attributes.

+    

+   Sets the attributes for the text between the two given indices. The old

+    attributes are replaced by the new list of attributes.

+        

+   @param [in] startOffset

+    Start index of the text whose attributes are modified.

+    The valid range is 0..length.

+   @param [in] endOffset

+    End index of the text whose attributes are modified.

+    The valid range is 0..length.

+   @param [in] attributes

+    Set of attributes that replaces the old list of attributes of

+    the specified text portion.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+   @note Refer to @ref _specialOffsets 

+    "Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods" 

+    for information about special offsets that can be used in %IAccessibleEditableText

+    methods.

+  */

+  HRESULT setAttributes

+    (

+     [in] long startOffset,

+     [in] long endOffset,

+     [in] BSTR *attributes

+    );

+}

+

+/*************************************************************************

+ *

+ *  File Name (AccessibleHyperlink.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** @brief This interface represents hyperlinks.

+

+ This interface represents a hyperlink associated with a single substring 

+  of text or single non-text object.  Non-text objects can have either a 

+  single link or a collection of links such as when the non-text object is 

+  an image map.

+

+ Linked objects and anchors are implementation dependent. This interface is derived

+  from IAccessibleAction.  IAccessibleAction::nActions is one greater than the 

+  maximum value for the indices used with the methods of this interface.

+        

+ Furthermore, the object that implements this interface has to be connected 

+  implicitly or explicitly with an object that implements IAccessibleText.

+  IAccessibleHyperlink::startIndex and IAccessibleHyperlink::endIndex are

+  indices with respect to the text exposed by IAccessibleText.

+

+ This interface provides access to a single object which can have multiple actions.

+  An example is an image map which is an image with multiple links each of which is

+  associated with a separate non-overlapping area of the image.  This interface could

+  also be applied to other kinds of objects with multiple actions such as "smart tags"

+  which are objects, typically strings, which have multiple actions such as

+  "Activate URI", "Bookmark URI", etc.

+

+ An interesting use case is an image map where each area is associated with multiple

+  actions, e.g. an image map of smart tags.  In this case you would have to implement

+  two levels of accessible hyperlinks.  The first level hyperlinks would only implement

+  anchor and anchorTarget.  The anchors would all reference the image object.  The

+  anchorTargets would reference the second level accessible hyperlink objects.  None

+  of the IAccessibleAction methods would be implemented on the first level hyperlink

+  objects.  The second level hyperlink objects would implement the IAccessibleAction

+  methods.  Their anchors would also reference the image object and their anchorTargets

+  would reference URLs or the objects that would be activated.

+

+ This use case demonstrates that in some cases there is no need for IAccessibleHyperlink

+  to derive from IAccessibleAction.  As a result it may be removed in a later version of

+  the IDL and it is suggested that implementations should not rely on the inheritance.

+

+*/

+[object, uuid(01C20F2B-3DD2-400f-949F-AD00BDAB1D41)]

+interface IAccessibleHyperlink : IAccessibleAction

+{

+

+  /** @brief Returns an object that represents the link anchor, as appropriate

+   for the link at the specified index.       

+   @param [in] index

+    A 0 based index identifies the anchor when, as in the case of an image map,

+    there is more than one link represented by this object.  The valid maximal

+    index is indicated by IAccessibleAction::nActions.

+   @param [out] anchor

+    This is an implementation dependent value.  For example, for a text link this 

+	method could return the substring of the containing string where the substring

+	is overridden with link behavior, and for an image link this method could return 

+	an IUnknown VARIANT for IAccessibleImage.  See the section about 

+	@ref _variants "VARIANTs" for additional information.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT anchor

+    (

+     [in] long index,

+     [out, retval] VARIANT *anchor

+    );

+

+  /** @brief Returns an object representing the target of the link, as appropriate

+   for the link at the specified index.       

+   @param [in] index

+    A 0 based index identifies the anchor when, as in the case of an image map,

+    there is more than one link represented by this object.  The valid maximal

+    index is indicated by IAccessibleAction::nActions.

+   @param [out] anchorTarget

+    This is an implementation dependent value.  For example this method could

+	return a BSTR VARIANT of the URI.  Alternatively this method could return an

+	IUnknown VARIANT of a COM interface representing a target object to be 

+	activated when the link is activated.  See the section about 

+	@ref _variants "VARIANTs" for additional information.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT anchorTarget

+    (

+     [in] long index,

+     [out, retval] VARIANT *anchorTarget

+    );

+

+  /** @brief Returns the 0 based character offset at which the textual representation of the hyperlink starts.

+

+   The returned value is related to the IAccessibleText interface of the object that 

+   owns this hyperlink. 

+   @param [out] index

+   @retval S_OK

+  */

+  [propget] HRESULT startIndex

+    (

+     [out, retval] long *index

+    );

+

+  /** @brief Returns the 0 based character offset at which the textual representation of the hyperlink ends.

+    

+   The returned value is related to the IAccessibleText interface of the object that 

+   owns this hyperlink. The character at the index is not part of the hypertext.  

+   @param [out] index

+   @retval S_OK

+  */

+  [propget] HRESULT endIndex

+    (

+     [out, retval] long *index

+    );

+

+  /** @brief Returns whether the target object referenced by this link is still valid.

+        

+   This is a volatile state that may change without sending an appropriate event.

+   Returns TRUE if the referenced target is still valid and FALSE otherwise.

+

+   This has also been used to indicate whether or not the URI of the anchorTarget

+   is malformed.

+

+   @param [out] valid

+    If false, one or more of the object's links are invalid.

+	If true, all of the object's links are valid.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is FALSE

+   @note This method is not being used, is deprecated, and should not be implemented or

+    used.  It is likely that this method will be removed in a later version of the IDL.

+  */

+  [propget] HRESULT valid

+    (

+     [out, retval] boolean *valid

+    );

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleHypertext.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+
+

+/** @brief This interface exposes information about hypertext in a document.

+

+ The %IAccessibleHypertext interface is the main interface to expose

+  hyperlinks in a document, typically a text document, that are used 

+  to reference other documents.  A typical implementation is to implement 

+  this interface on the smallest text object such as a paragraph of text.

+*/

+[object, uuid(6B4F8BBF-F1F2-418a-B35E-A195BC4103B9)]

+interface IAccessibleHypertext : IAccessibleText

+{

+

+  /** @brief Returns the number of links and link groups contained within this hypertext 

+    paragraph.

+   @param [out] hyperlinkCount

+    The number of links and link groups within this hypertext paragraph.  

+    Returns 0 if there is no link.

+   @retval S_OK

+  */

+  [propget] HRESULT nHyperlinks

+    (

+     [out, retval] long *hyperlinkCount

+    );

+

+  /** @brief Returns the specified link.

+    

+   The returned IAccessibleHyperlink object encapsulates the hyperlink and 

+    provides several kinds of information describing it.

+   @param [in] index

+    This 0 based index specifies the hyperlink to return.

+   @param [out] hyperlink

+    If the given index is valid, i.e. lies in the interval from 0 to the number 

+    of links minus one, a reference to the specified hyperlink object is returned.  

+    If the index is invalid then a NULL pointer is returned.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT hyperlink

+    (

+     [in] long index,

+     [out, retval] IAccessibleHyperlink **hyperlink

+    );

+

+  /** @brief Returns the index of the hyperlink that is associated with this character index.

+        

+   This is the case when a link spans the given character index.

+   @param [in] charIndex

+    A 0 based index of the character for which to return the link index.  If 

+	IAccessibleText is used to represent the text containing the link, then the 

+	character index is only  valid if it is greater than or equal to zero and 

+	lower than the number of characters in the text.

+   @param [out] hyperlinkIndex

+    Returns the 0 based index of the hyperlink that is associated with this 

+	character index, or -1 if charIndex is not on a link.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is -1

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT hyperlinkIndex

+    (

+     [in] long charIndex,

+     [out, retval] long *hyperlinkIndex

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleHypertext2.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+
+

+/** @brief This interface exposes information about hypertext in a document.

+

+ The %IAccessibleHypertext2 interface extends the functinality of the

+ %IAccessibleHypertext inteface.

+*/

+[object, uuid(CF64D89F-8287-4B44-8501-A827453A6077)]

+interface IAccessibleHypertext2 : IAccessibleHypertext

+{

+

+ /** @brief Returns the links for this object.

+

+   The returned IAccessibleHyperlink objects encapsulate the hyperlink and 

+    provides several kinds of information describing it.

+

+   @param [out] hyperlinks

+    This array is allocated by the server.  The client must free it with CoTaskMemFree.

+   @param [out] nHyperlinks

+    The number of links returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are no links, [out] values are NULL and 0 respectively

+  */

+  [propget] HRESULT hyperlinks

+    (

+     [out, size_is(,*nHyperlinks)] IAccessibleHyperlink ***hyperlinks,

+     [out, retval] long *nHyperlinks

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleTable.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+
+

+/** @brief This interface gives access to a two-dimensional table. 

+       

+ Typically all accessible objects that represent cells or cell-clusters of a table 

+  will be at the same time children of the table.  In this case IAccessible2::indexInParent

+  will return the child index which then can be used when calling IAccessibleTable::rowIndex

+  and IAccessibleTable::columnIndex.

+

+ However, in some cases that kind of implementation will not be possible.  When

+  the table cells are not direct children of a table, the object representing

+  the cell can define a "table-cell-index" object attribute identifying the 0 

+  based table cell index.  This object attribute is obtained by parsing the

+  attribute string returned by IAccessible2::attributes.  The "table-cell-index"

+  attribute can be used just like a child index of the typical case.  ATs should 

+  first test for the presence of the "table-cell-index" attribute and if it is not

+  present then IAccessible2::indexInParent can be used as in the typical case

+  where cells are direct children of the table.

+              

+ The range of valid coordinates for this interface are implementation dependent.  

+  However, that range includes at least the intervals from the from the first row 

+  or column with the index 0 up to the last (but not including) used row or column 

+  as returned by IAccessibleTable::nRows and IAccessibleTable::nColumns.

+

+ Note that newer implementations are now using IAccessibleTable2 and IAccessibleTableCell

+  rather than this interface.

+*/

+[object, uuid(35AD8070-C20C-4fb4-B094-F4F7275DD469)]

+interface IAccessibleTable : IUnknown

+{

+

+  /** @brief Returns the accessible object at the specified row and column in 

+    the table.  This object could be an IAccessible or an IAccessible2.

+   @param [in] row

+    The 0 based row index for which to retrieve the cell.

+   @param [in] column

+    The 0 based column index for which to retrieve the cell.

+   @param [out] accessible

+    If both row and column index are valid then the corresponding accessible 

+    object is returned that represents the requested cell regardless of whether 

+    the cell is currently visible (on the screen).

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is NULL 

+  */

+  [propget] HRESULT accessibleAt

+    (

+     [in] long row, 

+     [in] long column,

+     [out, retval] IUnknown **accessible 

+    );

+

+  /** @brief Returns the caption for the table.  The returned object could be 

+    an IAccessible or an IAccessible2.

+   @param [out] accessible

+    If the table has a caption then a reference to it is returned, else a NULL 

+    pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+  */

+  [propget] HRESULT caption

+    (

+     [out, retval] IUnknown **accessible 

+    );

+	  

+  /** @brief Translates the given row and column indexes into the corresponding cell index.

+   @param [in] rowIndex

+    0 based row index for the cell.

+   @param [in] columnIndex

+    0 based column index for the cell.

+   @param [out] cellIndex

+    Returns the 0 based index of the cell at the specified row and column indexes.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is 0

+   @note The returned value is not necessarily a child index of the immediate parent.

+    In cases where the table cells are not direct children of the table the index 

+    is actually the cell index, i.e. conceptually it's an index into a one dimensional

+	array of cells laid out in row order.

+  */

+  [propget] HRESULT childIndex

+	(

+	 [in] long rowIndex,

+	 [in] long columnIndex,

+	 [out, retval] long *cellIndex

+	);

+

+  /** @brief Returns the description text of the specified column in the table.

+   @param [in] column

+    The 0 based index of the column for which to retrieve the description.

+   @param [out] description

+    Returns the description text of the specified column in the table if such a 

+    description exists.  Otherwise a NULL pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed, [out] value is NULL

+  */

+  [propget] HRESULT columnDescription

+    (

+     [in] long column,

+     [out, retval] BSTR *description

+    );

+

+  /** @brief Returns the number of columns occupied by the accessible object 

+    at the specified row and column in the table.

+        

+   The result is greater than 1 if the specified cell spans multiple columns.

+   @param [in] row

+    0 based row index of the accessible for which to return the column extent.

+   @param [in] column

+    0 based column index of the accessible for which to return the column extent.

+   @param [out] nColumnsSpanned

+    Returns the 1 based column extent of the specified cell.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is 0

+  */

+  [propget] HRESULT columnExtentAt

+    (

+     [in] long row,

+     [in] long column,

+     [out, retval] long *nColumnsSpanned 

+    );

+

+  /** @brief Returns the column headers as an %IAccessibleTable object.

+        

+   Content and size of the returned table are implementation dependent.

+   @param [out] accessibleTable

+    The column header

+   @param [out] startingRowIndex

+    The 0 based row index where the header starts, usually 0.

+   @retval S_OK

+   @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT columnHeader

+    (

+     [out] IAccessibleTable **accessibleTable,

+	 [out, retval] long *startingRowIndex

+    );

+

+  /** @brief Translates the given cell index into the corresponding column index.

+   @param [in] cellIndex

+    0 based index of the cell in the parent or closest ancestor table.  Typically this

+	is the value returned from IAccessible2::indexInParent, but in the case where the 

+	table cells are not direct children of the table this is the cell index specified 

+	by the "table-cell-index" object attribute obtained from parsing the attributes 

+	string returned by calling IAccessible2::attributes on the cell object.

+   @param [out] columnIndex

+    Returns the 0 based column index of the cell of the specified child or the index of 

+    the first column if the child spans multiple columns.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is 0

+  */

+  [propget] HRESULT columnIndex

+    (

+	 [in] long cellIndex,

+	 [out, retval] long *columnIndex

+	);

+

+  /** @brief Returns the total number of columns in table

+   @param [out] columnCount

+    Number of columns in table (including columns outside the current viewport)

+   @retval S_OK

+  */

+  [propget] HRESULT nColumns

+    (

+     [out, retval] long *columnCount 

+    );

+

+  /** @brief Returns the total number of rows in table

+   @param [out] rowCount

+    Number of rows in table (including rows outside the current viewport)

+   @retval S_OK

+  */

+  [propget] HRESULT nRows

+    (

+     [out, retval] long *rowCount 

+    );

+

+  /** @brief Returns the total number of selected cells

+   @param [out] cellCount

+    Number of cells currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedChildren

+    (

+	 [out, retval] long *cellCount

+	);

+

+  /** @brief Returns the total number of selected columns

+   @param [out] columnCount

+    Number of columns currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedColumns

+    (

+     [out, retval] long *columnCount 

+    );

+

+  /** @brief Returns the total number of selected rows

+   @param [out] rowCount

+    Number of rows currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedRows

+    (

+     [out, retval] long *rowCount 

+    );

+

+  /** @brief Returns the description text of the specified row in the table.

+   @param [in] row

+    The 0 based index of the row for which to retrieve the description.

+   @param [out] description

+    Returns the description text of the specified row in the table if such a 

+    description exists.  Otherwise a NULL pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed, [out] value is NULL

+  */

+  [propget] HRESULT rowDescription

+    (

+     [in] long row, 

+     [out, retval] BSTR *description

+    );

+

+  /** @brief Returns the number of rows occupied by the accessible object 

+    at the specified row and column in the table.

+        

+   The result is greater than 1 if the specified cell spans multiple rows.

+   @param [in] row

+    0 based row index of the accessible for which to return the row extent.

+   @param [in] column

+    0 based column index of the accessible for which to return the row extent.

+   @param [out] nRowsSpanned

+    Returns the row extent of the specified cell.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is 0

+  */

+  [propget] HRESULT rowExtentAt

+    (

+     [in] long row,

+     [in] long column,

+     [out, retval] long *nRowsSpanned

+    );

+

+  /** @brief Returns the row headers as an %IAccessibleTable object.

+        

+   Content and size of the returned table are implementation dependent.

+   @param [out] accessibleTable

+    The row header.

+   @param [out] startingColumnIndex

+    The 0 based column index where the header starts, usually 0.

+   @retval S_OK

+   @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT rowHeader

+    (

+     [out] IAccessibleTable **accessibleTable,

+	 [out, retval] long *startingColumnIndex

+    );

+

+  /** @brief Translates the given cell index into a row index.

+   @param [in] cellIndex

+    0 based index of the cell in the parent or closest ancestor table.  Typically this 

+	is the value returned from IAccessible2::indexInParent, but in the case where the 

+	table cells are not direct children of the table this is the cell index specified 

+	by the "table-cell-index" object attribute obtained from parsing the attributes 

+	string returned by calling IAccessible2::attributes on the cell object.

+   @param [out] rowIndex

+    0 based row index

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is 0

+  */

+  [propget] HRESULT rowIndex

+    (

+	 [in] long cellIndex,

+	 [out, retval] long *rowIndex 

+	);

+

+  /** @brief Returns a list of cell indexes currently selected (0 based).

+   @param [in] maxChildren

+    This parameter is ignored. Refer to @ref _arrayConsideration

+	"Special Consideration when using Arrays" for more details.

+   @param [out] children

+    An array of cell indexes of selected cells (each index is 0 based), 

+	allocated by the server. The client must free it with CoTaskMemFree.

+   @param [out] nChildren

+    The number of cell indexes returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedChildren

+    (

+     [in] long maxChildren,

+     [out, size_is(,maxChildren), length_is(,*nChildren)] long **children,

+     [out, retval] long *nChildren

+    );

+

+  /** @brief Returns a list of column indexes currently selected (0 based).

+   @param [in] maxColumns

+    This parameter is ignored. Refer to @ref _arrayConsideration 

+	"Special Consideration when using Arrays" for more details.

+   @param [out] columns

+	An array of column indexes of selected columns (each index is 0 based), allocated

+	by the server. The client must free it with CoTaskMemFree.

+   @param [out] nColumns

+    The number of column indexes returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedColumns

+    (

+     [in] long maxColumns,

+     [out, size_is(,maxColumns), length_is(,*nColumns)] long **columns,

+     [out, retval] long *nColumns

+    );

+

+  /** @brief Returns a list of row indexes currently selected (0 based).

+   @param [in] maxRows

+    This parameter is ignored. Refer to @ref _arrayConsideration

+	"Special Consideration when using Arrays" for more details.

+   @param [out] rows

+    An array of row indexes of selected rows (each index is 0 based), allocated

+	by the server. The client must free it with CoTaskMemFree.

+   @param [out] nRows

+    The number of row indexes returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedRows

+    (

+     [in] long maxRows, 

+     [out, size_is(,maxRows), length_is(,*nRows)] long **rows, 

+     [out, retval] long *nRows 

+    );

+

+  /** @brief Returns the summary description of the table.  The returned object could be 

+    an IAccessible or an IAccessible2.

+   @param [out] accessible

+    Returns a reference to an implementation dependent accessible object 

+    representing the table's summary or a NULL pointer if the table 

+    does not support a summary.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+  */

+  [propget] HRESULT summary

+    (

+     [out, retval] IUnknown **accessible 

+    );

+

+  /** @brief Returns a boolean value indicating whether the specified column is 

+    completely selected.

+   @param [in] column

+    0 based index of the column for which to determine whether it is selected.

+   @param [out] isSelected

+    Returns TRUE if the specified column is selected completely and FALSE otherwise.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE

+  */

+  [propget] HRESULT isColumnSelected

+    (

+     [in] long column,

+     [out, retval] boolean *isSelected

+    );

+

+  /** @brief Returns a boolean value indicating whether the specified row is completely 

+    selected.

+   @param [in] row

+    0 based index of the row for which to determine whether it is selected.

+   @param [out] isSelected

+    Returns TRUE if the specified row is selected completely and FALSE otherwise.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE

+  */

+  [propget] HRESULT isRowSelected

+    (

+     [in] long row,

+     [out, retval] boolean *isSelected

+    );

+

+  /** @brief Returns a boolean value indicating whether the specified cell is selected.

+   @param [in] row

+    0 based index of the row for the cell to determine whether it is selected.

+   @param [in] column

+    0 based index of the column for the cell to determine whether it is selected.

+   @param [out] isSelected

+    Returns TRUE if the specified cell is selected and FALSE otherwise.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] value is FALSE

+  */

+  [propget] HRESULT isSelected

+    (

+     [in] long row,

+     [in] long column,

+     [out, retval] boolean *isSelected 

+    );

+

+  /** @brief Selects a row and unselects all previously selected rows.

+   @param [in] row

+    0 based index of the row to be selected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT selectRow

+    (

+     [in] long row 

+    );

+

+  /** @brief Selects a column and unselects all previously selected columns.

+   @param [in] column

+    0 based index of the column to be selected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT selectColumn

+    (

+     [in] long column

+    );

+

+  /** @brief Unselects one row, leaving other selected rows selected (if any).

+   @param [in] row

+    0 based index of the row to be unselected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT unselectRow

+    (

+     [in] long row

+    );

+

+  /** @brief Unselects one column, leaving other selected columns selected (if any).

+   @param [in] column

+    0 based index of the column to be unselected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT unselectColumn

+    (

+     [in] long column

+    );

+  

+  /** @brief Given a cell index, gets the row and column indexes and extents of a cell 

+    and whether or not it is selected.

+

+   This is a convenience function.  It is not mandatory to implement it.

+   @param [in] index

+    0 based index of this cell in the table.

+   @param [out] row

+    0 based row index.

+   @param [out] column

+    0 based column index.

+   @param [out] rowExtents

+    Number of cells spanned by this cell in this row.

+   @param [out] columnExtents

+    Number of cells spanned by this cell in this column.

+   @param [out] isSelected

+    Indicates if the specified cell is selected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed, [out] values are 0s and FALSE respectively

+  */

+  [propget] HRESULT rowColumnExtentsAtIndex

+    (

+	 [in] long index, 

+	 [out] long *row,  

+	 [out] long *column,

+	 [out] long *rowExtents,

+	 [out] long *columnExtents,

+	 [out, retval] boolean *isSelected

+	);

+

+  /** @brief Returns the type and extents describing how a table changed.

+  

+   Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.

+

+   This data is only guaranteed to be valid while the thread notifying the event 

+   continues. Once the handler has returned, the validity of the data depends on 

+   how the server manages the life cycle of its objects. Also, note that the server 

+   may have different life cycle management strategies for controls depending on 

+   whether or not a control manages its children. Lists, trees, and tables can have 

+   a large number of children and thus it's possible that the child objects for those 

+   controls would only be created as needed. Servers should document their life cycle 

+   strategy as this will be of interest to assistive technology or script engines 

+   accessing data out of process or from other threads. Servers only need to save the 

+   most recent row and column values associated with the change and a scope of the 

+   entire application is adequate.

+

+   @param [out] modelChange

+    A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+  */

+  [propget] HRESULT modelChange

+    (

+	 [out, retval] IA2TableModelChange *modelChange

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleTable2.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2012 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+
+

+/** @brief This interface gives access to a two-dimensional table.

+

+ Please also refer to the IAccessibleTableCell interface.

+

+ If you want to support older applications you should also support the

+  IAccessibleTable inteface.

+*/

+[object, uuid(6167f295-06f0-4cdd-a1fa-02e25153d869)]

+interface IAccessibleTable2 : IUnknown

+{

+

+  /** @brief Returns the accessible object at the specified row and column in 

+    the table.  This object could be an IAccessible or an IAccessible2.

+   @param [in] row

+    The 0 based row index for which to retrieve the cell.

+   @param [in] column

+    The 0 based column index for which to retrieve the cell.

+   @param [out] cell

+    If both row and column index are valid then the corresponding accessible 

+    object is returned that represents the requested cell regardless of whether 

+    the cell is currently visible (on the screen).

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT cellAt

+    (

+     [in] long row, 

+     [in] long column,

+     [out, retval] IUnknown **cell

+    );

+

+  /** @brief Returns the caption for the table.  The returned object could be 

+    an IAccessible or an IAccessible2.

+   @param [out] accessible

+    If the table has a caption then a reference to it is returned, else a NULL 

+    pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+   @deprecated use a describedBy relation

+  */

+  [propget] HRESULT caption

+    (

+     [out, retval] IUnknown **accessible

+    );

+	  

+  /** @brief Returns the description text of the specified column in the table.

+   @param [in] column

+    The 0 based index of the column for which to retrieve the description.

+   @param [out] description

+    Returns the description text of the specified column in the table if such a 

+    description exists.  Otherwise a NULL pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT columnDescription

+    (

+     [in] long column,

+     [out, retval] BSTR *description

+    );

+

+

+  /** @brief Returns the total number of columns in table

+   @param [out] columnCount

+    Number of columns in table (including columns outside the current viewport)

+   @retval S_OK

+  */

+  [propget] HRESULT nColumns

+    (

+     [out, retval] long *columnCount 

+    );

+

+  /** @brief Returns the total number of rows in table

+   @param [out] rowCount

+    Number of rows in table (including rows outside the current viewport)

+   @retval S_OK

+  */

+  [propget] HRESULT nRows

+    (

+     [out, retval] long *rowCount 

+    );

+

+  /** @brief Returns the total number of selected cells

+   @param [out] cellCount

+    Number of cells currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedCells

+    (

+     [out, retval] long *cellCount

+    );

+

+  /** @brief Returns the total number of selected columns

+   @param [out] columnCount

+    Number of columns currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedColumns

+    (

+     [out, retval] long *columnCount 

+    );

+

+  /** @brief Returns the total number of selected rows

+   @param [out] rowCount

+    Number of rows currently selected

+   @retval S_OK

+  */

+  [propget] HRESULT nSelectedRows

+    (

+     [out, retval] long *rowCount 

+    );

+

+  /** @brief Returns the description text of the specified row in the table.

+   @param [in] row

+    The 0 based index of the row for which to retrieve the description.

+   @param [out] description

+    Returns the description text of the specified row in the table if such a 

+    description exists.  Otherwise a NULL pointer is returned.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT rowDescription

+    (

+     [in] long row, 

+     [out, retval] BSTR *description

+    );

+

+  /** @brief Returns a list of accessibles currently selected.

+   @param [out] cells

+    Pointer to an array of references to selected accessibles.  The array is

+    allocated by the server with CoTaskMemAlloc and freed by the client with

+    CoTaskMemFree.

+   @param [out] nSelectedCells

+    The number of accessibles returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedCells

+    (

+     [out, size_is(,*nSelectedCells)] IUnknown ***cells,

+     [out, retval] long *nSelectedCells

+    );

+

+  /** @brief Returns a list of column indexes currently selected (0 based).

+   @param [out] selectedColumns

+    A pointer to an array of column indexes of selected columns (each index is

+    0 based).  The array is allocated by the server with CoTaskMemAlloc and

+    freed by the client with CoTaskMemFree.

+   @param [out] nColumns

+    The number of column indexes returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedColumns

+    (

+     [out, size_is(,*nColumns)] long **selectedColumns,

+     [out, retval] long *nColumns

+    );

+

+  /** @brief Returns a list of row indexes currently selected (0 based).

+   @param [out] selectedRows

+    An array of row indexes of selected rows (each index is 0 based).  The array

+    is allocated by the server with CoTaskMemAlloc and freed by the client with

+    CoTaskMemFree.

+   @param [out] nRows

+    The number of row indexes returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there are none, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT selectedRows

+    (

+     [out, size_is(,*nRows)] long **selectedRows, 

+     [out, retval] long *nRows 

+    );

+

+  /** @brief Returns the summary description of the table.  The returned object could be 

+    an IAccessible or an IAccessible2.

+   @param [out] accessible

+    Returns a reference to an implementation dependent accessible object 

+    representing the table's summary or a NULL pointer if the table 

+    does not support a summary.

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+   @deprecated Use the labeledBy relation

+  */

+  [propget] HRESULT summary

+    (

+     [out, retval] IUnknown **accessible 

+    );

+

+  /** @brief Returns a boolean value indicating whether the specified column is 

+    completely selected.

+   @param [in] column

+    0 based index of the column for which to determine whether it is selected.

+   @param [out] isSelected

+    Returns TRUE if the specified column is selected completely and FALSE otherwise.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT isColumnSelected

+    (

+     [in] long column,

+     [out, retval] boolean *isSelected

+    );

+

+  /** @brief Returns a boolean value indicating whether the specified row is completely 

+    selected.

+   @param [in] row

+    0 based index of the row for which to determine whether it is selected.

+   @param [out] isSelected

+    Returns TRUE if the specified row is selected completely and FALSE otherwise.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  [propget] HRESULT isRowSelected

+    (

+     [in] long row,

+     [out, retval] boolean *isSelected

+    );

+

+  /** @brief Selects a row and unselects all previously selected rows.

+

+   The behavior should mimic that of the application, but for those applications

+    which do not have a means in the GUI to select a full row of cells the behavior 

+    should be as follows:  First any selected rows in the table are unselected.  Then

+    the entire row of cells for the specified row is selected.  If any of the

+    cells in the selected row span additional rows, the cells in those rows

+    are also selected. 

+   @param [in] row

+    0 based index of the row to be selected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT selectRow

+    (

+     [in] long row 

+    );

+

+  /** @brief Selects a column and unselects all previously selected columns.

+

+   The behavior should mimic that of the application, but for those applications

+    which do not have a means in the GUI to select a full column of cells the behavior 

+    should be as follows:  First any selected columns in the table are unselected.  Then

+    the entire column of cells for the specified column is selected.  If any of the

+    cells in the selected column span additional columns, the cells in those columns

+    are also selected. 

+   @param [in] column

+    0 based index of the column to be selected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT selectColumn

+    (

+     [in] long column

+    );

+

+  /** @brief Unselects one row, leaving other selected rows selected (if any).

+

+   The behavior should mimic that of the application, but for those applications

+    which do not have a means in the GUI to unselect a full row of cells the

+    behavior should be as follows:  The entire row of cells for the specified

+    row is unselected.  If any of the cells in the selected row span additional

+    rows, the cells in those rows are also unselected. 

+   @param [in] row

+    0 based index of the row to be unselected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT unselectRow

+    (

+     [in] long row

+    );

+

+  /** @brief Unselects one column, leaving other selected columns selected (if any).

+

+   The behavior should mimic that of the application, but for those applications

+    which do not have a means in the GUI to unselect a full column of cells the

+    behavior should be as follows:  The entire column of cells for the specified

+    column is unselected.  If any of the cells in the selected column span additional

+    columns, the cells in those columns are also unselected. 

+   @param [in] column

+    0 based index of the column to be unselected.

+   @retval S_OK

+   @retval E_INVALIDARG if bad [in] passed

+  */

+  HRESULT unselectColumn

+    (

+     [in] long column

+    );

+

+  /** @brief Returns the type and extents describing how a table changed.

+  

+   Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.

+

+   This data is only guaranteed to be valid while the thread notifying the event 

+   continues. Once the handler has returned, the validity of the data depends on 

+   how the server manages the life cycle of its objects. Also, note that the server 

+   may have different life cycle management strategies for controls depending on 

+   whether or not a control manages its children. Lists, trees, and tables can have 

+   a large number of children and thus it's possible that the child objects for those 

+   controls would only be created as needed. Servers should document their life cycle 

+   strategy as this will be of interest to assistive technology or script engines 

+   accessing data out of process or from other threads. Servers only need to save the 

+   most recent row and column values associated with the change and a scope of the 

+   entire application is adequate.

+

+   @param [out] modelChange

+    A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL 

+  */

+  [propget] HRESULT modelChange

+    (

+     [out, retval] IA2TableModelChange *modelChange

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleTableCell.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2013 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** @brief This interface gives access to the cells of a two-dimensional table.

+

+ Please also refer to the IAccessibleTable2 interface.

+

+*/

+[object, uuid(594116B1-C99F-4847-AD06-0A7A86ECE645)]

+interface IAccessibleTableCell : IUnknown

+{

+

+  /** @brief Returns the number of columns occupied by this cell accessible.

+        

+   The result is greater than 1 if the specified cell spans multiple columns.

+   @param [out] nColumnsSpanned

+    Returns the 1 based column extent of the specified cell.

+   @retval S_OK

+  */

+  [propget] HRESULT columnExtent

+    (

+     [out, retval] long *nColumnsSpanned 

+    );

+

+  /** @brief Returns the column headers as an array of cell accessibles.

+

+   @param [out] cellAccessibles

+    Pointer to an array of references to cell accessibles.  The array is allocated

+	by the server.  The client must free it with CoTaskMemFree.

+   @param [out] nColumnHeaderCells

+    The number of accessibles returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT columnHeaderCells

+    (

+     [out, size_is(,*nColumnHeaderCells)] IUnknown ***cellAccessibles,

+     [out, retval] long *nColumnHeaderCells

+    );

+

+  /** @brief Translates this cell accessible into the corresponding column index.

+

+   @param [out] columnIndex

+    Returns the 0 based column index of the cell of the specified cell or the index of 

+    the first column if the cell spans multiple columns.

+   @retval S_OK

+  */

+  [propget] HRESULT columnIndex

+    (

+     [out, retval] long *columnIndex

+    );

+

+  /** @brief Returns the number of rows occupied by this cell accessible.

+        

+   @param [out] nRowsSpanned

+    Returns the row extent of the specified cell.

+   @retval S_OK

+  */

+  [propget] HRESULT rowExtent

+    (

+     [out, retval] long *nRowsSpanned

+    );

+

+  /** @brief Returns the row headers as an array of cell accessibles.

+

+   @param [out] cellAccessibles

+    Pointer to an array of references to cell accessibles.  The array is allocated

+	by the server.  The client must free it with CoTaskMemFree.

+   @param [out] nRowHeaderCells

+    The number of accessibles returned; the size of the returned array.

+   @retval S_OK

+   @retval S_FALSE if there is no header, [out] values are NULL and 0 respectively 

+  */

+  [propget] HRESULT rowHeaderCells

+    (

+     [out, size_is(,*nRowHeaderCells)] IUnknown ***cellAccessibles,

+     [out, retval] long *nRowHeaderCells

+    );

+

+  /** @brief Translates this cell accessible into the corresponding row index.

+

+   @param [out] rowIndex

+    Returns the 0 based row index of the specified cell or the index of 

+    the first row if the cell spans multiple rows.

+   @retval S_OK

+  */

+  [propget] HRESULT rowIndex

+    (

+     [out, retval] long *rowIndex 

+    );

+

+  /** @brief Returns a boolean value indicating whether this cell is selected.

+

+   @param [out] isSelected

+    Returns TRUE if the specified cell is selected and FALSE otherwise.

+   @retval S_OK

+  */

+  [propget] HRESULT isSelected

+    (

+     [out, retval] boolean *isSelected 

+    );

+  

+  /** @brief Gets the row and column indexes and extents of this cell accessible

+    and whether or not it is selected.

+

+   This is a convenience function.  It is not mandatory to implement it.

+   @param [out] row

+    0 based row index.

+   @param [out] column

+    0 based column index.

+   @param [out] rowExtents

+    Number of cells spanned by this cell in this row.

+   @param [out] columnExtents

+    Number of cells spanned by this cell in this column.

+   @param [out] isSelected

+    Indicates if the specified cell is selected.

+   @retval S_OK

+  */

+  [propget] HRESULT rowColumnExtents

+    (

+     [out] long *row,  

+     [out] long *column,

+     [out] long *rowExtents,

+     [out] long *columnExtents,

+     [out, retval] boolean *isSelected

+    );

+

+  /** @brief Returns a reference to the accessbile of the containing table.

+

+   @param [out] table

+    Returns a reference to the IUnknown of the containing table.

+   @retval S_OK

+  */

+  [propget] HRESULT table

+    (

+     [out, retval] IUnknown **table

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleImage.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+
+

+/** @brief This interface represents images and icons.

+

+ This interface is used for a representation of images like icons on buttons.

+  %IAccessibleImage only needs to be implemented in certain situations.  Some

+  examples are:

+  <ol>

+   <li>The accessible name and description are not enough to fully

+    describe the image, e.g. when the accessible description is used to define the

+    behavior of an actionable image and the image itself conveys semantically

+    significant information.

+   <li>The user can edit the content that includes an

+    image and therefore the user needs to be able to review the image's position.

+  </ol>

+*/

+[object, uuid(FE5ABB3D-615E-4f7b-909F-5F0EDA9E8DDE)]

+interface IAccessibleImage : IUnknown

+{

+  /** @brief Returns the localized description of the image.          

+   @param [out] description

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT description

+    (

+     [out, retval] BSTR *description

+    );

+

+  /** @brief Returns the coordinates of the image.

+   @param [in] coordinateType

+    Specifies whether the returned coordinates should be relative to the screen or the parent object.

+   @param [out] x

+   @param [out] y

+   @retval S_OK

+  */

+  [propget] HRESULT imagePosition

+    (

+	 [in] enum IA2CoordinateType coordinateType,

+	 [out] long *x,

+     [out, retval] long *y

+    );

+

+  /** @brief Returns the size of the image in units specified by parent's coordinate system.

+   @param [out] height

+   @param [out] width

+   @retval S_OK

+  */

+

+  [propget] HRESULT imageSize

+    (

+     [out] long *height,

+	 [out, retval] long *width

+    );

+}

+/*************************************************************************

+ *

+ *  File Name (AccessibleEventID.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+/** %IAccessible2 specific event constants 

+

+ This enum defines the event IDs fired by %IAccessible2 objects.  The event IDs

+ are in addition to those used by MSAA.

+*/

+enum IA2EventID {

+

+  /** The change of the number or attributes of actions of an accessible

+    object is signaled by events of this type. 

+  */

+  IA2_EVENT_ACTION_CHANGED = 0x101,

+

+  /** <b>Deprecated.</b> The active descendant of a component has changed.

+	

+	Note: This event constant is misspelled and thus is deprecated and will be

+	removed in a later version. Please use the correctly spelled version which

+	follows.

+  */

+  IA2_EVENT_ACTIVE_DECENDENT_CHANGED,

+

+  /** The active descendant of a component has changed.  The active descendant 

+    is used in objects with transient children.  

+

+    Note: Due to the fact that MSAA's WinEvents don't allow the active child index

+	to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event the manages

+	descendants	scheme can't be used.  Instead the active child object has to fire

+	MSAA's EVENT_OBJECT_FOCUS.  In a future release a new event mechanism may be

+	added to provide for event specific data to be passed with the event.  At that

+	time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and

+	IA2_STATE_MANAGES_DESCENDANTS state would be useful.

+  */

+  IA2_EVENT_ACTIVE_DESCENDANT_CHANGED = IA2_EVENT_ACTIVE_DECENDENT_CHANGED,

+

+  /** The document wide attributes of the document object have changed.

+  */

+  IA2_EVENT_DOCUMENT_ATTRIBUTE_CHANGED,

+

+  /** The contents of the document have changed.

+  */

+  IA2_EVENT_DOCUMENT_CONTENT_CHANGED,

+

+  /** The loading of the document has completed.

+  */

+  IA2_EVENT_DOCUMENT_LOAD_COMPLETE,

+

+  /** The loading of the document was interrupted.

+  */

+  IA2_EVENT_DOCUMENT_LOAD_STOPPED,

+

+  /** The document contents are being reloaded.

+  */

+  IA2_EVENT_DOCUMENT_RELOAD,

+

+  /** The ending index of this link within the containing string has changed.

+  */

+  IA2_EVENT_HYPERLINK_END_INDEX_CHANGED,

+

+  /** The number of anchors associated with this hyperlink object has changed.

+  */

+  IA2_EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED,

+

+  /** The hyperlink selected state changed from selected to unselected or

+    from unselected to selected.

+  */

+  IA2_EVENT_HYPERLINK_SELECTED_LINK_CHANGED,

+

+  /** One of the links associated with the hypertext object has been activated.

+  */

+  IA2_EVENT_HYPERTEXT_LINK_ACTIVATED,

+

+  /** One of the links associated with the hypertext object has been selected.

+  */

+  IA2_EVENT_HYPERTEXT_LINK_SELECTED,

+

+  /** The starting index of this link within the containing string has changed.

+  */

+  IA2_EVENT_HYPERLINK_START_INDEX_CHANGED,

+

+  /** Focus has changed from one hypertext object to another, or focus moved

+   from a non-hypertext object to a hypertext object, or focus moved from a

+   hypertext object to a non-hypertext object.

+  */

+  IA2_EVENT_HYPERTEXT_CHANGED,

+

+  /** The number of hyperlinks associated with a hypertext object changed

+  */

+  IA2_EVENT_HYPERTEXT_NLINKS_CHANGED,

+

+  /** An object's attributes changed.

+  Also see ::IA2_EVENT_TEXT_ATTRIBUTE_CHANGED.

+  */

+  IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED,

+

+  /** A slide changed in a presentation document or a page boundary was 

+   crossed in a word processing document.

+  */

+  IA2_EVENT_PAGE_CHANGED,  

+

+  /** The caret moved from one section to the next.

+  */

+  IA2_EVENT_SECTION_CHANGED,

+  

+  /** A table caption changed.

+  */

+  IA2_EVENT_TABLE_CAPTION_CHANGED,

+

+  /** A table's column description changed.

+  */

+  IA2_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED,

+

+  /** A table's column header changed.

+  */

+  IA2_EVENT_TABLE_COLUMN_HEADER_CHANGED,

+

+  /** A table's data changed.

+  */

+  IA2_EVENT_TABLE_MODEL_CHANGED,

+

+  /** A table's row description changed.

+  */

+  IA2_EVENT_TABLE_ROW_DESCRIPTION_CHANGED,

+

+  /** A table's row header changed.

+  */

+  IA2_EVENT_TABLE_ROW_HEADER_CHANGED,

+

+  /** A table's summary changed.

+  */

+  IA2_EVENT_TABLE_SUMMARY_CHANGED,

+

+  /** A text object's attributes changed.

+  Also see ::IA2_EVENT_OBJECT_ATTRIBUTE_CHANGED.

+  */

+  IA2_EVENT_TEXT_ATTRIBUTE_CHANGED,

+

+  /** The caret has moved to a new position.

+  */

+  IA2_EVENT_TEXT_CARET_MOVED,

+

+  /** <b>Deprecated.</b>  This event is equivalent to ::IA2_EVENT_TEXT_UPDATED.

+  */

+  IA2_EVENT_TEXT_CHANGED,

+

+  /** The caret moved from one column to the next.

+  */

+  IA2_EVENT_TEXT_COLUMN_CHANGED,

+

+  /** Text was inserted.

+  */

+  IA2_EVENT_TEXT_INSERTED,

+

+  /** Text was removed.

+  */

+  IA2_EVENT_TEXT_REMOVED,

+

+  /** This event indicates general text changes, i.e. changes to text that are 

+    exposed through the IAccessibleText interface.  For compatibility with ATK/AT-SPI

+	which does not have an equivalent event, servers can alternatively fire 

+	::IA2_EVENT_TEXT_REMOVED and ::IA2_EVENT_TEXT_INSERTED.

+  */

+  IA2_EVENT_TEXT_UPDATED,

+

+  /** The text selection changed.  Later versions of Microsoft development environments 

+   have an equivalent event identified, EVENT_OBJECT_TEXTSELECTIONCHANGED.  Servers 

+   should use that if it is available and use IA2_EVENT_TEXT_SELECTION_CHANGED otherwise.  

+   Clients should be prepared to respond to either event.

+

+  */

+  IA2_EVENT_TEXT_SELECTION_CHANGED,

+

+  /** A visible data event indicates the change of the visual appearance

+    of an accessible object.  This includes for example most of the

+    attributes available via the IAccessibleComponent interface.

+  */

+  IA2_EVENT_VISIBLE_DATA_CHANGED

+

+};

+/*************************************************************************

+ *

+ *  File Name (AccessibleApplication.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2010 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+

+
+
+
+

+/** @brief This interface gives access to the application's name and version information.

+        

+ This interface provides the AT with the information it needs to differentiate 

+ this application from other applications, from other versions of this 

+ application, or from other versions of this application running on different 

+ versions of an accessibility bridge or accessibility toolkit.

+

+ Servers implementing IAccessible2 should provide access to the %IAccessibleApplication 

+ interface via QueryService from any object so that ATs can easily determine specific 

+ information about the application such as its name or version.

+*/

+[object, uuid(D49DED83-5B25-43F4-9B95-93B44595979E)]

+interface IAccessibleApplication : IUnknown

+{

+  

+  /** @brief Returns the application name.

+   @param [out] name

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT appName

+    (

+     [out, retval] BSTR *name

+    );

+

+  /** @brief Returns the application version.

+   @param [out] version

+    The version string must not contain levels when it is know beforehand that

+    this information will never require a change in a client's behavior.

+    For example, use "3.6.0" rather than "3.6.0.v201005131500".

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT appVersion

+    (

+     [out, retval] BSTR *version

+    );

+

+  /** @brief Returns the toolkit/bridge name.

+   @param [out] name

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT toolkitName

+    (

+     [out, retval] BSTR *name

+    );

+

+  /** @brief Returns the toolkit/bridge version.

+   @param [out] version

+    The version string must not contain levels when it is know beforehand that

+    this information will never require a change in a client's behavior.

+    For example, use "3.6.0" rather than "3.6.0.v201005131500".

+   @retval S_OK

+   @retval S_FALSE if there is nothing to return, [out] value is NULL

+  */

+  [propget] HRESULT toolkitVersion

+    (

+     [out, retval] BSTR *version

+    );  

+

+}

+

+/*************************************************************************

+ *

+ *  File Name (AccessibleDocument.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2013 Linux Foundation 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+
+
+
+

+/** @brief This interface represents documents.

+

+ This interface is used for a representation of documents.

+*/

+[object, uuid(C48C7FCF-4AB5-4056-AFA6-902D6E1D1149)]

+interface IAccessibleDocument : IUnknown

+{

+  /** @brief Returns the most recently used anchor target within a document.

+  

+   A document's most recently targeted in-page anchor is returned.  A typical use

+    of this method is to fetch the anchor target within an HTML document.  In this

+    case anchor targets are those which have been defined with the &lt;a&gt; tag.  

+

+   @param [out] accessible

+   @retval S_OK

+   @retval S_FALSE if there are no existing valid anchor targets, [out] value is NULL.

+  */

+  [propget] HRESULT anchorTarget

+    (

+     [out, retval] IUnknown **accessible

+    );

+

+}

+/*************************************************************************

+ *

+ *  File Name (IA2TypeLibrary.idl)

+ * 

+ *  IAccessible2 IDL Specification 

+ * 

+ *  Copyright (c) 2007, 2012 Linux Foundation 

+ *  Copyright (c) 2006 IBM Corporation 

+ *  Copyright (c) 2000, 2006 Sun Microsystems, Inc. 

+ *  All rights reserved. 

+ *   

+ *   

+ *  Redistribution and use in source and binary forms, with or without 

+ *  modification, are permitted provided that the following conditions 

+ *  are met: 

+ *   

+ *   1. Redistributions of source code must retain the above copyright 

+ *      notice, this list of conditions and the following disclaimer. 

+ *   

+ *   2. Redistributions in binary form must reproduce the above 

+ *      copyright notice, this list of conditions and the following 

+ *      disclaimer in the documentation and/or other materials 

+ *      provided with the distribution. 

+ *

+ *   3. Neither the name of the Linux Foundation nor the names of its 

+ *      contributors may be used to endorse or promote products 

+ *      derived from this software without specific prior written 

+ *      permission. 

+ *   

+ *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 

+ *  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 

+ *  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 

+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 

+ *  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 

+ *  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 

+ *  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 

+ *  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 

+ *  LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 

+ *  HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 

+ *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 

+ *  OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 

+ *  EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 

+ *   

+ *  This BSD License conforms to the Open Source Initiative "Simplified 

+ *  BSD License" as published at: 

+ *  http://www.opensource.org/licenses/bsd-license.php 

+ *   

+ *  IAccessible2 is a trademark of the Linux Foundation. The IAccessible2 

+ *  mark may be used in accordance with the Linux Foundation Trademark 

+ *  Policy to indicate compliance with the IAccessible2 specification. 

+ * 

+ ************************************************************************/ 

+

+// This is not a standalone file.  It is to be appended to the end of the 

+// merged IDL file.

+

+cpp_quote("")

+cpp_quote("// Type Library Definitions")

+cpp_quote("")

+

+[

+    uuid(CE3F726E-D1D3-44FE-B995-FF1DB3B48B2B),

+    helpstring("IAccessible2 Type Library"),

+    version(1.3),

+    hidden

+]

+

+library IAccessible2Lib

+{

+    importlib ("stdole2.tlb");

+    importlib ("oleacc.dll");

+    interface IAccessible2;

+    interface IAccessible2_2;

+    interface IAccessibleAction;

+    interface IAccessibleApplication;

+    interface IAccessibleComponent;

+    interface IAccessibleDocument;

+    interface IAccessibleEditableText;

+    interface IAccessibleHyperlink;

+    interface IAccessibleHypertext;

+    interface IAccessibleHypertext2;

+    interface IAccessibleImage;

+    interface IAccessibleRelation;

+    interface IAccessibleTable;

+    interface IAccessibleTable2;

+    interface IAccessibleTableCell;

+    interface IAccessibleText;

+    interface IAccessibleText2;

+    interface IAccessibleValue;

+    enum IA2CoordinateType;

+    enum IA2EventID;

+    enum IA2Role;

+    enum IA2ScrollType;

+    enum IA2States;

+    enum IA2TableModelChangeType;

+    enum IA2TextBoundaryType;

+    enum IA2TextSpecialOffsets;

+}

diff --git a/main/winaccessibility/source/UAccCOMIDL/makefile.mk b/main/winaccessibility/source/UAccCOMIDL/makefile.mk
new file mode 100644
index 0000000..6d712a8
--- /dev/null
+++ b/main/winaccessibility/source/UAccCOMIDL/makefile.mk
@@ -0,0 +1,101 @@
+#**************************************************************
+#  
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+#**************************************************************
+
+PRJ=..$/..
+PRJNAME=winaccessibility
+TARGET=UAccComIDL
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :	settings.mk
+
+.IF "$(GUI)" == "WNT"
+
+# --- Targets ----------------------------------
+
+ALL : $(MISC)$/ia2_api_all \
+	  $(MISC)$/AccessibleKeyBinding \
+	  $(MISC)$/AccessibleKeyStroke \
+	  $(MISC)$/Charset \
+	  $(MISC)$/defines \
+	  $(MISC)$/UAccCOM
+
+MTL=midl.exe
+MTL_PROJ=
+
+SOURCE=AccessibleKeyBinding.idl
+SOURCE1=AccessibleKeyStroke.idl
+SOURCE2=Charset.idl
+SOURCE3=defines.idl
+SOURCE4=UAccCOM.idl
+SOURCE5=ia2_api_all.idl
+
+MTL_SWITCHES=-tlb $(MISC)$/AccessibleKeyBinding.tlb -h $(MISC)$/AccessibleKeyBinding.h -iid $(MISC)$/AccessibleKeyBinding_i.c -proxy $(MISC)$/AccessibleKeyBinding_p.c -Oicf
+MTL_SWITCHES1=-tlb $(MISC)$/AccessibleKeyStroke.tlb -h $(MISC)$/AccessibleKeyStroke.h -iid $(MISC)$/AccessibleKeyStroke_i.c -proxy $(MISC)$/AccessibleKeyStroke_p.c -Oicf
+MTL_SWITCHES2=-tlb $(MISC)$/Charset.tlb -h $(MISC)$/Charset.h -iid $(MISC)$/Charset_i.c -proxy $(MISC)$/Charset_p.c -Oicf
+MTL_SWITCHES3=-tlb $(MISC)$/defines.tlb -h $(MISC)$/defines.h -iid $(MISC)$/defines_i.c -proxy $(MISC)$/defines_p.c -Oicf
+MTL_SWITCHES4=-tlb $(MISC)$/UAccCOM.tlb -h $(MISC)$/UAccCOM.h -iid $(MISC)$/UAccCOM_i.c -proxy $(MISC)$/UAccCOM_p.c -Oicf
+MTL_SWITCHES5=-tlb $(MISC)$/ia2_api_all.tlb -h $(MISC)$/ia2_api_all.h -iid $(MISC)$/ia2_api_all_i.c -proxy $(MISC)$/ia2_api_all_p.c -Oicf
+
+.IF "$(COM)"=="GCC"
+
+MTL_SWITCHESCOMMON=-cpp_cmd gcc -cpp_opt "-x c -E -D__stdcall= -D_stdcall= -nostdinc -I $(shell @cygpath -w $(PSDK_HOME)/include)"
+MTL_SWITCHES+=MTL_SWITCHESCOMMON
+MTL_SWITCHES1+=MTL_SWITCHESCOMMON
+MTL_SWITCHES2+=MTL_SWITCHESCOMMON
+MTL_SWITCHES3+=MTL_SWITCHESCOMMON
+MTL_SWITCHES4+=MTL_SWITCHESCOMMON
+MTL_SWITCHES5+=MTL_SWITCHESCOMMON
+
+$(MISC)$/AccessibleKeyBinding : $(SOURCE) 
+	$(MTL) $(MTL_SWITCHES) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE) 
+$(MISC)$/AccessibleKeyStroke : $(SOURCE1) 
+	$(MTL) $(MTL_SWITCHES1) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE1) 
+$(MISC)$/Charset : $(SOURCE2) 
+	$(MTL) $(MTL_SWITCHES2) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE2)
+$(MISC)$/defines : $(SOURCE3) 
+	$(MTL) $(MTL_SWITCHES3) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE3)
+$(MISC)$/UAccCOM : $(SOURCE4) 
+	$(MTL) $(MTL_SWITCHES4) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE4)
+$(MISC)$/ia2_api_all : $(SOURCE5) 
+	$(MTL) $(MTL_SWITCHES5) -I $(shell @cygpath -w $(PSDK_HOME)/include|sed 's#\\#\\\\#g') $(SOURCE5)
+
+.ELSE
+
+
+$(MISC)$/AccessibleKeyBinding : $(SOURCE)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES) $(INCLUDE) $(SOURCE) && $(TOUCH) $@
+$(MISC)$/AccessibleKeyStroke : $(SOURCE1)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES1) $(INCLUDE) $(SOURCE1) && $(TOUCH) $@
+$(MISC)$/Charset : $(SOURCE2)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES2) $(INCLUDE) $(SOURCE2) && $(TOUCH) $@
+$(MISC)$/defines : $(SOURCE3)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES3) $(INCLUDE) $(SOURCE3) && $(TOUCH) $@
+$(MISC)$/UAccCOM : $(SOURCE4)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES4) $(INCLUDE) $(SOURCE4) && $(TOUCH) $@
+$(MISC)$/ia2_api_all : $(SOURCE5)
+	$(WRAPCMD) $(MTL) $(MTL_SWITCHES5) $(INCLUDE) $(SOURCE5) && $(TOUCH) $@
+.ENDIF
+
+.ENDIF
+
+.INCLUDE : target.mk
+
diff --git a/main/winaccessibility/source/service/AccComponentEventListener.cxx b/main/winaccessibility/source/service/AccComponentEventListener.cxx
new file mode 100644
index 0000000..97b5456
--- /dev/null
+++ b/main/winaccessibility/source/service/AccComponentEventListener.cxx
@@ -0,0 +1,336 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccComponentEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccComponentEventListener::AccComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccEventListener(pAcc, Agent)
+{
+}

+

+AccComponentEventListener::~AccComponentEventListener()
+{

+}
+
+/**
+ * Uno's event notifier when event is captured
+ *
+ * @param	AccessibleEventObject	the event object which contains information about event
+ */
+void  AccComponentEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::VALUE_CHANGED:
+        handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::ACTION_CHANGED:
+        handleActionChangedEvent();
+        break;
+    case AccessibleEventId::TEXT_CHANGED:
+        handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::CARET_CHANGED:
+        handleCaretChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::VISIBLE_DATA_CHANGED:
+        handleVisibleDataChangedEvent();
+        break;
+    case AccessibleEventId::BOUNDRECT_CHANGED:
+        handleBoundrectChangedEvent();
+        break;
+    case AccessibleEventId::SELECTION_CHANGED:
+        handleSelectionChangedEvent();
+        break;
+        //to add TEXT_SELECTION_CHANGED event
+    case AccessibleEventId::TEXT_SELECTION_CHANGED:
+        handleTextSelectionChangedEvent();
+        break;
+        //End
+    default:
+        AccEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ * handle the VALUE_CHANGED event
+ *
+ * @param	oldValue	the old value of the source of event
+ * @param	newValue	the new value of the source of event
+ */
+void AccComponentEventListener::handleValueChangedEvent(Any oldValue, Any newValue)
+{
+    pAgent->UpdateValue(pAccessible);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);
+}
+
+/**
+ * handle the NAME_CHANGED event
+ */
+void AccComponentEventListener::handleActionChangedEvent()
+{
+    pAgent->UpdateAction(pAccessible);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_DEFACTIONCHANGE, pAccessible);
+}
+
+/**
+ * handle the TEXT_CHANGED event
+ *
+ * @param	oldValue	the old value of the source of event
+ * @param	newValue	the new value of the source of event
+ */
+void AccComponentEventListener::handleTextChangedEvent(Any oldValue, Any newValue)
+{
+    pAgent->UpdateValue(pAccessible, newValue);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);
+}
+
+/**
+ * handle the CARET_CHANGED event
+ *
+ * @param	oldValue	the old value of the source of event
+ * @param	newValue	the new value of the source of event
+ */
+void AccComponentEventListener::handleCaretChangedEvent(Any oldValue, Any newValue)
+{
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_CARETCHANGE, pAccessible);
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccComponentEventListener::handleVisibleDataChangedEvent()
+{
+    AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccComponentEventListener::handleBoundrectChangedEvent()
+{
+    AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ * set the new state and fire the MSAA event
+ *
+ * @param	state	new state id
+ * @param	enable	true if state is set, false if state is unset
+ */
+void AccComponentEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::CHECKED:
+    case AccessibleStateType::PRESSED:
+    case AccessibleStateType::SELECTED:
+    case AccessibleStateType::ARMED:
+    case AccessibleStateType::INDETERMINATE:
+    case AccessibleStateType::SHOWING:
+        fireStatePropertyChange(state, enable);
+        break;
+    case AccessibleStateType::VISIBLE:
+        if (getRole() == AccessibleRole::MENU_ITEM)
+        {
+            if(enable)
+            {
+                pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE);
+                pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+            }
+            else
+            {
+                pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE);
+                pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+            }
+        }
+        else
+        {
+            fireStatePropertyChange(state, enable);
+        }
+        break;
+        break;
+    case AccessibleStateType::FOCUSED:
+        fireStateFocusdChange(enable);
+        break;
+    case AccessibleStateType::ENABLED:
+        if(enable)
+        {
+            pAgent->UpdateState(pAccessible);
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+            // 8. label should have no FOCUSABLE state state, Firefox has READONLY state, we can also have.
+			if( getRole() != AccessibleRole::LABEL
+				&& getRole() != AccessibleRole::SCROLL_BAR) //IAccessibility2 Implementation 2009

+                pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+        }
+        else
+        {
+            pAgent->UpdateState(pAccessible);
+            pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC);
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);
+        }
+        break;
+    case AccessibleStateType::ACTIVE:
+        // Only frames should be active
+        // no msaa state mapping
+        break;
+    default:
+        break;
+    }
+}
+
+/**
+ * fire the MSAA state changed event
+ *
+ * @param	state	the state id
+ * @param	set		true if state is set, false if state is unset
+ */
+void AccComponentEventListener::fireStatePropertyChange(short state, bool set)
+{
+    if( set)
+        {
+            // new value
+            switch(state)
+            {
+            case AccessibleStateType::CHECKED:
+            case AccessibleStateType::INDETERMINATE:
+                pAgent->IncreaseState( pAccessible, state);
+                pAgent->UpdateAction( pAccessible );
+
+                if(!pAgent->IsSpecialToolboItem(pAccessible))
+                {
+                    pAgent->NotifyAccEvent(UM_EVENT_STATE_CHECKED, pAccessible);
+                }
+                break;
+            case AccessibleStateType::PRESSED:
+                pAgent->IncreaseState( pAccessible, state);
+                pAgent->NotifyAccEvent(UM_EVENT_STATE_PRESSED, pAccessible);
+                break;
+            case AccessibleStateType::SELECTED:
+                pAgent->IncreaseState( pAccessible, state);
+                break;
+            case AccessibleStateType::ARMED:
+                pAgent->IncreaseState( pAccessible, state);
+                pAgent->NotifyAccEvent(UM_EVENT_STATE_ARMED, pAccessible);
+                break;
+            case AccessibleStateType::SHOWING:
+                pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+                // UNO !SHOWING == MSAA OFFSCREEN
+                pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );
+                break;
+            case AccessibleStateType::VISIBLE:
+                // UNO !VISIBLE == MSAA INVISIBLE
+                pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+                break;
+            default:
+                break;
+            }
+        }
+    else
+    {
+        // old value
+        switch(state)
+        {
+        case AccessibleStateType::CHECKED:
+        case AccessibleStateType::INDETERMINATE:
+            pAgent->DecreaseState( pAccessible, state );
+            pAgent->UpdateAction( pAccessible );
+
+            if(!pAgent->IsSpecialToolboItem(pAccessible))
+            {
+                pAgent->NotifyAccEvent(UM_EVENT_STATE_CHECKED, pAccessible);
+            }
+            break;
+        case AccessibleStateType::PRESSED:
+            pAgent->DecreaseState( pAccessible, state );
+            pAgent->NotifyAccEvent(UM_EVENT_STATE_PRESSED, pAccessible);
+            break;
+        case AccessibleStateType::SELECTED:
+            pAgent->DecreaseState( pAccessible, state );
+            //if the state is unset, no need to send MSAA SELECTION event
+            //pAgent->NotifyAccEvent(UM_EVENT_STATE_SELECTED, pAccessible);
+            break;
+        case AccessibleStateType::ARMED:
+            {
+                pAgent->DecreaseState( pAccessible, state);
+                //if the state is unset, no need to send MSAA MENU event
+                //pAgent->NotifyAccEvent(UM_EVENT_STATE_ARMED, pAccessible);
+            }
+            break;
+        case AccessibleStateType::SHOWING:
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);
+            // UNO !SHOWING == MSAA OFFSCREEN
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );
+            break;
+        case AccessibleStateType::VISIBLE:
+            // UNO !VISIBLE == MSAA INVISIBLE
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+            break;
+
+        default:
+            break;
+        }
+    }
+}
+
+/**
+ * handle the focused event
+ *
+ * @param	enable	true if get focus, false if lose focus
+ */
+void AccComponentEventListener::fireStateFocusdChange(bool enable)
+{
+    if(enable)
+    {
+        if(getParentRole() != AccessibleRole::COMBO_BOX )
+            pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+    }
+    else
+    {
+        //if lose focus, no need to send MSAA FOCUS event
+        pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);
+    }
+}
+
+void AccComponentEventListener::handleSelectionChangedEvent()
+{
+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+}
+
+//add TEXT_SELECTION_CHANGED event
+void AccComponentEventListener::handleTextSelectionChangedEvent()
+{
+    pAgent->NotifyAccEvent(UM_EVENT_TEXT_SELECTION_CHANGED, pAccessible);
+}
diff --git a/main/winaccessibility/source/service/AccContainerEventListener.cxx b/main/winaccessibility/source/service/AccContainerEventListener.cxx
new file mode 100644
index 0000000..0a84db1
--- /dev/null
+++ b/main/winaccessibility/source/service/AccContainerEventListener.cxx
@@ -0,0 +1,573 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>

+#include <com/sun/star/accessibility/AccessibleStateType.hpp>

+#include <com/sun/star/accessibility/AccessibleEventId.hpp>

+#include <com/sun/star/accessibility/AccessibleRole.hpp>

+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>

+

+#include "AccContainerEventListener.hxx"

+#include "AccObjectManagerAgent.hxx"

+#include "unomsaaevent.hxx"

+

+using namespace com::sun::star::uno;

+using namespace com::sun::star::accessibility;

+

+AccContainerEventListener::AccContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)

+        :AccEventListener(pAcc, Agent)

+{

+}

+

+AccContainerEventListener::~AccContainerEventListener()

+{

+}

+

+/**

+ *	Uno's event notifier when event is captured

+ *

+ *	@param AccessibleEventObject	the event object which contains information about event

+ */

+void  AccContainerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )

+throw (::com::sun::star::uno::RuntimeException)

+{

+    short role = getRole();

+    switch (aEvent.EventId)

+    {

+    case AccessibleEventId::CHILD:

+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::SELECTION_CHANGED:

+        handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::INVALIDATE_ALL_CHILDREN:

+        handleAllChildrenChangedEvent();

+        break;

+    case AccessibleEventId::TEXT_CHANGED:

+        handleTextChangedEvent(aEvent.OldValue, aEvent.NewValue);

+    case AccessibleEventId::VISIBLE_DATA_CHANGED:

+        handleVisibleDataChangedEvent();

+        break;

+    case AccessibleEventId::BOUNDRECT_CHANGED:

+        handleBoundrectChangedEvent();

+        break;

+    case AccessibleEventId::STATE_CHANGED:

+        handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::VALUE_CHANGED:

+        handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::SELECTION_CHANGED_ADD:

+       	handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue);

+       	break;

+    case AccessibleEventId::SELECTION_CHANGED_REMOVE:

+        handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::SELECTION_CHANGED_WITHIN:

+        handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::PAGE_CHANGED:

+        handlePageChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::SECTION_CHANGED:

+        handleSectionChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    case AccessibleEventId::COLUMN_CHANGED:

+        handleColumnChangedEvent(aEvent.OldValue, aEvent.NewValue);

+        break;

+    default:

+        AccEventListener::notifyEvent(aEvent);

+        break;

+    }

+}

+

+/**

+ *	handle the VISIBLE_DATA_CHANGED event

+ */

+void AccContainerEventListener::handleVisibleDataChangedEvent()

+{

+    AccEventListener::handleVisibleDataChangedEvent();

+}

+

+/**

+ *	handle the BOUNDRECT_CHANGED event

+ */

+void AccContainerEventListener::handleBoundrectChangedEvent()

+{

+    AccEventListener::handleBoundrectChangedEvent();

+}

+

+void AccContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue)

+{

+    short State;

+    if( newValue >>= State)

+    {

+        setComponentState( State,true);

+    }

+    else if (oldValue >>= State)

+    {

+        setComponentState( State,false);

+    }

+

+}

+

+/**

+ * handle the CHILD event

+ * @param	oldValue	the child to be deleted

+ * @param	newValue	the child to be added

+ */

+void AccContainerEventListener::handleChildChangedEvent(Any oldValue, Any newValue)

+{

+    Reference< XAccessible > xChild;

+    if( newValue >>= xChild)

+    {

+        //create a new child

+        if(xChild.is())

+        {

+            XAccessible* pAcc = xChild.get();

+            //add this child

+

+            if(pAgent->InsertAccObj( pAcc,pAccessible))

+            {

+                //add all oldValue's existing children

+                pAgent->InsertChildrenAccObj(pAcc);

+                pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);

+            }

+        }

+        else

+        {}

+    }

+    else if (oldValue >>= xChild)

+    {

+        //delete a existing child

+        if(xChild.is())

+        {

+            XAccessible* pAcc = xChild.get();

+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);

+            //delete all oldValue's existing children

+            pAgent->DeleteChildrenAccObj( pAcc );

+            //delete this child

+            pAgent->DeleteAccObj( pAcc );

+

+        }

+        else

+        {}

+    }

+

+}

+

+/**

+ * handle the SELECTION_CHANGED event

+ * @param	oldValue	the old value of the source of event

+ * @param	newValue	the new value of the source of event

+ */

+void AccContainerEventListener::handleSelectionChangedEvent(const Any& /*oldValue*/, const Any& newValue)

+{

+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED,newValue))

+    {

+        return ;

+    }

+

+    //menu bar does not process selection change event,just same as word behavior

+    if(getRole()!=AccessibleRole::MENU_BAR)

+        pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);

+}

+

+/**

+ *	handle the INVALIDATE_ALL_CHILDREN event

+ */

+void AccContainerEventListener::handleAllChildrenChangedEvent()

+{

+    //TODO: update all the children

+    if( pAccessible )

+    {

+        //delete all oldValue's existing children

+        pAgent->DeleteChildrenAccObj( pAccessible );

+        //add all oldValue's existing children

+        pAgent->InsertChildrenAccObj( pAccessible );

+        pAgent->NotifyAccEvent(UM_EVENT_OBJECT_REORDER , pAccessible);

+    }

+}

+

+/**

+ *	handle the TEXT_CHANGED event

+ */

+void AccContainerEventListener::handleTextChangedEvent(Any oldValue, Any newValue)

+{

+    pAgent->UpdateValue(pAccessible, newValue);

+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_TEXTCHANGE, pAccessible);

+}

+

+/**

+ * set the new state and fire the MSAA event

+ * @param	state	new state id

+ * @param	enable	true if state is set, false if state is unset

+ */

+void AccContainerEventListener::setComponentState(short state, bool enable )

+{

+    // only the following state can be fired state event.

+

+    switch (state)

+    {

+    case AccessibleStateType::SELECTED:

+    case AccessibleStateType::BUSY:

+    case AccessibleStateType::INDETERMINATE:

+    case AccessibleStateType::OFFSCREEN:

+    case AccessibleStateType::FOCUSABLE:

+    case AccessibleStateType::SHOWING:

+    case AccessibleStateType::VISIBLE:

+        fireStatePropertyChange(state, enable);

+        break;

+    case AccessibleStateType::FOCUSED:

+        fireStateFocusdChange(enable);

+        break;

+    case AccessibleStateType::ENABLED:

+        if(enable)

+        {

+            pAgent->DecreaseState( pAccessible, AccessibleStateType::DEFUNC);

+            pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSABLE);

+            pAgent->UpdateState(pAccessible);

+

+            UpdateAllChildrenState(pAccessible);

+        }

+        else

+        {

+            pAgent->IncreaseState( pAccessible, AccessibleStateType::DEFUNC);

+            pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSABLE);

+            pAgent->UpdateState(pAccessible);

+

+            UpdateAllChildrenState(pAccessible);

+        }

+        break;

+    case AccessibleStateType::ACTIVE:

+        // Only frames should be active

+        // no msaa state mapping

+        //for PAGE_TAB_LIST, there will be ACTIVE state, then it should be converted to FOCUSED event.

+        if(getRole() == AccessibleRole::PAGE_TAB_LIST)

+        {

+            if (!enable) /* get the active state */

+            {

+                pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);

+            }

+

+            else	/* lose the active state */

+            {

+                pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);

+            }

+        }

+        break;

+

+    case AccessibleStateType::EXPANDED:

+    case AccessibleStateType::COLLAPSE:

+    case AccessibleStateType::CHECKED:

+        {

+            pAgent->UpdateState(pAccessible);

+            pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);

+            break;

+        }

+

+    default:

+        break;

+    }

+}

+

+/**

+ * fire the MSAA state changed event

+ * @param	state	the state id

+ * @param	set		true if state is set, false if state is unset

+ */

+void AccContainerEventListener::fireStatePropertyChange(short state, bool set)

+{

+    if( set )

+	{

+		// new value

+		switch(state)

+		{

+		case AccessibleStateType::SELECTED:

+			pAgent->IncreaseState( pAccessible, state);

+			break;

+		case AccessibleStateType::INDETERMINATE:

+		case AccessibleStateType::BUSY:

+		case AccessibleStateType::FOCUSABLE:

+		case AccessibleStateType::OFFSCREEN:

+			pAgent->IncreaseState( pAccessible, state);

+			pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);

+			break;

+		case AccessibleStateType::SHOWING:

+			// UNO !SHOWING == MSAA OFFSCREEN

+			pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );

+			break;

+		case AccessibleStateType::VISIBLE:

+			// UNO !VISIBLE == MSAA INVISIBLE

+			pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );

+			break;

+		default:

+			break;

+		}

+	}

+    else

+    {

+        // old value

+        switch(state)

+        {

+        case AccessibleStateType::SELECTED:

+            pAgent->DecreaseState( pAccessible, state );

+            break;

+        case AccessibleStateType::BUSY:

+        case AccessibleStateType::INDETERMINATE:

+        case AccessibleStateType::FOCUSABLE:

+        case AccessibleStateType::OFFSCREEN:

+            pAgent->DecreaseState( pAccessible, state);

+            pAgent->NotifyAccEvent(UM_EVENT_STATE_BUSY, pAccessible);

+            break;

+        case AccessibleStateType::SHOWING:

+            // UNO !SHOWING == MSAA OFFSCREEN

+            pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );

+            break;

+        case AccessibleStateType::VISIBLE:

+            // UNO !VISIBLE == MSAA INVISIBLE

+            pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );

+            break;

+        default:

+            break;

+        }

+    }

+}

+

+/**

+ * handle the focused event

+ * @param	enable	true if get focus, false if lose focus

+ */

+void AccContainerEventListener::fireStateFocusdChange(bool enable)

+{

+    if(enable)

+    {

+        pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);

+        //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_START event should be sent

+        //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPSTART event should be sent

+        short role = getRole();

+        if(role == AccessibleRole::MENU_BAR)

+        {

+            pAgent->NotifyAccEvent(UM_EVENT_MENU_START, pAccessible);

+        }

+        else if (role == AccessibleRole::POPUP_MENU)

+            pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible);

+        //Disable the focused event on option_pane and Panel.

+        //only disable option_pane for toolbar has panel to get focus

+        else if (role == AccessibleRole::PANEL || role == AccessibleRole::OPTION_PANE )

+        {

+            //don't send focused event on PANEL & OPTION_PANE if the parent is not toolbar

+            short parentRole = getParentRole();

+            if (parentRole == AccessibleRole::TOOL_BAR 

+				|| parentRole == AccessibleRole::SCROLL_PANE // sidebar

+				|| parentRole == AccessibleRole::PANEL)	// sidebar

+                pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);

+        }

+        //to update ComboBox's description

+        else if (role == AccessibleRole::COMBO_BOX )

+        {

+            pAgent->UpdateDescription(pAccessible);

+            //for editable combobox, send focus event on only edit control,

+            bool bSendFocusOnCombobox = true;

+            //send focused event to the first text child

+            Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY);

+            if(mxContext.is())

+            {

+                Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);

+                if(mxChild.is())

+                {

+                    Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);

+                    short childrole = mxChildContext->getAccessibleRole();

+                    if (childrole == AccessibleRole::TEXT)

+                    {

+                        if (IsEditable(mxChildContext))

+                        {

+                            pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);

+                            pAgent->IncreaseState( mxChild.get(), AccessibleStateType::FOCUSED);

+                            pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, mxChild.get());

+                            bSendFocusOnCombobox = false;

+                        }

+                    }

+                }

+            }

+            if (bSendFocusOnCombobox)

+                pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);

+        }

+        else

+            pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);

+    }

+    else

+    {

+        pAgent->DecreaseState( pAccessible, AccessibleStateType::FOCUSED);

+        //if the acc role is MENU_BAR, MSAA UM_EVENT_MENU_END event should be sent

+        //if the acc role is POPUP_MENU, MSAA UM_EVENT_MENUPOPUPEND event should be sent

+        if(getRole() == AccessibleRole::MENU_BAR)

+        {

+            pAgent->NotifyAccEvent(UM_EVENT_MENU_END, pAccessible);

+        }

+        else if (getRole() == AccessibleRole::POPUP_MENU)

+        {

+            pAgent->NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible);

+        }

+    }

+}

+

+/**

+ * handle the VALUE_CHANGED event

+ *

+ * @param	oldValue	the old value of the source of event

+ * @param	newValue	the new value of the source of event

+ */

+void AccContainerEventListener::handleValueChangedEvent(Any oldValue, Any newValue)

+{

+    pAgent->UpdateValue(pAccessible);

+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pAccessible);

+}

+

+bool AccContainerEventListener::IsEditable(Reference<XAccessibleContext> xContext)

+{

+    bool ret = false;

+    Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();

+    if( !pRState.is() )

+        return false;

+

+    Sequence<short> pStates = pRState->getStates();

+    int count = pStates.getLength();

+    for( int iIndex = 0;iIndex < count;iIndex++ )

+    {

+        if(pStates[iIndex] == AccessibleStateType::EDITABLE)

+            return true;

+    }

+    return ret;

+}

+

+bool AccContainerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value)

+{

+    Reference< XAccessible > xChild;

+    if(Value >>= xChild )

+    {

+        if(xChild.is())

+        {

+            XAccessible* pAcc = xChild.get();

+            pAgent->NotifyAccEvent(nWinEvent, pAcc);

+            return true;

+        }

+    }

+    return false;

+}

+

+void AccContainerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any& newValue)

+{

+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue))

+    {

+        return ;

+    }

+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible);

+}

+void AccContainerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any& newValue)

+{

+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue))

+    {

+        return ;

+    }

+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible);

+}

+void AccContainerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any& newValue)

+{

+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue))

+    {

+        return ;

+    }

+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible);

+}

+

+void SAL_CALL AccContainerEventListener::UpdateAllChildrenState( com::sun::star::accessibility::XAccessible* pXAccessible )

+{

+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAccessible->getAccessibleContext(),UNO_QUERY);

+    if(!xContext.is())

+    {

+        return;

+    }

+    com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();

+    if(pAccessibleContext == NULL)

+    {

+        return;

+    }

+

+	if (pAgent && pAgent->IsStateManageDescendant(pXAccessible))

+	{

+		return;

+	}

+

+    int count = pAccessibleContext->getAccessibleChildCount();

+    for (int i=0;i<count;i++)

+    {

+        Reference<com::sun::star::accessibility::XAccessible> mxAccessible

+        = pAccessibleContext->getAccessibleChild(i);

+

+        com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get();

+        if(mpAccessible != NULL)

+        {

+            pAgent->UpdateState(mpAccessible);

+            UpdateAllChildrenState(mpAccessible);

+        }

+    }

+}

+

+

+void AccContainerEventListener::handlePageChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/)

+{

+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_PAGECHANGED, pAccessible);

+}

+

+void AccContainerEventListener::handleSectionChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/ )

+{

+    pAgent->NotifyAccEvent(UM_EVENT_SECTION_CHANGED, pAccessible);

+}

+

+void AccContainerEventListener::handleColumnChangedEvent(const Any& /*oldValue*/, const Any& /*newValue*/)

+{

+    pAgent->NotifyAccEvent(UM_EVENT_COLUMN_CHANGED, pAccessible);

+}

+

+//IAccessibility2 Implementation 2009-----

+void  AccContainerEventListener::handleNameChangedEvent( Any name )

+{

+	if (getRole() == AccessibleRole::COMBO_BOX)

+	{

+		Reference<XAccessibleContext> mxContext(pAccessible->getAccessibleContext(),UNO_QUERY);

+		if(mxContext.is())

+		{

+			Reference<XAccessible> mxChild = mxContext->getAccessibleChild(0);

+			if(mxChild.is())

+			{

+				Reference<XAccessibleContext> mxChildContext(mxChild->getAccessibleContext(),UNO_QUERY);

+				short childrole = mxChildContext->getAccessibleRole();

+				if (childrole == AccessibleRole::TEXT)

+				{

+					pAgent->UpdateAccName(mxChild.get(), name);

+				}

+			}

+		}

+	}

+	AccEventListener::handleNameChangedEvent(name);

+}

+//-----IAccessibility2 Implementation 2009

diff --git a/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx b/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
new file mode 100644
index 0000000..4aa9153
--- /dev/null
+++ b/main/winaccessibility/source/service/AccDescendantManagerEventListener.cxx
@@ -0,0 +1,226 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccDescendantManagerEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccDescendantManagerEventListener::AccDescendantManagerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccComponentEventListener(pAcc, Agent),
+        pActiveDescendant(NULL)
+{
+}

+

+AccDescendantManagerEventListener::~AccDescendantManagerEventListener()
+{
+}
+
+/**
+ * Uno's event notifier when event is captured
+ * @param AccessibleEventObject		the event object which contains information about event
+ */
+void  AccDescendantManagerEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::SELECTION_CHANGED:
+        handleSelectionChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::CHILD:
+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+	case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED_NOFOCUS:
+        handleChildChangedNoFocusEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::SELECTION_CHANGED_ADD:
+        handleSelectionChangedAddEvent(aEvent.OldValue, aEvent.NewValue);
+		break;
+    case AccessibleEventId::SELECTION_CHANGED_REMOVE:
+		handleSelectionChangedRemoveEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::SELECTION_CHANGED_WITHIN:
+        handleSelectionChangedWithinEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    default:
+        AccComponentEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the CHILD event
+ *  @param	oldValue	the child to be deleted
+ *  @param	newValue	the child to be added
+ */
+void AccDescendantManagerEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+
+    Reference< XAccessible > xChild;
+    if( newValue >>= xChild)
+    {
+        //create a new child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->InsertAccObj( pAcc,pAccessible);
+            pAgent->InsertChildrenAccObj(pAcc);
+
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+
+        }
+        else
+        {}
+    }
+
+    if (oldValue >>= xChild)
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+            pAgent->DeleteChildrenAccObj( pAcc );
+            pAgent->DeleteAccObj( pAcc );
+        }
+        else
+        {}
+    }
+
+}
+
+/**
+ *	handle the SELECTION_CHANGED event
+ */
+void AccDescendantManagerEventListener::handleSelectionChangedEvent(Any oldValue, Any newValue)
+{
+    bool bSend =false;
+    Reference< XAccessible > xChild;
+    if(newValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            //if the Role is the SC cell ,don't add the selected state.
+            if (pAgent->GetRole(pAcc) != AccessibleRole::TABLE_CELL)
+            {
+                pAgent->IncreaseState( pAcc, AccessibleStateType::SELECTED);
+            }
+
+            pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAcc);
+            bSend=true;
+        }
+    }
+    if(oldValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->DecreaseState( pAcc, AccessibleStateType::SELECTED);
+        }
+    }
+    if (!bSend)
+    {
+        pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+    }
+}
+
+
+void AccDescendantManagerEventListener::handleChildChangedNoFocusEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if(newValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+
+            pAgent->InsertAccObj(pAcc,pAccessible);
+            pAgent->InsertChildrenAccObj(pAcc);
+
+            pActiveDescendant= pAcc;
+        }
+    }
+    if (oldValue >>= xChild)
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->DeleteChildrenAccObj( pAcc );
+            pAgent->DeleteAccObj( pAcc );
+        }
+    }
+}
+
+bool AccDescendantManagerEventListener::NotifyChildEvent(short nWinEvent,const Any &Value)
+{
+    Reference< XAccessible > xChild;
+    if(Value >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->NotifyAccEvent(nWinEvent, pAcc);
+
+            if (pAgent && pAgent->IsStateManageDescendant(pAccessible) && ( nWinEvent == UM_EVENT_SELECTION_CHANGED_REMOVE) )
+            {
+                pAgent->DeleteAccObj( pAcc );
+            }
+            return true;
+        }
+    }
+    return false;
+}
+void AccDescendantManagerEventListener::handleSelectionChangedAddEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_ADD,newValue))
+    {
+        return ;
+    }
+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_ADD,pAccessible);
+}
+void AccDescendantManagerEventListener::handleSelectionChangedRemoveEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,newValue))
+    {
+        return ;
+    }
+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_REMOVE,pAccessible);
+}
+

+void AccDescendantManagerEventListener::handleSelectionChangedWithinEvent(const Any& /*oldValue*/, const Any &newValue)
+{
+    if(NotifyChildEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,newValue))
+    {
+        return ;
+    }
+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED_WITHIN,pAccessible);
+}
+
diff --git a/main/winaccessibility/source/service/AccDialogEventListener.cxx b/main/winaccessibility/source/service/AccDialogEventListener.cxx
new file mode 100644
index 0000000..df1f816
--- /dev/null
+++ b/main/winaccessibility/source/service/AccDialogEventListener.cxx
@@ -0,0 +1,150 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccDialogEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccDialogEventListener::AccDialogEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccEventListener(pAcc, Agent)
+{}
+AccDialogEventListener::~AccDialogEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccDialogEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::CHILD:
+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::VISIBLE_DATA_CHANGED:
+        handleVisibleDataChangedEvent();
+        break;
+    case AccessibleEventId::BOUNDRECT_CHANGED:
+        handleBoundrectChangedEvent();
+        break;
+    default:
+        AccEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccDialogEventListener::handleVisibleDataChangedEvent()
+{
+    AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccDialogEventListener::handleBoundrectChangedEvent()
+{
+    AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ *	handle the CHILD event
+ * @param	oldValue	the child to be deleted
+ * @param	newValue	the child to be added
+ */
+void AccDialogEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if( newValue >>= xChild)
+    {
+        //create a new child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            //add this child
+            pAgent->InsertAccObj( pAcc,pAccessible);
+            //add all oldValue's existing children
+            pAgent->InsertChildrenAccObj(pAcc);
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+        }
+        else
+        {}
+    }
+    else if (oldValue >>= xChild)
+    {
+        //delete a existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+            //delete all oldValue's existing children
+            pAgent->DeleteChildrenAccObj( pAcc );
+            //delete this child
+            pAgent->DeleteAccObj( pAcc );
+        }
+        else
+        {}
+    }
+
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param state	new state id
+ *	@param enable	true if state is set, false if state is unset
+ */
+void AccDialogEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::ICONIFIED:
+        // no msaa state mapping
+        break;
+    case AccessibleStateType::VISIBLE:
+        // UNO !VISIBLE == MSAA INVISIBLE
+        if( enable )
+            pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        else
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        break;
+    case AccessibleStateType::ACTIVE:
+        // Only frames should be active
+        // no msaa state mapping
+        break;
+    default:
+        break;
+    }
+}
diff --git a/main/winaccessibility/source/service/AccEventListener.cxx b/main/winaccessibility/source/service/AccEventListener.cxx
new file mode 100644
index 0000000..e348c56
--- /dev/null
+++ b/main/winaccessibility/source/service/AccEventListener.cxx
@@ -0,0 +1,309 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <cppuhelper/bootstrap.hxx>
+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <toolkit/awt/Vclxwindow.hxx>
+
+#ifndef _SV_SYSDATA_HXX
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+typedef sal_Int32 HWND;
+#endif
+#endif
+#include "AccEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+
+#include <stdio.h>
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+using namespace rtl;
+using namespace cppu;
+
+AccEventListener::AccEventListener(com::sun::star::accessibility::XAccessible* pAcc,
+                                   AccObjectManagerAgent* Agent)
+        :pAccessible(pAcc),
+        pAgent(Agent),
+        m_isDisposed(false),
+        m_refcount(0)
+{}
+
+AccEventListener::~AccEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::NAME_CHANGED:
+        handleNameChangedEvent(aEvent.NewValue);
+        break;
+    case AccessibleEventId::DESCRIPTION_CHANGED:
+        handleDescriptionChangedEvent(aEvent.NewValue);
+        break;
+    case AccessibleEventId::STATE_CHANGED:
+        handleStateChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    default:
+        break;
+    }
+}
+
+/**
+ *	handle the NAME_CHANGED event
+ *	@param	name		the new name with changed.
+ */
+void AccEventListener::handleNameChangedEvent(Any name)
+{
+    if ( pAgent->IsTopWinAcc( pAccessible ) )
+    {
+        XAccessible* pAccDoc = pAgent->GetAccDocByAccTopWin( pAccessible );
+        if ( pAccDoc )
+        {
+            pAgent->UpdateAccName(pAccDoc);
+            pAgent->NotifyAccEvent(UM_EVENT_OBJECT_NAMECHANGE, pAccDoc);
+        }
+    }
+
+    pAgent->UpdateAccName(pAccessible, name);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_NAMECHANGE, pAccessible);
+}
+
+/**
+ *	handle the DESCRIPTION_CHANGED event
+ *	@param	desc		the new description
+ */
+void AccEventListener::handleDescriptionChangedEvent(Any desc)
+{
+    pAgent->UpdateDescription(pAccessible, desc);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_DESCRIPTIONCHANGE, pAccessible);
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccEventListener::handleBoundrectChangedEvent()
+{
+    pAgent->UpdateLocation(pAccessible);
+    pAgent->NotifyAccEvent(UM_EVENT_BOUNDRECT_CHANGED, pAccessible);
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccEventListener::handleVisibleDataChangedEvent()
+{
+    pAgent->UpdateValue(pAccessible);
+    pAgent->NotifyAccEvent(UM_EVENT_VISIBLE_DATA_CHANGED, pAccessible);
+}
+
+/**
+ *	handle the STATE_CHANGED event
+ *  @param	oldValue	the old state of the source of event
+ *  @param	newValue	the new state of the source of event
+ */
+void AccEventListener::handleStateChangedEvent(Any oldValue, Any newValue)
+{
+    short newV, oldV;
+    if( newValue >>= newV)
+    {
+        setComponentState(newV, true);
+    }
+    else if (oldValue >>= oldV)
+    {
+        setComponentState(oldV, false);
+    }
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param	state		new state id
+ *	@param	enable		true if state is set, false if state is unset
+ */
+void AccEventListener::setComponentState(short state, bool enable )
+{
+    switch (state)
+    {
+    case AccessibleStateType::FOCUSED:
+        fireStateFocusdChange(enable);
+        break;
+    default:
+        fireStatePropertyChange(state, enable);
+        break;
+    }
+}
+
+/**
+ *	handle the focused event
+ *	@param enable	true if get focus, false if lose focus
+ */
+void AccEventListener::fireStateFocusdChange(bool enable)
+{
+    if(enable)
+    {
+        pAgent->IncreaseState( pAccessible, AccessibleStateType::FOCUSED);
+        pAgent->NotifyAccEvent(UM_EVENT_STATE_FOCUSED, pAccessible);
+    }
+    else
+    {
+        // no focus lost event in MSAA
+    }
+}
+
+
+/**
+ *	fire the MSAA state changed event
+ *	@param state	the state id
+ *	@param set		true if state is set, false if state is unset
+ */
+void AccEventListener::fireStatePropertyChange(short state, bool set )
+{
+    if( set )
+    {
+        //get new state
+    }
+    else
+    {
+        //lose old state
+    }
+}
+
+/**
+ *	get the role of accessible object which is observed
+ */
+short AccEventListener::getRole()
+{
+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+    if(xContext.is())
+    {
+        return xContext->getAccessibleRole();
+    }
+    return -1;
+}
+
+/**
+ *	get the role of accessible parent object which is observed
+ */
+short AccEventListener::getParentRole()
+{
+    if(pAccessible)
+    {
+        return pAgent->GetParentRole(pAccessible);
+    }
+    return -1;
+}
+/**
+ *	remove the listener from accessible object
+ */
+void AccEventListener::removeMeFromBroadcaster()
+{
+    try
+    {
+        vos::OGuard aGuard(aRemoveMutex);
+        if(m_isDisposed)
+            return;
+        //get accessible context
+        Reference< XAccessibleContext > pRContext;
+        XAccessibleContext* pContext =NULL;
+
+        if( pAccessible == NULL)
+        {
+            return;
+        }
+        pRContext = pAccessible->getAccessibleContext();
+        if( !pRContext.is() )
+        {
+            return;
+        }
+
+        //get broadcaster from accessible component
+        Reference<XAccessibleComponent> xComponent(pRContext,UNO_QUERY);
+        if(!xComponent.is())
+        {
+            return;
+        }
+        Reference<XAccessibleEventBroadcaster> broadcaster(xComponent,UNO_QUERY);
+        XAccessibleEventBroadcaster* pBroadcaster = broadcaster.get();
+        if (pBroadcaster != NULL)
+        {
+            //remove the lister from accessible object
+            pBroadcaster->removeEventListener(this);
+            m_isDisposed = true;
+            pAgent->NotifyDestroy(pAccessible);
+        }
+    }
+    catch(...)
+    {
+        return;
+    }
+
+}
+
+/**
+ *	this method is invoked before listener is disposed
+ */
+void AccEventListener::disposing( const ::com::sun::star::lang::EventObject& Source )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    removeMeFromBroadcaster();
+}
+
+//need to investigate further
+::com::sun::star::uno::Any SAL_CALL AccEventListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)
+{
+    if(aType.equals(::getCppuType( (Reference< com::sun::star::accessibility::XAccessibleEventListener> const *)0 ) ))
+    {
+        Reference< com::sun::star::accessibility::XAccessibleEventListener> xEventListener( static_cast< com::sun::star::accessibility::XAccessibleEventListener* >(this));
+        return makeAny(xEventListener);
+    }
+
+    return Any();
+}
+
+void AccEventListener::acquire(  ) throw ()
+{
+    ::osl_incrementInterlockedCount( &m_refcount );
+}
+
+void AccEventListener::release() throw ()
+{
+    // thread-safe decrementation of reference count
+    if (0 == ::osl_decrementInterlockedCount( &m_refcount ))
+    {
+        delete this; // shutdown this object
+    }
+}
diff --git a/main/winaccessibility/source/service/AccFrameEventListener.cxx b/main/winaccessibility/source/service/AccFrameEventListener.cxx
new file mode 100644
index 0000000..a978874
--- /dev/null
+++ b/main/winaccessibility/source/service/AccFrameEventListener.cxx
@@ -0,0 +1,173 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccFrameEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+#include <vcl/window.hxx>
+#include <toolkit/awt/Vclxwindow.hxx>
+
+#ifndef _SV_SYSDATA_HXX
+#if defined( WIN ) || defined( WNT ) || defined( OS2 )
+typedef sal_Int32 HWND;
+typedef sal_Int32 HMENU;
+typedef sal_Int32 HDC;
+typedef void *PVOID;

+typedef PVOID HANDLE;

+typedef HANDLE HFONT;

+#endif
+#include <vcl/sysdata.hxx>
+#endif
+
+
+AccFrameEventListener::AccFrameEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccEventListener(pAcc, Agent)
+{
+}

+

+AccFrameEventListener::~AccFrameEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccFrameEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::CHILD:
+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::VISIBLE_DATA_CHANGED:
+        handleVisibleDataChangedEvent();
+        break;
+    case AccessibleEventId::BOUNDRECT_CHANGED:
+        handleBoundrectChangedEvent();
+        break;
+    default:
+        AccEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccFrameEventListener::handleVisibleDataChangedEvent()
+{
+    AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccFrameEventListener::handleBoundrectChangedEvent()
+{
+    AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ *	handle the CHILD event
+ *  @param	oldValue	the child to be deleted
+ *  @param	newValue	the child to be added
+ */
+void AccFrameEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if( newValue >>= xChild)
+    {
+        //create a new child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+
+            VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;
+            Window* window = pvclwindow->GetWindow();
+            const SystemEnvData* systemdata=window->GetSystemData();
+
+            //add this child
+            pAgent->InsertAccObj( pAcc,pAccessible,(HWND)systemdata->hWnd);
+            //add all oldValue's existing children
+            pAgent->InsertChildrenAccObj(pAcc);
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+        }
+        else
+        {}
+    }
+    else if (oldValue >>= xChild)
+    {
+        //delete a existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+            //delete all oldValue's existing children
+            pAgent->DeleteChildrenAccObj( pAcc );
+            //delete this child
+            pAgent->DeleteAccObj( pAcc );
+        }
+        else
+        {}
+    }
+
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param state	new state id
+ *	@param enable	true if state is set, false if state is unset
+ */
+void AccFrameEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::ICONIFIED:
+        // no msaa state
+        break;
+    case AccessibleStateType::VISIBLE:
+        // UNO !VISIBLE == MSAA INVISIBLE
+        if( enable )
+            pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        else
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        break;
+    case AccessibleStateType::ACTIVE:
+        // Only frames should be active
+        // no msaa state mapping
+        break;
+    default:
+        break;
+    }
+}
diff --git a/main/winaccessibility/source/service/AccListEventListener.cxx b/main/winaccessibility/source/service/AccListEventListener.cxx
new file mode 100644
index 0000000..ef864e0
--- /dev/null
+++ b/main/winaccessibility/source/service/AccListEventListener.cxx
@@ -0,0 +1,123 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccListEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccListEventListener::AccListEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccDescendantManagerEventListener(pAcc, Agent),
+        shouldDeleteChild(true)
+{
+}

+

+AccListEventListener::~AccListEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccListEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+        handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::INVALIDATE_ALL_CHILDREN:
+        // Since List items a transient a child events are mostly used
+        // to attach/detach listeners, it is save to ignore it here
+        //TODO: investigate again
+        break;
+    case AccessibleEventId::VALUE_CHANGED:
+        handleValueChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    default:
+        AccDescendantManagerEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the ACTIVE_DESCENDANT_CHANGED event
+ *  @param	oldValue	the child to lose active
+ *  @param	newValue	the child to get active
+ */
+void AccListEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+
+    if(newValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+
+            // Valueset has cache the child item xacc,Update state if no insert obj
+            sal_Bool bHasCache = pAgent->InsertAccObj(pAcc,pAccessible);
+            if (!bHasCache)
+            {
+                pAgent->UpdateState(pAcc);
+            }
+
+            pAgent->IncreaseState( pAcc, AccessibleStateType::FOCUSED);
+
+            pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+            pActiveDescendant= pAcc;
+        }
+    }
+    if (oldValue >>= xChild)
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->DeleteAccObj( pAcc );
+        }
+    }
+}
+
+/**
+ * handle the VALUE_CHANGED event
+ *
+ * @param	oldValue	the old value of the source of event
+ * @param	newValue	the new value of the source of event
+ */
+void AccListEventListener::handleValueChangedEvent(Any oldValue, Any newValue)
+{
+    //to enable value changed event
+    if(getParentRole() == AccessibleRole::COMBO_BOX)
+    {
+        XAccessible* pParentAcc = pAgent->GetParentXAccessible(pAccessible);
+        pAgent->UpdateValue(pParentAcc);
+        pAgent->NotifyAccEvent(UM_EVENT_OBJECT_VALUECHANGE, pParentAcc);
+    }
+}
diff --git a/main/winaccessibility/source/service/AccMenuEventListener.cxx b/main/winaccessibility/source/service/AccMenuEventListener.cxx
new file mode 100644
index 0000000..5e58215
--- /dev/null
+++ b/main/winaccessibility/source/service/AccMenuEventListener.cxx
@@ -0,0 +1,151 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccMenuEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccMenuEventListener::AccMenuEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccComponentEventListener(pAcc, Agent)
+{}
+AccMenuEventListener::~AccMenuEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccMenuEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::CHILD:
+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::SELECTION_CHANGED:
+        //don't need to process anything,just same as word behavior
+        //handleSelectionChangedEvent();
+        break;
+    default:
+        AccComponentEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the CHILD event
+ *	@param	oldValue	the child to be deleted
+ *	@param	newValue	the child to be added
+ */
+void AccMenuEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+
+    Reference< XAccessible > xChild;
+    if( newValue >>= xChild)
+    {
+        //create a new child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            //add this child
+            pAgent->InsertAccObj( pAcc,pAccessible);
+            //add all oldValue's existing children
+            pAgent->InsertChildrenAccObj(pAcc);
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+        }
+        else
+        {}
+    }
+    else if (oldValue >>= xChild)
+    {
+        //delete an existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+            //delete all oldValue's existing children
+            pAgent->DeleteChildrenAccObj( pAcc );
+            //delete this child
+            pAgent->DeleteAccObj( pAcc );
+        }
+        else
+        {}
+    }
+
+}
+
+/**
+ *	handle the SELECTION_CHANGED event
+ */
+void AccMenuEventListener::handleSelectionChangedEvent()
+{
+    pAgent->NotifyAccEvent(UM_EVENT_SELECTION_CHANGED, pAccessible);
+}
+
+/**
+ *	handle the Menu_popup event
+ */
+void AccMenuEventListener::fireStatePropertyChange(short state, bool set)
+{
+    if( set )
+    {
+        // new value
+        switch(state)
+        {
+            //for sub menu is popup, there is a menu selected event.
+        case AccessibleStateType::SELECTED:
+            pAgent->IncreaseState( pAccessible, state);
+
+            pAgent->UpdateChildState(pAccessible);
+            break;
+        default:
+            AccComponentEventListener::fireStatePropertyChange(state, set
+                                                                  );
+            break;
+        }
+    }
+    else
+    {
+        switch(state)
+        {
+            //for sub menu is popup, there is a menu selected event.
+        case AccessibleStateType::SELECTED:
+            pAgent->DecreaseState( pAccessible, state );
+
+            break;
+        default:
+            AccComponentEventListener::fireStatePropertyChange(state, set
+                                                                  );
+            break;
+        }
+    }
+}
diff --git a/main/winaccessibility/source/service/AccObject.cxx b/main/winaccessibility/source/service/AccObject.cxx
new file mode 100644
index 0000000..5997c05
--- /dev/null
+++ b/main/winaccessibility/source/service/AccObject.cxx
@@ -0,0 +1,1109 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include <com/sun/star/uno/Sequence.h>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleValue.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/XAccessibleText.hpp>
+
+#include <stdlib.h>
+#include <memory.h>
+#include <stdio.h>
+#include <memory.h>
+#include <algorithm>
+#include <assert.h>
+
+#include "AccObject.hxx"
+#include "AccEventListener.hxx"
+#include "UAccCOM_i.c"
+#include "AccResource.hxx"
+
+#include "act.hxx"
+
+using namespace std;
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::accessibility::AccessibleRole;
+using namespace com::sun::star::accessibility::AccessibleStateType;
+
+
+/**
+   * Constructor.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param Agent The agent kept in all listeners,it's the sole interface by which
+   *              listener communicate with windows manager.
+   * @param listener listener that registers in UNO system.
+   * @return.
+   */
+AccObject::AccObject(XAccessible* pAcc,AccObjectManagerAgent* pAgent ,AccEventListener* listener) :
+        m_pIMAcc	(NULL),
+        m_resID		(NULL),
+        m_pParantID	(NULL),
+        m_pParentObj(NULL),
+        m_accListener (listener),
+        m_bShouldDestroy(sal_False),
+        m_xAccRef( pAcc )
+{
+    sal_Bool bRet = ImplInitilizeCreateObj();
+
+    m_xAccContextRef = m_xAccRef->getAccessibleContext();
+    m_xAccActionRef = Reference< XAccessibleAction > (m_xAccContextRef,UNO_QUERY);
+    m_accRole = m_xAccContextRef -> getAccessibleRole();
+    if( m_pIMAcc )
+    {
+        m_pIMAcc->SetXAccessible((long) m_xAccRef.get());
+        m_pIMAcc->Put_XAccAgent((long)pAgent);
+        m_pIMAcc->SetDefaultAction((long)m_xAccActionRef.get());
+    }
+}
+/**
+   * Destructor.
+   * @param
+   * @return
+   */
+AccObject::~AccObject()
+{
+    m_pIMAcc = NULL;
+    m_xAccRef = NULL;
+    m_xAccActionRef = NULL;
+    m_xAccContextRef = NULL;
+}
+
+
+
+/**
+   * Insert a child element.
+   * @param pChild Child element that should be inserted into child list.
+   * @param pos Insert postion.
+   * @return
+   */
+void AccObject::InsertChild( AccObject* pChild,short pos )
+{
+
+    std::vector<AccObject*>::iterator iter;
+    iter = std::find(m_childrenList.begin(),m_childrenList.end(),pChild);
+    if(iter!=m_childrenList.end())
+        return;
+    if(LAST_CHILD==pos)
+    {
+        m_childrenList.push_back(pChild);
+    }
+    else
+    {
+        std::vector<AccObject*>::iterator iter=m_childrenList.begin()+pos;
+        m_childrenList.insert(iter,pChild);
+    }
+
+    pChild->SetParentObj(this);
+}
+
+/**
+   * Delete a child element
+   * @param pChild Child element that should be inserted into child list.
+   * @param pos Insert postion.
+   * @return
+   */
+void AccObject::DeleteChild( AccObject* pChild )
+{
+    std::vector<AccObject*>::iterator iter;
+    iter = std::find(m_childrenList.begin(),m_childrenList.end(),pChild);
+    if(iter!=m_childrenList.end())
+    {
+        m_childrenList.erase(iter);
+        if(m_pIMAcc)
+            pChild->SetParentObj(NULL);
+    }
+}
+
+/**
+   * In order to windows API WindowFromAccessibleObject,we sometimes to set a pure
+   * top window accessible object created by windows system as top ancestor.
+   * @param.
+   * @return
+   */
+void AccObject::UpdateValidWindow()
+{
+    if(m_pIMAcc)
+        m_pIMAcc->Put_XAccWindowHandle(m_pParantID);
+}
+
+/**
+   * Translate all UNO basic information into MSAA com information.
+   * @param
+   * @return If the method is correctly processed.
+   */
+sal_Bool AccObject::ImplInitilizeCreateObj()
+{
+	ActivateActContext();
+	HRESULT hr = CoCreateInstance( CLSID_MAccessible, NULL, CLSCTX_ALL ,
+                                   IID_IMAccessible,
+                                   (void **)&m_pIMAcc);
+	DeactivateActContext();
+
+    if ( S_OK != hr )
+    {
+        return sal_False;
+    }
+
+    return sal_True;
+}
+
+/**
+   * Update name property to com object.
+   * @param
+   * @return
+   */
+void  AccObject::UpdateName( )
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+
+    if( ( TEXT_FRAME == m_accRole   ) && ( m_pParentObj !=NULL )&& ( SCROLL_PANE == m_pParentObj -> m_accRole ) )
+        m_pIMAcc->Put_XAccName( m_pParentObj->m_xAccContextRef->getAccessibleName().getStr() );
+	//IAccessibility2 Implementation 2009-----
+    if ( PARAGRAPH == m_accRole)
+    {
+    	::rtl::OUString emptyStr = ::rtl::OUString::createFromAscii("");
+    	m_pIMAcc->Put_XAccName(emptyStr.getStr());
+    }
+	//-----IAccessibility2 Implementation 2009
+    else
+        m_pIMAcc->Put_XAccName(m_xAccContextRef->getAccessibleName().getStr());
+
+    return ;
+}
+/**
+   * Update description property to com object.
+   * no content for update description
+   * @param
+   * @return
+   */
+void AccObject::UpdateDescription()
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+
+    m_pIMAcc->Put_XAccDescription(m_xAccContextRef->getAccessibleDescription().getStr());
+    return ;
+}
+
+/**
+   * Update default action property to com object.
+   * @param
+   * @return
+   */
+void  AccObject::UpdateAction()
+{
+    m_xAccActionRef = Reference< XAccessibleAction > (m_xAccContextRef,UNO_QUERY);
+
+    if( m_xAccActionRef.is() && m_pIMAcc )
+    {
+        if( m_xAccActionRef->getAccessibleActionCount() > 0 )
+        {
+            UpdateDefaultAction( );
+            m_pIMAcc->SetDefaultAction((long)m_xAccActionRef.get());
+        }
+    }
+}
+
+/**
+   * Update value property to com object.
+   * @param
+   * @return
+   */
+void AccObject::UpdateValue()
+{
+    if( NULL == m_pIMAcc  || !m_xAccContextRef.is() )
+    {
+        assert(false);
+        return ;
+    }
+
+    Reference< XAccessibleValue > pRValue(m_xAccContextRef.get(),UNO_QUERY);
+    Any pAny;
+    if( pRValue.is() )
+    {
+        pAny = pRValue->getCurrentValue();
+    }
+
+    SetValue( pAny );
+}
+
+/**
+   * Set special default action description string via UNO role.
+   * @param Role UNO role
+   * @return
+   */
+void AccObject::UpdateDefaultAction( )
+{
+    if(!m_xAccActionRef.is())
+        return ;
+
+    switch(m_accRole)
+    {
+    case PUSH_BUTTON:
+    case TOGGLE_BUTTON:
+    case RADIO_BUTTON:
+    case MENU_ITEM:
+    case RADIO_MENU_ITEM:
+    case CHECK_MENU_ITEM:
+    case LIST_ITEM:
+    case CHECK_BOX:
+    case TREE_ITEM:
+    case BUTTON_DROPDOWN:
+        m_pIMAcc->Put_ActionDescription( m_xAccActionRef->getAccessibleActionDescription((sal_Int32)0).getStr() );
+        return;
+    }
+}
+
+/**
+   * Set value property via pAny.
+   * @param pAny New value.
+   * @return
+   */
+void  AccObject::SetValue( Any pAny )
+{
+    unsigned short pUNumberString[100];
+    memset( pUNumberString, 0 , sizeof( pUNumberString) );
+
+    if( NULL == m_pIMAcc || !m_xAccContextRef.is() )
+    {
+        assert(false);
+        return ;
+    }
+    Reference< XAccessibleText > pRText(m_xAccContextRef,UNO_QUERY);
+    ::rtl::OUString val;
+    int index = 0 ;
+    switch(m_accRole)
+    {
+    case SPIN_BOX:
+        // 3. date editor's msaa value should be the same as spinbox
+    case DATE_EDITOR:
+    case TEXT:
+    case PARAGRAPH:
+    case HEADING:
+
+        if(pRText.get())
+        {
+            val = pRText->getText();
+        }
+        m_pIMAcc->Put_XAccValue( val.getStr() );
+        break;
+    case TREE_ITEM:
+	//IAccessibility2 Implementation 2009-----
+    //case CHECK_BOX:	//Commented by Li Xing to disable the value for general checkbox
+    case COMBO_BOX:
+    case TABLE_CELL:
+    case NOTE:
+    case SCROLL_BAR:
+        m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() );
+        break ;
+	// Added by Li Xing, only the checkbox in tree should have the value. 
+	case CHECK_BOX:
+		if( ( m_pParentObj !=NULL ) && (TREE == m_pParentObj->m_accRole || TREE_ITEM == m_pParentObj->m_accRole ))
+	        m_pIMAcc->Put_XAccValue( GetMAccessibleValueFromAny(pAny).getStr() );
+	//-----IAccessibility2 Implementation 2009
+		break;
+    default:
+        break;
+    }
+
+    return;
+
+
+}
+::rtl::OUString AccObject::GetMAccessibleValueFromAny(Any pAny)
+{
+    ::rtl::OUString strValue;
+
+    if(NULL == m_pIMAcc)
+        return strValue;
+
+    if(pAny.getValueType() == getCppuType( (sal_uInt16 *)0 ) )
+    {
+        sal_uInt16 val;
+        if (pAny >>= val)
+        {
+            strValue=::rtl::OUString::valueOf((sal_Int32)val);
+
+        }
+    }
+    else if(pAny.getValueType() == getCppuType( (::rtl::OUString *)0 ) )
+    {
+
+        pAny >>= strValue ;
+
+    }
+    else if(pAny.getValueType() == getCppuType( (Sequence< ::rtl::OUString > *)0 ) )
+    {
+        Sequence< ::rtl::OUString > val;
+        if (pAny >>= val)
+        {
+
+            int count = val.getLength();
+
+            for( int iIndex = 0;iIndex < count;iIndex++ )
+            {
+                strValue += val[iIndex];
+            }
+
+        }
+    }
+    else if(pAny.getValueType() == getCppuType( (double *)0 ) )
+    {
+        double val;
+        if (pAny >>= val)
+        {
+            strValue=::rtl::OUString::valueOf(val);
+        }
+    }
+    else if(pAny.getValueType() == getCppuType( (sal_Int32 *)0 ) )
+    {
+        sal_Int32 val;
+        if (pAny >>= val)
+        {
+            strValue=::rtl::OUString::valueOf(val);
+        }
+    }
+    else if (pAny.getValueType() == getCppuType( (com::sun::star::accessibility::TextSegment *)0 ) )
+    {
+        com::sun::star::accessibility::TextSegment val;
+        if (pAny >>= val)
+        {
+            ::rtl::OUString realVal(val.SegmentText);
+            strValue = realVal;
+
+        }
+    }
+
+    return strValue;
+}
+/**
+   * Set name property via pAny.
+   * @param pAny New accessible name.
+   * @return
+   */
+void  AccObject::SetName( Any pAny)
+{
+    if( NULL == m_pIMAcc )
+        return ;
+
+    m_pIMAcc->Put_XAccName( GetMAccessibleValueFromAny(pAny).getStr() );
+
+}
+
+/**
+   * Set description property via pAny.
+   * @param pAny New accessible description.
+   * @return
+   */
+void  AccObject::SetDescription( Any pAny )
+{
+    if( NULL == m_pIMAcc )
+        return ;
+    m_pIMAcc->Put_XAccDescription( GetMAccessibleValueFromAny(pAny).getStr() );
+}
+
+/**
+   * Set role property via pAny
+   * @param Role New accessible role.
+   * @return
+   */
+void  AccObject::SetRole( short Role )
+{
+    if( NULL == m_pIMAcc )
+        return ;
+    m_pIMAcc->Put_XAccRole( Role );
+}
+
+/**
+* Get role property via pAny
+* @param
+* @return accessible role
+*/
+short AccObject::GetRole() const
+{
+    return m_accRole;
+}
+
+/**
+   * Get MSAA state from UNO state
+   * @Role xState UNO state.
+   * @return
+   */
+DWORD AccObject::GetMSAAStateFromUNO(short xState)
+{
+    DWORD IState = UNO_MSAA_UNMAPPING;
+
+    if( !m_xAccContextRef.is() )
+    {
+        assert(false);
+        return IState;
+    }
+    short Role = m_accRole;
+
+    switch( xState )
+    {
+    case  BUSY:
+        IState = STATE_SYSTEM_BUSY;
+        break;
+    case  CHECKED:
+        if( Role == PUSH_BUTTON || Role == TOGGLE_BUTTON )
+        {
+            IState = STATE_SYSTEM_PRESSED;
+        }
+        else
+            IState = STATE_SYSTEM_CHECKED;
+        break;
+    case  DEFUNC:
+        IState = STATE_SYSTEM_UNAVAILABLE;
+        break;
+    case  EXPANDED:
+        IState = STATE_SYSTEM_EXPANDED;
+        break;
+    case  FOCUSABLE:
+        IState = STATE_SYSTEM_FOCUSABLE;
+        break;
+    case  FOCUSED:
+        IState = STATE_SYSTEM_FOCUSED;
+        break;
+    case  INDETERMINATE:
+        IState = STATE_SYSTEM_MIXED;
+        break;
+    case  MULTI_SELECTABLE:
+        IState = STATE_SYSTEM_MULTISELECTABLE;
+        break;
+    case  PRESSED:
+        IState = STATE_SYSTEM_PRESSED;
+        break;
+    case  RESIZABLE:
+        IState = STATE_SYSTEM_SIZEABLE;
+        break;
+    case  SELECTABLE:
+        if( m_accRole == MENU || m_accRole == MENU_ITEM)
+        {
+            IState = UNO_MSAA_UNMAPPING;
+        }
+        else
+        {
+            IState = STATE_SYSTEM_SELECTABLE;
+        }
+        break;
+    case  SELECTED:
+        if( m_accRole == MENU || m_accRole == MENU_ITEM )
+        {
+            IState = UNO_MSAA_UNMAPPING;
+        }
+        else
+        {
+            IState = STATE_SYSTEM_SELECTED;
+        }
+        break;
+    case  ARMED:
+        IState = STATE_SYSTEM_FOCUSED;
+        break;
+    case  EXPANDABLE:
+        {
+            sal_Bool isExpanded = sal_True;
+            sal_Bool isExpandable = sal_True;
+            if( Role == PUSH_BUTTON || Role == TOGGLE_BUTTON  || BUTTON_DROPDOWN == Role )
+            {
+                IState = STATE_SYSTEM_HASPOPUP;
+            }
+            else
+            {
+                GetExpandedState(&isExpandable,&isExpanded);
+                if(!isExpanded)
+                    IState = STATE_SYSTEM_COLLAPSED;
+            }
+        }
+        break;
+	//Remove the SENSITIVE state mapping. There is no corresponding MSAA state. 
+    //case  SENSITIVE:
+    //    IState = STATE_SYSTEM_PROTECTED;
+    case EDITABLE:
+        if( m_pIMAcc )
+        {
+            m_pIMAcc->DecreaseState( STATE_SYSTEM_READONLY );
+        }
+        break;
+    case OFFSCREEN:
+        IState = STATE_SYSTEM_OFFSCREEN;
+        break;
+    case MOVEABLE:
+        IState = STATE_SYSTEM_MOVEABLE;
+        break;
+    case COLLAPSE:
+        IState = STATE_SYSTEM_COLLAPSED;
+        break;
+    case DEFAULT:
+        IState = STATE_SYSTEM_DEFAULT;
+        break;
+    default:
+        break;
+    }
+
+    return IState;
+}
+
+/**
+   * Decrease state of com object
+   * @param xState The lost state.
+   * @return
+   */
+void  AccObject::DecreaseState( short xState )
+{
+    if( NULL == m_pIMAcc )
+    {
+        return;
+    }
+
+    if( xState == FOCUSABLE)
+    {
+        short Role = m_accRole ;
+        if(Role == MENU_ITEM
+                || Role == RADIO_MENU_ITEM
+                || Role == CHECK_MENU_ITEM)
+            return;
+        else
+        {
+            if (Role == TOGGLE_BUTTON || Role == PUSH_BUTTON || BUTTON_DROPDOWN == Role)
+            {
+                if( ( m_pParentObj !=NULL ) && (TOOL_BAR == m_pParentObj->m_accRole ) )
+                    return;
+            }
+        }
+    }
+
+    else if( xState == AccessibleStateType::VISIBLE  )
+    {
+        m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+    }
+    else if( xState == AccessibleStateType::SHOWING )
+    {
+        m_pIMAcc->IncreaseState( STATE_SYSTEM_OFFSCREEN );
+    }
+
+    DWORD msState = GetMSAAStateFromUNO(xState);
+    if(msState!=UNO_MSAA_UNMAPPING)
+        m_pIMAcc->DecreaseState(msState);
+}
+
+/**
+   * Increase state of com object
+   * @param xState The new state.
+   * @return
+   */
+void AccObject::IncreaseState( short xState )
+{
+    if( NULL == m_pIMAcc )
+    {
+        assert(false);
+        return;
+    }
+
+
+    if( xState == AccessibleStateType::VISIBLE  )
+    {
+        m_pIMAcc->DecreaseState( STATE_SYSTEM_INVISIBLE );
+    }
+    else if( xState == AccessibleStateType::SHOWING )
+    {
+        m_pIMAcc->DecreaseState( STATE_SYSTEM_OFFSCREEN );
+    }
+
+
+    DWORD msState = GetMSAAStateFromUNO(xState);
+    if(msState!=UNO_MSAA_UNMAPPING)
+        m_pIMAcc->IncreaseState( msState );
+}
+
+/**
+   * Get next child element
+   * @param
+   * @return AccObject Object interface.
+   */
+AccObject* AccObject::NextChild()
+{
+    IAccChildList::iterator pInd = m_childrenList.begin();
+    if( pInd != m_childrenList.end() )
+        return 	*pInd;
+    return NULL;
+}
+/**
+   * update action desciption desc
+   * @param
+   * @return 
+   */
+void AccObject::UpdateActionDesc()
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+
+    ::rtl::OUString	pXString = m_xAccContextRef->getAccessibleDescription();
+    m_pIMAcc->Put_XAccDescription(pXString.getStr());
+    long Role = m_accRole;
+
+    if(  Role == PUSH_BUTTON || Role == RADIO_BUTTON || Role == MENU_ITEM ||
+            Role == LIST_ITEM || Role == CHECK_BOX || Role == TREE_ITEM ||
+            Role == CHECK_MENU_ITEM || Role == RADIO_MENU_ITEM )
+    {
+        UpdateDefaultAction(  );
+    }
+    else
+    {
+
+        if( m_xAccActionRef.is() )
+        {
+            if( m_xAccActionRef->getAccessibleActionCount() > 0 )
+            {
+				if (!(Role == SPIN_BOX || Role == COMBO_BOX || Role == DATE_EDITOR ||
+					  Role == EDIT_BAR || Role == PASSWORD_TEXT || Role == TEXT))
+				{
+					pXString = m_xAccActionRef->getAccessibleActionDescription( 0 );
+					//Solution:If string length is more than zero,action will will be set.
+					if( pXString.getLength() > 0)
+						m_pIMAcc->Put_ActionDescription( pXString.getStr() );
+				}                
+            }
+        }
+    }
+
+}
+/**
+   * update role information from uno to com
+   * @param
+   * @return 
+   */
+void AccObject::UpdateRole()
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+
+    XAccessibleContext* pContext  = m_xAccContextRef.get();
+    m_pIMAcc->Put_XAccRole( ROLE_SYSTEM_WINDOW  );
+    short iRoleIndex = pContext->getAccessibleRole();
+    if (( 0 <= iRoleIndex) && ( iRoleIndex <= (sizeof(ROLE_TABLE)/(sizeof(short)*2))))
+    {
+        short iIA2Role = ROLE_TABLE[iRoleIndex][1] ;
+        m_pIMAcc->Put_XAccRole( iIA2Role  );
+    }
+
+}
+/**
+   * update state information from uno to com
+   * @param
+   * @return 
+   */
+void AccObject::UpdateState()
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+
+    XAccessibleContext* pContext  = m_xAccContextRef.get();
+    Reference< XAccessibleStateSet > pRState = pContext->getAccessibleStateSet();
+    if( !pRState.is() )
+    {
+        assert(false);
+        return ;
+    }
+
+    m_pIMAcc->SetState(0L);
+
+    if ( m_accRole == POPUP_MENU )
+    {
+        return;
+    }
+
+    Sequence<short> pStates = pRState->getStates();
+    int count = pStates.getLength();
+
+    sal_Bool isEnable = sal_False;
+    sal_Bool isShowing = sal_False;
+    sal_Bool isEditable = sal_False;
+    sal_Bool isVisible = sal_False;
+    sal_Bool isFocusable = sal_False;
+
+    for( int iIndex = 0;iIndex < count;iIndex++ )
+    {
+        if( pStates[iIndex] == ENABLED )
+            isEnable = sal_True;
+        else if( pStates[iIndex] == SHOWING)
+            isShowing = sal_True;
+        else if( pStates[iIndex] == VISIBLE)
+            isVisible = sal_True;
+        else if( pStates[iIndex] == EDITABLE )
+            isEditable = sal_True;
+        else if (pStates[iIndex] == FOCUSABLE)
+            isFocusable = sal_True;
+        IncreaseState( pStates[iIndex]);
+    }
+    sal_Bool bIsMenuItem = m_accRole == MENU_ITEM || m_accRole == RADIO_MENU_ITEM || m_accRole == CHECK_MENU_ITEM;
+
+    if(bIsMenuItem)
+    {
+        if(!(isShowing && isVisible) )
+        {
+            m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+            m_pIMAcc->DecreaseState( STATE_SYSTEM_FOCUSABLE );
+        }
+    }
+    else
+    {
+        if(!(isShowing || isVisible) )
+            m_pIMAcc->IncreaseState( STATE_SYSTEM_INVISIBLE );
+    }
+
+    short Role = m_accRole;
+
+    if( m_pIMAcc )
+    {
+        switch(m_accRole)
+        {
+        case LABEL:
+            m_pIMAcc->IncreaseState( STATE_SYSTEM_READONLY );
+            break;
+        case TEXT:
+            // 2. editable combobox -> readonly ------ bridge
+        case EMBEDDED_OBJECT:
+        case END_NOTE:
+        case FOOTER:
+        case FOOTNOTE:
+        case GRAPHIC:
+        case HEADER:
+        case HEADING:
+
+            //Image Map
+        case PARAGRAPH:
+        case PASSWORD_TEXT:
+        case SHAPE:
+        case SPIN_BOX:
+        case TABLE:
+        case TABLE_CELL:
+        case TEXT_FRAME:
+        case DATE_EDITOR:
+        case DOCUMENT:
+        case COLUMN_HEADER:
+            {
+                if(!isEditable)
+                    m_pIMAcc->IncreaseState( STATE_SYSTEM_READONLY );
+            }
+            break;
+        default:
+            break;
+        }
+    }
+
+    if( isEnable )
+    {
+
+        if(!(Role == FILLER || Role == END_NOTE || Role == FOOTER || Role == FOOTNOTE || Role == GROUP_BOX || Role == RULER
+                || Role == HEADER || Role == ICON || Role == INTERNAL_FRAME || Role == LABEL || Role == LAYERED_PANE
+                || Role == SCROLL_BAR || Role == SCROLL_PANE || Role == SPLIT_PANE || Role == STATUS_BAR || Role == TOOL_TIP))
+        {
+            if( SEPARATOR == Role  )
+            {
+                if( ( m_pParentObj != NULL ) && ( MENU == m_pParentObj->m_accRole  || POPUP_MENU == m_pParentObj->m_accRole ))
+                    IncreaseState( FOCUSABLE );
+            }
+
+            else if (TABLE_CELL == Role || TABLE == Role || PANEL == Role || OPTION_PANE == Role ||
+                     COLUMN_HEADER == Role)
+            {
+                if (isFocusable)
+                    IncreaseState( FOCUSABLE );
+            }
+            else
+            {
+                if(bIsMenuItem)
+                {
+                    if ( isShowing && isVisible)
+                    {
+                        IncreaseState( FOCUSABLE );
+                    }
+                }
+                else
+                {
+                    IncreaseState( FOCUSABLE );
+                }
+            }
+        }
+    }
+    else
+    {
+        m_pIMAcc->IncreaseState( STATE_SYSTEM_UNAVAILABLE );
+        sal_Bool isDecreaseFocusable = sal_False;
+        if( !((Role == MENU_ITEM) ||
+                (Role == RADIO_MENU_ITEM) ||
+                (Role == CHECK_MENU_ITEM)) )
+        {
+            if  ( Role == TOGGLE_BUTTON || Role == PUSH_BUTTON || BUTTON_DROPDOWN == Role)
+            {
+                if(( m_pParentObj != NULL )&& (TOOL_BAR ==  m_pParentObj->m_accRole ) )
+                    IncreaseState( FOCUSABLE );
+                else
+                    DecreaseState( FOCUSABLE );
+            }
+            else
+                DecreaseState( FOCUSABLE );
+        }
+        else if( isShowing || isVisible )
+        {
+            IncreaseState( FOCUSABLE );
+        }
+    }
+
+    if( m_pIMAcc )
+    {
+        switch(m_accRole)
+        {
+        case POPUP_MENU:
+        case MENU:
+            if( pContext->getAccessibleChildCount() > 0 )
+                m_pIMAcc->IncreaseState( STATE_SYSTEM_HASPOPUP );
+            break;
+        case PASSWORD_TEXT:
+            m_pIMAcc->IncreaseState( STATE_SYSTEM_PROTECTED );
+            break;
+        default:
+            break;
+        }
+    }
+
+}
+/**
+   * update location information from uno to com
+   * @param
+   * @return 
+   */
+void AccObject::UpdateLocation()
+{
+    if (!m_pIMAcc)
+    {
+        return;
+    }
+    XAccessibleContext* pContext  = m_xAccContextRef.get();
+
+    Reference< XAccessibleComponent > pRComponent(pContext,UNO_QUERY);
+    if( pRComponent.is() )
+    {
+        ::com::sun::star::awt::Point pCPoint = pRComponent->getLocationOnScreen();
+        ::com::sun::star::awt::Size pCSize = pRComponent->getSize();
+        Location tempLocation;
+        tempLocation.m_dLeft = pCPoint.X;
+        tempLocation.m_dTop =  pCPoint.Y;
+        tempLocation.m_dWidth = pCSize.Width;
+        tempLocation.m_dHeight = pCSize.Height;
+        m_pIMAcc->Put_XAccLocation( tempLocation );
+    }
+
+}
+
+
+/**
+   * Public method to mapping information between MSAA and UNO.
+   * @param
+   * @return If the method is correctly processed.
+   */
+sal_Bool AccObject:: UpdateAccessibleInfoFromUnoToMSAA ( )
+{
+    if( NULL == m_pIMAcc || !m_xAccContextRef.is()  )
+    {
+        assert(false);
+        return sal_False;
+    }
+
+    UpdateName();
+
+    UpdateValue();
+
+    UpdateActionDesc();
+
+    UpdateRole();
+
+    UpdateLocation();
+
+    UpdateState();
+
+    return sal_True;
+}
+
+/*
+   * Add a child selected element.
+   * @param pAccObj Child object pointer.
+   * @return
+   */
+void AccObject::AddSelect( long index, AccObject* accObj)
+{
+    m_selectionList.insert(IAccSelectionList::value_type(index,accObj));
+}
+
+IAccSelectionList& AccObject::GetSelection()
+{
+    return m_selectionList;
+}
+
+
+/**
+   * Set self to focus object in parant child list
+   * @param
+   * @return
+   */
+void AccObject::setFocus()
+{
+    if(m_pIMAcc)
+    {
+        IncreaseState(FOCUSED);
+        m_pIMAcc->Put_XAccFocus(CHILDID_SELF);
+
+        UpdateRole();
+    }
+}
+
+/**
+   * Unset self from focus object in parant child list.
+   * @param
+   * @return
+   */
+void AccObject::unsetFocus()
+{
+    if(m_pIMAcc)
+    {
+        DecreaseState( FOCUSED );
+        m_pIMAcc->Put_XAccFocus(UACC_NO_FOCUS);
+    }
+}
+
+void AccObject::GetExpandedState( sal_Bool* isExpandable, sal_Bool* isExpanded)
+{
+    *isExpanded = sal_False;
+    *isExpandable = sal_False;
+
+    if( !m_xAccContextRef.is() )
+    {
+        return;
+    }
+    Reference< XAccessibleStateSet > pRState = m_xAccContextRef->getAccessibleStateSet();
+    if( !pRState.is() )
+    {
+        return;
+    }
+
+    Sequence<short> pStates = pRState->getStates();
+    int count = pStates.getLength();
+
+    for( int iIndex = 0;iIndex < count;iIndex++ )
+    {
+        if( EXPANDED == pStates[iIndex]  )
+        {
+            *isExpanded = sal_True;
+        }
+        else if( EXPANDABLE == pStates[iIndex]  )
+        {
+            *isExpandable = sal_True;
+        }
+    }
+}
+
+void AccObject::NotifyDestroy(sal_Bool ifDelete)
+{
+    m_bShouldDestroy=ifDelete;
+    if(m_pIMAcc)
+        m_pIMAcc->NotifyDestroy(m_bShouldDestroy);
+}
+
+void AccObject::SetParentObj(AccObject* pParentAccObj)
+{
+    m_pParentObj = pParentAccObj;
+
+    if(m_pIMAcc)
+    {
+        if(m_pParentObj)
+        {
+            m_pIMAcc->Put_XAccParent(m_pParentObj->GetIMAccessible());
+        }
+        else
+        {
+            m_pIMAcc->Put_XAccParent(NULL);
+        }
+    }
+}
+//ResID means ChildID in MSAA
+void AccObject::SetResID(long id)
+{
+    m_resID = id;
+    if(m_pIMAcc)
+        m_pIMAcc->Put_XAccChildID(m_resID);
+}
+//return COM interface in acc object
+IMAccessible*  AccObject::GetIMAccessible()
+{
+    return m_pIMAcc;
+}
+
+Reference < XAccessible > AccObject::GetXAccessible()
+{
+    return m_xAccRef;
+}
+
+void AccObject::SetParentHWND(HWND hWnd)
+{
+    m_pParantID = hWnd;
+}
+void AccObject::SetListener( AccEventListener* Listener )
+{
+    m_accListener = Listener;
+}
+AccEventListener* AccObject::getListener()
+{
+    return m_accListener;
+}
+
+long AccObject::GetResID()
+{
+    return m_resID;
+}
+
+HWND AccObject::GetParentHWND()
+{
+    return m_pParantID;
+}
+
+AccObject* AccObject::GetParentObj()
+{
+    return m_pParentObj;
+}
+sal_Bool  AccObject::ifShouldDestroy()
+{
+    return m_bShouldDestroy;
+}
diff --git a/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx b/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx
new file mode 100644
index 0000000..e5ed271
--- /dev/null
+++ b/main/winaccessibility/source/service/AccObjectContainerEventListener.cxx
@@ -0,0 +1,72 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+// AccObjectContainerEventListener.cpp: implementation of the AccContainerEventListener class.
+//
+//////////////////////////////////////////////////////////////////////
+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccObjectContainerEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccObjectContainerEventListener::AccObjectContainerEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccContainerEventListener(pAcc, Agent)
+{}
+AccObjectContainerEventListener::~AccObjectContainerEventListener()
+{
+}
+
+/**
+ *	handle the STATE_CHANGED event
+ */
+void AccObjectContainerEventListener::handleStateChangedEvent(Any oldValue, Any newValue)
+{
+    //set the accessible name before process for there is no NAME_CHANGED event when change
+    //the text in drawing objects.
+    short newV;
+    if( newValue >>= newV)
+    {
+        if (newV == AccessibleStateType::FOCUSED)
+        {
+            pAgent->UpdateAccName(pAccessible);
+
+            pAgent->UpdateDescription(pAccessible);
+        }
+    }
+    AccContainerEventListener::handleStateChangedEvent(oldValue, newValue);
+}
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ *  For SHAPES, the visiable_data_changed event should be mapped to LOCATION_CHANGED event
+  */
+void AccObjectContainerEventListener::handleVisibleDataChangedEvent()
+{
+    AccContainerEventListener::handleBoundrectChangedEvent();
+}
diff --git a/main/winaccessibility/source/service/AccObjectManagerAgent.cxx b/main/winaccessibility/source/service/AccObjectManagerAgent.cxx
new file mode 100644
index 0000000..77d2f3e
--- /dev/null
+++ b/main/winaccessibility/source/service/AccObjectManagerAgent.cxx
@@ -0,0 +1,386 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+
+#include "AccObjectManagerAgent.hxx"
+#include "AccObjectWinManager.hxx"
+
+#include "UAccCOM2.h"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+/**
+   * Construction/Destruction.
+   * @param 
+   * @return
+   */
+AccObjectManagerAgent::AccObjectManagerAgent():
+        pWinManager(NULL)
+{
+    if( pWinManager == NULL )
+    {
+        pWinManager = AccObjectWinManager::CreateAccObjectWinManagerInstance(this);
+    }
+}
+
+AccObjectManagerAgent::~AccObjectManagerAgent()
+{
+    delete pWinManager;
+    pWinManager = NULL;
+}
+
+/**
+   * Interface of updating MSAA name when UNO name_changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc )
+{
+    if( pWinManager )
+        pWinManager->UpdateAccName( pXAcc );
+}
+
+/**
+   * Interface of updating MSAA name when UNO action changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateAction( XAccessible* pXAcc )
+{
+    if( pWinManager )
+        pWinManager->UpdateAction( pXAcc );
+}
+
+/**
+   * Interface of updating MSAA value when UNO value_changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pAny New value.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc, Any pAny )
+{
+    if( pWinManager )
+        pWinManager->SetValue( pXAcc, pAny );
+}
+
+/**
+   * Interface of updating MSAA value when UNO value_changed event occurs.If we can not
+   * find new value,we'll get new value from pXAcc to update com value.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateValue( XAccessible* pXAcc )
+{
+    if( pWinManager )
+        pWinManager->UpdateValue( pXAcc );
+}
+
+/**
+   * Interface of updating MSAA name when UNO name_changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param newName New UNO accessible name.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateAccName( XAccessible* pXAcc, Any newName)
+{
+    if( pWinManager )
+        pWinManager->SetAccName( pXAcc, newName );
+}
+
+
+/**
+   * Interface of updating MSAA location when UNO location_changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pXAcc Uno The top position of new location.
+   * @param pXAcc Uno The left position of new location.
+   * @param pXAcc Uno The width of new location.
+   * @param pXAcc Uno The width of new location.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateLocation( XAccessible* /* pXAcc */, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
+{
+#ifdef _IMPL_WIN
+    if( pWinManager )
+        pWinManager->SetLocation( pXAcc, top, left, width, height );
+#endif
+}
+
+/**
+   * Interface of updating MSAA name when UNO description_changed event occurs.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param newDesc New UNO accessible description.
+   * @return
+   */
+void  AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc, Any newDesc )
+{
+    if( pWinManager )
+        pWinManager->SetDescription( pXAcc, newDesc );
+}
+
+/**
+   * When a new UNO XAccessible object is found by listener,we'll create a corresponding
+   * com object and insert it to our manager list.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pWnd The top window handle containing control.
+   * @return If the method is correctly processed.
+   */
+unsigned char AccObjectManagerAgent::InsertAccObj( XAccessible* pXAcc,XAccessible* pParentXAcc,long pWnd)
+{
+    if( pWinManager )
+        return (unsigned char)pWinManager->InsertAccObj( pXAcc, pParentXAcc,HWND((void*)pWnd) );
+
+    return sal_False;
+}
+
+/**
+   * save the pair <topwindowhandle, XAccessible>
+   * @param hWnd, top window handle
+   * @param pXAcc XAccessible interface for top window
+   * @return void
+   */
+void AccObjectManagerAgent::SaveTopWindowHandle(long hWnd, com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if( pWinManager )
+        pWinManager->SaveTopWindowHandle( HWND((void*)hWnd), pXAcc );
+}
+
+
+/**
+   * When a UNO XAccessible object's new children are found by listener,we'll create
+   * corresponding com objects and insert them to our manager list.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pWnd The top window handle containing control.
+   * @return If the method is correctly processed.
+   */
+unsigned char AccObjectManagerAgent::InsertChildrenAccObj( XAccessible* pXAcc,
+        long pWnd)
+{
+    if( pWinManager )
+        return (unsigned char)pWinManager->InsertChildrenAccObj( pXAcc, HWND((void*)pWnd) );
+
+    return sal_False;
+}
+
+/**
+   * When a new UNO XAccessible object is destroied,we'll delete its corresponding
+   * com object and remove it from our manager list.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return 
+   */
+void AccObjectManagerAgent::DeleteAccObj( XAccessible* pXAcc )
+{
+    if( pWinManager )
+        pWinManager->DeleteAccObj( pXAcc );
+}
+
+/**
+   * When new UNO children XAccessible objects are destroyed,we'll delete their
+   * corresponding com objects and remove them from our manager list.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return 
+   */
+void AccObjectManagerAgent::DeleteChildrenAccObj( XAccessible* pXAcc )
+{
+    if( pWinManager )
+        pWinManager->DeleteChildrenAccObj( pXAcc );
+}
+
+/**
+   * Interface of decreasing MSAA state when some UNO state is decreased.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pState The lost state of control.
+   * @return
+   */
+void AccObjectManagerAgent::DecreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+    if(pWinManager)
+    {
+        pWinManager->DecreaseState( pXAcc,  pState );
+    }
+}
+
+/**
+   * Interface of increasing MSAA name when some UNO state is increased.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pState The new state of control.
+   * @return
+   */
+void AccObjectManagerAgent::IncreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+    if(pWinManager)
+    {
+        pWinManager->IncreaseState( pXAcc,  pState );
+    }
+}
+
+void  AccObjectManagerAgent::UpdateState( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+    if(pWinManager)
+        pWinManager->UpdateState(pXAcc);
+}
+
+/**
+   * Interface of notify MSAA event when some UNO event occured.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @param pEvent UNO event ID.
+   * @return If the method is correctly processed.
+   */
+unsigned char AccObjectManagerAgent::NotifyAccEvent( short pEvent,XAccessible* pXAcc )
+{
+    if(pWinManager)
+        return (unsigned char)pWinManager->NotifyAccEvent(pXAcc,pEvent);
+
+    return sal_False;
+}
+
+/**
+   * Judge whether a XAccessible object is a container object.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return If the method is correctly processed.
+   */
+unsigned short AccObjectManagerAgent::IsContainer( XAccessible* pXAcc )
+{
+    if(pWinManager)
+        return (unsigned char)pWinManager->IsContainer(pXAcc);
+
+    return sal_False;
+}
+
+/**
+   * Return com object interface by querying XAccessible interface.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return Com interface.
+   */
+IMAccessible* AccObjectManagerAgent::GetIMAccByXAcc(XAccessible* pXAcc)
+{
+    if(pWinManager)
+        return pWinManager->GetIMAccByXAcc(pXAcc);
+
+    return NULL;
+}
+
+/**
+   * Notify manger when a XAccessible object is destroying.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return.
+   */
+void  AccObjectManagerAgent::NotifyDestroy(XAccessible* pXAcc)
+{
+    if(pWinManager)
+        pWinManager->NotifyDestroy(pXAcc);
+}
+
+/**
+   * Return com object interface by querying child id.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return Com interface.
+   */
+void AccObjectManagerAgent::GetIAccessibleFromResID(long childID,IMAccessible** pIMAcc)
+{
+    if(pWinManager)
+        *pIMAcc = pWinManager->GetIAccessibleFromResID(childID);
+}
+
+/**
+   * Return object interface by querying interface.
+   * @param pXAcc Uno XAccessible interface of control.
+   * @return Com interface.
+   */
+unsigned char AccObjectManagerAgent::GetIAccessibleFromXAccessible(XAccessible* pXAcc, IAccessible** ppXI)
+{
+    if(pWinManager)
+    {
+        *ppXI = (IAccessible*)pWinManager->GetIMAccByXAcc(pXAcc);
+        if(*ppXI)
+            return sal_True;
+    }
+    return sal_False;
+}
+
+XAccessible* AccObjectManagerAgent::GetParentXAccessible( XAccessible* pXAcc )
+{
+    if(pWinManager)
+        return pWinManager->GetParentXAccessible( pXAcc );
+
+    return NULL;
+}
+
+short AccObjectManagerAgent::GetParentRole( XAccessible* pXAcc )
+{
+    if(pWinManager)
+        return pWinManager->GetParentRole( pXAcc );
+
+    return -1;
+}
+
+void AccObjectManagerAgent::UpdateDescription( XAccessible* pXAcc )
+{
+    if(pWinManager)
+        pWinManager->UpdateDescription( pXAcc );
+}
+
+void AccObjectManagerAgent::UpdateChildState(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if(pWinManager)
+        pWinManager->UpdateChildState( pXAcc );
+}
+
+
+bool AccObjectManagerAgent::IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if(pWinManager)
+        return pWinManager->IsSpecialToolboItem( pXAcc );
+
+    return false;
+}
+
+short AccObjectManagerAgent::GetRole(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if(pWinManager)
+        return pWinManager->GetRole( pXAcc );
+
+    return -1;
+}
+
+XAccessible* AccObjectManagerAgent::GetAccDocByAccTopWin( XAccessible* pXAcc )
+{
+    if (pWinManager)
+    {
+        return pWinManager->GetAccDocByAccTopWin( pXAcc );
+    }
+    return NULL;
+}
+bool AccObjectManagerAgent::IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+    if (pWinManager)
+    {
+        return pWinManager->IsTopWinAcc( pXAcc );
+    }
+    return NULL;
+}
+
+bool AccObjectManagerAgent::IsStateManageDescendant(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if(pWinManager)
+        return pWinManager->IsStateManageDescendant( pXAcc );
+
+    return sal_False;
+}
diff --git a/main/winaccessibility/source/service/AccObjectWinManager.cxx b/main/winaccessibility/source/service/AccObjectWinManager.cxx
new file mode 100644
index 0000000..37c74e5
--- /dev/null
+++ b/main/winaccessibility/source/service/AccObjectWinManager.cxx
@@ -0,0 +1,1321 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include <cassert>
+
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>
+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+
+#include <oleacc.h>
+#ifndef _SV_AccObjectWinManager_HXX
+#include "AccObjectWinManager.hxx"
+#endif
+#include "AccEventListener.hxx"
+#include "AccComponentEventListener.hxx"
+#include "AccContainerEventListener.hxx"
+#include "AccDialogEventListener.hxx"
+#include "AccWindowEventListener.hxx"
+#include "AccFrameEventListener.hxx"
+#include "AccMenuEventListener.hxx"
+#include "AccObjectContainerEventListener.hxx"
+#include "AccParagraphEventListener.hxx"
+#include "AccTextComponentEventListener.hxx"
+#include "AccListEventListener.hxx"
+#include "AccTreeEventListener.hxx"
+#include "AccTableEventListener.hxx"
+#include "AccObject.hxx"
+#include "unomsaaevent.hxx"
+#include "checkmt.hxx"
+
+#define CHILDID_SELF             0
+
+
+using namespace std;
+using namespace com::sun::star::accessibility;
+using namespace com::sun::star::uno;
+
+AccObjectWinManager* g_acc_manager = NULL;
+AccObjectWinManager* AccObjectWinManager::me = NULL;
+
+/**
+   * Implementation of interface XMSAAService's method getAccObjectPtr() that return the
+   * corresponding com interface with the MS event.
+   *
+   * @param   
+   * @return  Com interface.
+   */
+long GetMSComPtr(long hWnd, long lParam, long wParam)
+{
+    if( g_acc_manager )
+        return (long)g_acc_manager->Get_ToATInterface(HWND((void*)hWnd),lParam,wParam );
+    return NULL;
+}
+
+/**
+   * constructor
+   * @param   Agent The agent kept in all listeners,it's the sole interface by which
+   *                listener communicate with windows manager.
+   *          pEventAccObj The present event accobject.
+   *          oldFocus     Last focused object.
+   *          isSelectionChanged flag that identifies if there is selection changed.
+   *		  selectionChildObj  Selected object.
+   *          dChildID	Chile resource ID.
+   *          hAcc TopWindowHWND
+   * @return  
+   */
+AccObjectWinManager::AccObjectWinManager( AccObjectManagerAgent* Agent ):
+        pAgent( Agent ),
+        oldFocus( NULL )
+{
+}
+
+/**
+   * Public method to produce manager
+   * @param   Agent The agent kept in all listeners,it's the sole interface by which
+   *          listener communicate with windows manager.
+   * @return  
+   */
+AccObjectWinManager* AccObjectWinManager::CreateAccObjectWinManagerInstance( AccObjectManagerAgent* Agent )
+{
+    if( me == NULL )
+    {
+        me = new AccObjectWinManager( Agent );
+        g_acc_manager = me;
+        return me;
+    }
+
+    return me;
+}
+
+
+/**
+   * Destructor,clear all resource.
+   * @param   
+   * @return  
+   */
+AccObjectWinManager::~AccObjectWinManager()
+{
+    XIdAccList.clear();
+    HwndXAcc.clear();
+    XResIdAccList.clear();
+    XHWNDDocList.clear();
+#ifdef ACC_DEBUG
+
+    fclose( pFile );
+#endif
+}
+
+
+/**
+   * Get valid com object interface when notifying some MSAA event
+   * @param pWND The top window handle that contains that event control.
+   * @param wParam Windows system interface. 
+   * @return Com interface with event. 
+   */
+
+long AccObjectWinManager::Get_ToATInterface( HWND hWnd, long lParam, long wParam)
+{
+    vos::OGuard localGuard(maATInterfaceMutex);//
+
+    IMAccessible* pRetIMAcc = NULL;
+
+    if(lParam == OBJID_CLIENT )
+    {
+        AccObject* topWindowAccObj = GetTopWindowAccObj(hWnd);
+        if(topWindowAccObj)
+        {
+            pRetIMAcc = topWindowAccObj->GetIMAccessible();
+            if(pRetIMAcc)
+                pRetIMAcc->AddRef();//increase COM reference count
+        }
+    }
+
+    if ( pRetIMAcc && lParam == OBJID_CLIENT )
+    {
+        IAccessible* pTemp = dynamic_cast<IAccessible*>( pRetIMAcc );
+        HRESULT result = LresultFromObject(IID_IAccessible, wParam, pTemp);
+        pTemp->Release();
+        return result;
+    }
+    return 0;
+}
+
+/**
+   * Search AccObject by XAccessible pointer from our container.
+   * @param pXAcc XAccessible interface.
+   * @return Pointer of accObject that is found. 
+   */
+AccObject* AccObjectWinManager::GetAccObjByXAcc( XAccessible* pXAcc)
+{
+    if( pXAcc == NULL)
+        return NULL;
+
+    XIdToAccObjHash::iterator pIndTemp = XIdAccList.find( (void*)pXAcc );
+    if ( pIndTemp == XIdAccList.end() )
+        return NULL;
+
+    return &(pIndTemp->second);
+}
+
+/**
+   * Search XAccessible by AccObject pointer from our container.
+   * @param pAccObj AccObject pointer.
+   * @return Pointer of XAccessible Interface. 
+   */
+XAccessible* AccObjectWinManager::GetXAccByAccObj(AccObject* pAccObj)
+{
+    XIdToAccObjHash::iterator iter = XIdAccList.begin();
+    while(iter!=XIdAccList.end())
+    {
+        AccObject* tmp = &(iter->second);
+        if(tmp== pAccObj)
+            return (XAccessible*)(iter->first);
+        iter++;
+    }
+    return NULL;
+}
+
+/**
+   * get acc object of top window by its handle
+   * @param hWnd, top window handle
+   * @return pointer to AccObject
+   */
+AccObject* AccObjectWinManager::GetTopWindowAccObj(HWND hWnd)
+{
+    XHWNDToXAccHash::iterator iterResult =HwndXAcc.find(hWnd);
+    if(iterResult == HwndXAcc.end())
+        return NULL;
+    XAccessible* pXAcc = (XAccessible*)(iterResult->second);
+    return GetAccObjByXAcc(pXAcc);
+}
+
+/**
+   * Simulate MSAA event via XAccessible interface and event type.
+   * @param pXAcc XAccessible interface.
+   * @param state Customize Interface   
+   * @return The terminate result that identifies if the call is successful. 
+   */
+sal_Bool AccObjectWinManager::NotifyAccEvent(XAccessible* pXAcc,short state)
+{
+    vos::OGuard aGuard(aNotifyMutex);
+
+    if (!IsInMainThread())
+    {
+        return sal_False;
+    }
+
+    Reference< XAccessibleContext > pRContext;
+
+    if( pXAcc == NULL)
+        return sal_False;
+
+
+    pRContext = pXAcc->getAccessibleContext();
+    if( !pRContext.is() )
+        return sal_False;
+
+
+    AccObject* selfAccObj= GetAccObjByXAcc(pXAcc);
+
+    if(selfAccObj==NULL)
+        return sal_False;
+
+    int selectNum =0;
+
+    long dChildID = selfAccObj->GetResID();
+    HWND hAcc = selfAccObj->GetParentHWND();
+
+    switch(state)
+    {
+    case UM_EVENT_STATE_FOCUSED:
+        {
+            UpdateAccFocus(pXAcc);
+            if( selfAccObj )
+                selfAccObj->UpdateDefaultAction( );
+            UpdateValue(pXAcc);
+            NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID  );
+            break;
+        }
+    case UM_EVENT_STATE_BUSY:
+        NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_STATE_CHECKED:
+        NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_STATE_PRESSED:
+        NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+
+    //Removed fire out selected event
+    //case UM_EVENT_STATE_SELECTED:
+    //	NotifyWinEvent( EVENT_OBJECT_STATECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+    //	break;
+    case UM_EVENT_STATE_ARMED:
+        UpdateAccFocus(pXAcc);
+        NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_MENU_START:
+        NotifyWinEvent( EVENT_SYSTEM_MENUSTART,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_MENU_END:
+        NotifyWinEvent( EVENT_SYSTEM_MENUEND,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_MENUPOPUPSTART:
+        NotifyWinEvent( EVENT_SYSTEM_MENUPOPUPSTART,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_MENUPOPUPEND:
+        NotifyWinEvent( EVENT_SYSTEM_MENUPOPUPEND,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_SELECTION_CHANGED:
+        NotifyWinEvent( EVENT_OBJECT_SELECTION,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_SELECTION_CHANGED_ADD:
+       	NotifyWinEvent( EVENT_OBJECT_SELECTIONADD,hAcc, OBJID_CLIENT,dChildID  );
+       	break;
+    case UM_EVENT_SELECTION_CHANGED_REMOVE:
+       	NotifyWinEvent( EVENT_OBJECT_SELECTIONREMOVE,hAcc, OBJID_CLIENT,dChildID  );
+       	break;
+    case UM_EVENT_SELECTION_CHANGED_WITHIN:
+       	NotifyWinEvent( EVENT_OBJECT_SELECTIONWITHIN,hAcc, OBJID_CLIENT,dChildID  );
+       	break;
+    case UM_EVENT_OBJECT_VALUECHANGE:
+        UpdateValue(pXAcc);
+        NotifyWinEvent( EVENT_OBJECT_VALUECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_NAMECHANGE:
+        NotifyWinEvent( EVENT_OBJECT_NAMECHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_DESCRIPTIONCHANGE:
+        NotifyWinEvent( EVENT_OBJECT_DESCRIPTIONCHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_DEFACTIONCHANGE:
+        NotifyWinEvent( IA2_EVENT_ACTION_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_CARETCHANGE:
+        NotifyWinEvent( IA2_EVENT_TEXT_CARET_MOVED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_TEXTCHANGE:
+        NotifyWinEvent( IA2_EVENT_TEXT_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_ACTIVE_DESCENDANT_CHANGED:
+        UpdateAccFocus(pXAcc);
+        NotifyWinEvent( EVENT_OBJECT_FOCUS,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_BOUNDRECT_CHANGED:
+        NotifyWinEvent( EVENT_OBJECT_LOCATIONCHANGE,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_VISIBLE_DATA_CHANGED:
+        NotifyWinEvent( IA2_EVENT_VISIBLE_DATA_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_SHOW :
+        NotifyWinEvent( EVENT_OBJECT_SHOW,hAcc, OBJID_CLIENT,dChildID  );
+        NotifyWinEvent( EVENT_SYSTEM_FOREGROUND,hAcc, OBJID_CLIENT,dChildID  );
+	break;
+    case UM_EVENT_TABLE_CAPTION_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_CAPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_COLUMN_HEADER_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_COLUMN_HEADER_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_MODEL_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_MODEL_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_ROW_HEADER_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_ROW_HEADER_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_SUMMARY_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_SUMMARY_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TABLE_ROW_DESCRIPTION_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_REORDER:
+        NotifyWinEvent( EVENT_OBJECT_REORDER,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_PAGE_CHANGED:
+        NotifyWinEvent( IA2_EVENT_PAGE_CHANGED,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_CHILD_REMOVED:
+        NotifyWinEvent( EVENT_OBJECT_DESTROY,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_CHILD_ADDED:
+        NotifyWinEvent( EVENT_OBJECT_CREATE ,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_OBJECT_PAGECHANGED:
+        NotifyWinEvent( IA2_EVENT_PAGE_CHANGED ,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_TEXT_SELECTION_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TEXT_SELECTION_CHANGED ,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_SECTION_CHANGED:
+        NotifyWinEvent( IA2_EVENT_SECTION_CHANGED ,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    case UM_EVENT_COLUMN_CHANGED:
+        NotifyWinEvent( IA2_EVENT_TEXT_COLUMN_CHANGED ,hAcc, OBJID_CLIENT,dChildID  );
+        break;
+    default:
+        break;
+    }
+
+    return sal_True;
+}
+
+/**
+   * Get Parent XAccessible interface by XAccessible interface.
+   * @param pXAcc XAccessible interface.
+   * @return Parent XAccessible interface.
+   */
+XAccessible* AccObjectWinManager::GetParentXAccessible( XAccessible* pXAcc )
+{
+    AccObject* pObj= GetAccObjByXAcc(pXAcc);
+    if( pObj ==NULL )
+        return NULL;
+    if(pObj->GetParentObj())
+    {
+        pObj = pObj->GetParentObj();
+        return pObj->GetXAccessible().get();
+    }
+    return NULL;
+}
+
+/**
+   * Get Parent role by XAccessible interface.
+   * @param pXAcc XAccessible interface.
+   * @return Parent role.
+   */
+short AccObjectWinManager::GetParentRole( XAccessible* pXAcc )
+{
+    AccObject* pObj= GetAccObjByXAcc(pXAcc);
+    if( pObj ==NULL )
+        return -1;
+    if(pObj->GetParentObj())
+    {
+        pObj = pObj->GetParentObj();
+        if(pObj->GetXAccessible().is())
+        {
+            XAccessible* pXAcc = pObj->GetXAccessible().get();
+            Reference< XAccessibleContext > pRContext = pXAcc->getAccessibleContext();
+            if(pRContext.is())
+                return pRContext->getAccessibleRole();
+        }
+    }
+    return -1;
+}
+
+/**
+   * Update focus objcet by new focused XAccessible interface.
+   * @param newFocus New XAccessible interface that gets focus.
+   * @return 
+   */
+void AccObjectWinManager::UpdateAccFocus(XAccessible* newFocus)
+{
+    AccObject* pAccObjNew = GetAccObjByXAcc(newFocus);
+    if(pAccObjNew)
+    {
+        AccObject* pAccObjOld = GetAccObjByXAcc(oldFocus);
+        oldFocus = newFocus;
+        pAccObjNew->setFocus();
+        //if old == new, the pAccObjNew will be without focused state
+        if (pAccObjOld && pAccObjOld != pAccObjNew)
+            pAccObjOld->unsetFocus();
+    }
+}
+
+/**
+   * Update selected objcet by new focused XAccessible interface.
+   * @param pXAcc XAccessible interface that has selected child changed.
+   * @return Selected children count.
+   */
+int AccObjectWinManager::UpdateAccSelection(XAccessible* pXAcc)
+{
+    XAccessibleSelection* pSelection = NULL;
+    Reference< XAccessibleContext > pRContext;
+
+    if( pXAcc == NULL)
+        return sal_False;
+
+    pRContext = pXAcc->getAccessibleContext();
+    if( !pRContext.is() )
+        return sal_False;
+
+    Reference< XAccessibleSelection > pRSelection(pRContext,UNO_QUERY);
+    if( !pRSelection.is() )
+        return sal_False;
+
+    AccObject* pAccObj = GetAccObjByXAcc(pXAcc);
+    if(pAccObj==NULL)
+        return sal_False;
+
+    Reference<XAccessible> pRChild = NULL;
+    AccObject* pAccChildObj = NULL;
+    int selectNum= pRSelection->getSelectedAccessibleChildCount();
+
+    IAccSelectionList oldSelection = pAccObj->GetSelection();
+
+    if(selectNum > 4)//for selected.
+        return selectNum;
+    if(selectNum == 1 && oldSelection.size() == 0)
+        return 1;
+
+    for (int i=0;i<selectNum;i++)
+    {
+        pRChild = pRSelection->getSelectedAccessibleChild(i);
+        if(!pRChild.is())
+        {
+            continue;
+        }
+        Reference<XAccessibleContext> pRChildContext = pRChild->getAccessibleContext();
+        if(!pRChildContext.is())
+        {
+            continue;
+        }
+        long index = pRChildContext->getAccessibleIndexInParent();
+        IAccSelectionList::iterator temp = oldSelection.find(index);
+        if ( temp != oldSelection.end() )
+        {
+            oldSelection.erase(index);
+            continue;
+        }
+
+        pAccChildObj = NULL;
+        pAccChildObj = GetAccObjByXAcc(pRChild.get());
+        if(!pAccChildObj)
+        {
+            InsertAccObj(pRChild.get(), pXAcc,pAccObj->GetParentHWND());
+            pAccChildObj = GetAccObjByXAcc(pRChild.get());
+        }
+
+        pAccObj->AddSelect(index, pAccChildObj);
+
+        if(pAccChildObj != NULL)
+            NotifyWinEvent(EVENT_OBJECT_SELECTIONADD,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID());
+    }
+
+    IAccSelectionList::iterator iter = oldSelection.begin();
+    while(iter!=oldSelection.end())
+    {
+        pAccObj->GetSelection().erase(iter->first);
+        pAccChildObj = (AccObject*)(iter->second);
+        if(pAccChildObj != NULL)
+            NotifyWinEvent(EVENT_OBJECT_SELECTIONREMOVE,pAccObj->GetParentHWND(), OBJID_CLIENT,pAccChildObj->GetResID());
+        iter++;
+    }
+    return 0;
+
+}
+
+/**
+   * Delete child element from children list.
+   * @param pObj Child element that should be removed from parant child list.
+   * @return 
+   */
+void AccObjectWinManager::DeleteAccChildNode( AccObject* pObj )
+{
+    AccObject *parentAccObj = pObj->GetParentObj();
+    if( parentAccObj )
+        parentAccObj->DeleteChild( pObj );
+}
+
+/**
+   * Delete XAccessible items in top window handle hashtable
+   * @param pXAcc XAccessible interface.
+   * @return 
+   */
+void AccObjectWinManager::DeleteFromHwndXAcc(XAccessible* pXAcc )
+{
+    XHWNDToXAccHash::iterator iter = HwndXAcc.begin();
+    while(iter!=HwndXAcc.end())
+    {
+        if(iter->second == pXAcc )
+        {
+            HwndXAcc.erase(iter);
+            return;
+        }
+        iter++;
+    }
+}
+
+/**
+   * Delete Delete all children with the tree root of XAccessible pointer
+   * @param pXAcc Tree root XAccessible interface.
+   * @return 
+   */
+void AccObjectWinManager::DeleteChildrenAccObj(XAccessible* pXAcc)
+{
+    vos::OGuard aGuard( aDeleteMutex );
+    AccObject* currentObj=NULL;
+    AccObject* childObj=NULL;
+    XAccessible* pTmpXAcc=NULL;
+
+    currentObj =  GetAccObjByXAcc( pXAcc);
+    if(currentObj)
+    {
+        childObj = currentObj->NextChild();
+        while(childObj)
+        {
+            pTmpXAcc = GetXAccByAccObj(childObj);
+            if(pTmpXAcc)
+            {
+                DeleteChildrenAccObj(pTmpXAcc);
+                DeleteAccObj(pTmpXAcc);
+            }
+            childObj = currentObj->NextChild();
+        }
+    }
+}
+
+/**
+   * Delete Delete Acc object self.
+   * @param pXAcc The XAccessible interface.
+   * @return 
+   */
+void AccObjectWinManager::DeleteAccObj( XAccessible* pXAcc )
+{
+    vos::OGuard aGuard( aDeleteMutex );
+    if( pXAcc == NULL )
+        return;
+    XIdToAccObjHash::iterator temp = XIdAccList.find(pXAcc);
+    if( temp != XIdAccList.end() )
+    {
+        ResIdGen.SetSub( temp->second.GetResID() );
+    }
+    else
+    {
+        return;
+    }
+
+    AccObject& accObj = temp->second;
+    DeleteAccChildNode( &accObj );
+    DeleteAccListener( &accObj );
+    if( accObj.GetIMAccessible() )
+    {
+        accObj.GetIMAccessible()->Release();
+    }
+    XIdAccList.erase( pXAcc );
+    XResIdAccList.erase( accObj.GetResID() );
+    DeleteFromHwndXAcc(pXAcc);
+}
+
+/**
+   * Delete listener that inspects some XAccessible object
+   * @param pAccObj Accobject pointer.
+   * @return 
+   */
+void AccObjectWinManager::DeleteAccListener( AccObject*  pAccObj )
+{
+    AccEventListener* listener = pAccObj->getListener();
+    if( listener==NULL )
+        return;
+    listener->removeMeFromBroadcaster();
+    pAccObj->SetListener(NULL);
+}
+
+/**
+   * Generate a child ID, which is used for AT
+   * @param 
+   * @return New resource ID.
+   */
+inline long AccObjectWinManager::ImpleGenerateResID()
+{
+    return ResIdGen.GenerateNewResID();
+}
+
+/**
+   * Insert all children of the current acc object
+   * @param pXAcc XAccessible interface
+   * @param pWnd  Top Window handle
+   * @return The calling result.
+   */
+sal_Bool AccObjectWinManager::InsertChildrenAccObj( com::sun::star::accessibility::XAccessible* pXAcc,
+        HWND pWnd)
+{
+    if(!IsContainer(pXAcc))
+        return sal_False;
+
+    Reference< XAccessibleContext > pRContext;
+
+    if( pXAcc == NULL)
+        return sal_False;
+    pRContext = pXAcc->getAccessibleContext();
+    if( !pRContext.is() )
+        return sal_False;
+
+    short role = pRContext->getAccessibleRole();
+
+    if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role )
+    {
+        if(IsStateManageDescendant(pXAcc))
+        {
+            return sal_True;
+        }
+    }
+
+    int count = pRContext->getAccessibleChildCount();
+    for (int i=0;i<count;i++)
+    {
+        Reference<XAccessible> mxAccessible
+        = pRContext->getAccessibleChild(i);
+        XAccessible* mpAccessible = mxAccessible.get();
+        if(mpAccessible != NULL)
+        {
+            InsertAccObj( mpAccessible,pXAcc,pWnd );
+            InsertChildrenAccObj(mpAccessible,pWnd);
+        }
+    }
+
+    return sal_True;
+}
+
+/**
+   * Insert child object.
+   * @param pCurObj The child object
+   * @param pParentObj The parant object
+   * @param pWnd Top window handle.
+   * @return 
+   */
+void AccObjectWinManager::InsertAccChildNode( AccObject* pCurObj, AccObject* pParentObj, HWND /* pWnd */ )
+{
+    if(pCurObj)
+    {
+        if(pParentObj)
+        {
+            pParentObj->InsertChild(pCurObj);
+        }
+        else
+        {
+            pCurObj->UpdateValidWindow();
+        }
+    }
+}
+
+/**
+   * Insert child object.
+   * @param pCurObj The child object
+   * @param pParentObj The parant object
+   * @param pWnd Top window handle.
+   * @return 
+   */
+sal_Bool AccObjectWinManager::InsertAccObj( XAccessible* pXAcc,XAccessible* pParentXAcc,HWND pWnd )
+{
+    XIdToAccObjHash::iterator itXacc = XIdAccList.find( (void*)pXAcc );
+    if (itXacc != XIdAccList.end() )
+    {
+        short nCurRole =GetRole(pXAcc);
+        if (AccessibleRole::SHAPE == nCurRole)
+        {
+            AccObject &objXacc = itXacc->second;
+            AccObject *pObjParent = objXacc.GetParentObj();
+            if (pObjParent &&
+                    pObjParent->GetXAccessible().is() &&
+                    pObjParent->GetXAccessible().get() != pParentXAcc)
+            {
+                XIdToAccObjHash::iterator itXaccParent  = XIdAccList.find( (void*)pParentXAcc );
+                if(itXaccParent != XIdAccList.end())
+                {
+                    objXacc.SetParentObj(&(itXaccParent->second));
+                }
+            }
+        }
+        return sal_False;
+    }
+
+
+    Reference< XAccessibleContext > pRContext;
+
+    if( pXAcc == NULL)
+        return sal_False;
+
+    pRContext = pXAcc->getAccessibleContext();
+    if( !pRContext.is() )
+        return sal_False;
+
+    if( pWnd == NULL )
+    {
+        if(pParentXAcc)
+        {
+            AccObject* pObj = GetAccObjByXAcc(pParentXAcc);
+            if(pObj)
+                pWnd = pObj->GetParentHWND();
+        }
+        if( pWnd == NULL )
+            return sal_False;
+    }
+
+    AccObject pObj( pXAcc,pAgent );
+    if( pObj.GetIMAccessible() == NULL )
+        return sal_False;
+    pObj.SetResID( this->ImpleGenerateResID());
+    pObj.SetParentHWND( pWnd );
+
+    //for file name support
+    if ( pObj.GetRole() == DOCUMENT )
+    {
+        XHWNDToDocumentHash::iterator aIter = XHWNDDocList.find( (long)pWnd );
+        if ( aIter != XHWNDDocList.end() )
+        {
+            XHWNDDocList.erase( aIter );
+        }
+        XHWNDDocList.insert( XHWNDToDocumentHash::value_type( (long)pWnd, pXAcc ) );
+
+    }
+    //end of file name
+
+    AccEventListener* listener = createAccEventListener(pXAcc, pAgent);
+    if(listener==NULL)
+        return sal_False;
+    Reference<XAccessibleComponent> xComponent(pRContext,UNO_QUERY);
+    Reference<XAccessibleEventBroadcaster> broadcaster(xComponent,UNO_QUERY);
+    if (broadcaster.is())
+    {
+        Reference <XAccessibleEventListener> pp (
+            static_cast< XAccessibleEventListener* >(listener),UNO_QUERY );
+        if(pp.is())
+        {
+            broadcaster->addEventListener(pp);
+        }
+        else
+        {
+            delete listener;
+            return sal_False;
+        }
+    }
+    else
+        return sal_False;
+
+    XIdAccList.insert( XIdToAccObjHash::value_type( (void*)pXAcc, pObj ));
+    XIdToAccObjHash::iterator pIndTemp = XIdAccList.find( (void*)pXAcc );
+    XResIdAccList.insert(XResIdToAccObjHash::value_type(pObj.GetResID(),&(pIndTemp->second)));
+
+    AccObject* pCurObj = GetAccObjByXAcc(pXAcc);
+    if( pCurObj )
+    {
+        pCurObj->SetListener( listener );
+        if(listener != NULL)
+            listener->acquire();
+    }
+
+    AccObject* pParentObj = GetAccObjByXAcc(pParentXAcc);
+    InsertAccChildNode(pCurObj,pParentObj,pWnd);
+    if( pCurObj )
+        pCurObj->UpdateAccessibleInfoFromUnoToMSAA();
+    return sal_True;
+}
+
+
+/**
+   * save the pair <topwindowhandle, XAccessible>
+   * @param hWnd, top window handle
+   * @param pXAcc XAccessible interface for top window
+   * @return void
+   */
+void AccObjectWinManager::SaveTopWindowHandle(HWND hWnd, com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    HwndXAcc.insert( XHWNDToXAccHash::value_type( hWnd,(void*)pXAcc ) );
+}
+
+
+/**
+   * create the corresponding listener.
+   * @param pXAcc XAccessible interface.
+   * @param Agent The agent kept in all listeners,it's the sole interface by which
+   *        listener communicate with windows manager.
+   * @return 
+   */
+AccEventListener* AccObjectWinManager::createAccEventListener(XAccessible* pXAcc, AccObjectManagerAgent* /* Agent */ )
+{
+    AccEventListener* listener = NULL;
+    Reference<XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+    if(xContext.is())
+    {
+        switch( xContext->getAccessibleRole() )
+        {
+        case /*AccessibleRole::*/DIALOG:
+            listener = new AccDialogEventListener(pXAcc,pAgent);
+            break;
+        case /*AccessibleRole::*/FRAME:
+            listener = new AccFrameEventListener(pXAcc,pAgent);
+            break;
+        case /*AccessibleRole::*/WINDOW:
+            listener = new AccWindowEventListener(pXAcc,pAgent);
+            break;
+        case /*AccessibleRole::*/ROOT_PANE:
+            listener = new AccFrameEventListener(pXAcc,pAgent);
+            break;
+            //Container
+        case /*AccessibleRole::*/CANVAS:
+        case /*AccessibleRole::*/COMBO_BOX:
+        case /*AccessibleRole::*/DOCUMENT:
+        case /*AccessibleRole::*/END_NOTE:
+        case /*AccessibleRole::*/FILLER:
+        case /*AccessibleRole::*/FOOTNOTE:
+        case /*AccessibleRole::*/FOOTER:
+        case /*AccessibleRole::*/HEADER:
+        case /*AccessibleRole::*/LAYERED_PANE:
+        case /*AccessibleRole::*/MENU_BAR:
+        case /*AccessibleRole::*/POPUP_MENU:
+        case /*AccessibleRole::*/OPTION_PANE:
+        case /*AccessibleRole::*/PAGE_TAB:
+        case /*AccessibleRole::*/PAGE_TAB_LIST:
+        case /*AccessibleRole::*/PANEL:
+        case /*AccessibleRole::*/SCROLL_PANE:
+        case /*AccessibleRole::*/SPLIT_PANE:
+        case /*AccessibleRole::*/STATUS_BAR:
+        case /*AccessibleRole::*/TABLE_CELL:
+        case /*AccessibleRole::*/TOOL_BAR:
+        case /*AccessibleRole::*/VIEW_PORT:
+            listener = new AccContainerEventListener(pXAcc,pAgent);
+            break;
+        case /*AccessibleRole::*/PARAGRAPH:
+        case /*AccessibleRole::*/HEADING:
+            listener = new AccParagraphEventListener(pXAcc,pAgent);
+            break;
+            //Component
+        case /*AccessibleRole::*/CHECK_BOX:
+        case /*AccessibleRole::*/ICON:
+        case /*AccessibleRole::*/LABEL:
+        case /*AccessibleRole::*/MENU_ITEM:
+        case /*AccessibleRole::*/CHECK_MENU_ITEM:
+        case /*AccessibleRole::*/RADIO_MENU_ITEM:
+        case /*AccessibleRole::*/PUSH_BUTTON:
+        case /*AccessibleRole::*/RADIO_BUTTON:
+        case /*AccessibleRole::*/SCROLL_BAR:
+        case /*AccessibleRole::*/SEPARATOR:
+        case /*AccessibleRole::*/TOGGLE_BUTTON:
+        case /*AccessibleRole::*/BUTTON_DROPDOWN:
+        case /*AccessibleRole::*/TOOL_TIP:
+        case /*AccessibleRole::*/SPIN_BOX:
+        case DATE_EDITOR:
+            listener = new AccComponentEventListener(pXAcc,pAgent);
+            break;
+            //text component
+        case /*AccessibleRole::*/TEXT:
+            listener = new AccTextComponentEventListener(pXAcc,pAgent);
+            break;
+            //menu
+        case /*AccessibleRole::*/MENU:
+            listener = new AccMenuEventListener(pXAcc,pAgent);
+            break;
+            //object container
+        case /*AccessibleRole::*/SHAPE:
+
+        case /*AccessibleRole::*/EMBEDDED_OBJECT:
+        case /*AccessibleRole::*/GRAPHIC:
+        case /*AccessibleRole::*/TEXT_FRAME:
+            listener = new AccObjectContainerEventListener(pXAcc,pAgent);
+            break;
+            //descendmanager
+        case /*AccessibleRole::*/LIST:
+            listener = new AccListEventListener(pXAcc,pAgent);
+            break;
+        case /*AccessibleRole::*/TREE:
+            listener = new AccTreeEventListener(pXAcc,pAgent);
+            break;
+            //special
+        case /*AccessibleRole::*/COLUMN_HEADER:
+        case /*AccessibleRole::*/TABLE:
+            listener = new AccTableEventListener(pXAcc,pAgent);
+            break;
+        default:
+            listener = new AccContainerEventListener(pXAcc,pAgent);
+            break;
+        }
+    }
+
+    return listener;
+}
+
+/**
+   * state is a combination integer, each bit of which represents a single state,
+   * such as focused,1 for the state on,0 for the state off. Here call COM interface
+   * to modify the state value, including DecreaseState.
+   * @param pXAcc XAccessible interface.
+   * @param pState Changed state.
+   * @return 
+   */
+void AccObjectWinManager::DecreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->DecreaseState( pState );
+}
+
+/**
+   * state is a combination integer, each bit of which represents a single state,such as focused,1 for
+   * the state on,0 for the state off. Here call COM interface to modify the state value, including 
+   * IncreaseState.
+   * @param pXAcc XAccessible interface.
+   * @param pState Changed state.
+   * @return 
+   */
+void AccObjectWinManager::IncreaseState( XAccessible* pXAcc,unsigned short pState )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->IncreaseState( pState );
+}
+
+void  AccObjectWinManager::UpdateState( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->UpdateState( );
+}
+
+/**
+   * Set corresponding com object's accessible name via XAccessilbe interface and new
+   * name
+   * @param pXAcc XAccessible interface.
+   * @return 
+   */
+void  AccObjectWinManager::UpdateAccName( XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->UpdateName();
+}
+
+void  AccObjectWinManager::UpdateAction( XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->UpdateAction();
+}
+
+void AccObjectWinManager::UpdateDescription( XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if ( pAccObj )
+        pAccObj->UpdateDescription();
+}
+
+/**
+   * Set corresponding com object's accessible location via XAccessilbe interface and new
+   * location.
+   * @param pXAcc XAccessible interface.
+   * @return 
+   */
+void  AccObjectWinManager::SetLocation( XAccessible* pXAcc, long /*top*/, long /*left*/, long /*width*/, long /*height*/ )
+{
+    AccObject* pObj = GetAccObjByXAcc( pXAcc );
+    //get the location from XComponent.
+    Reference< XAccessibleContext > pRContext = pXAcc->getAccessibleContext();
+    if( pObj )
+        pObj->UpdateLocation();
+}
+
+/**
+   * Set corresponding com object's value  via XAccessilbe interface and new value.
+   * @param pXAcc XAccessible interface.
+   * @param pAny new value.
+   * @return 
+   */
+void  AccObjectWinManager::SetValue( XAccessible* pXAcc, Any pAny )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->SetValue( pAny );
+}
+
+/**
+   * Set corresponding com object's value  via XAccessilbe interface.
+   * @param pXAcc XAccessible interface.
+   * @return 
+   */
+void  AccObjectWinManager::UpdateValue( XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->UpdateValue();
+}
+
+/**
+   * Set corresponding com object's name via XAccessilbe interface and new name.
+   * @param pXAcc XAccessible interface.
+   * @param newName new name
+   * @return 
+   */
+void  AccObjectWinManager::SetAccName( XAccessible* pXAcc, Any newName)
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->SetName( newName );
+}
+
+/**
+   * Set corresponding com object's description via XAccessilbe interface and new description.
+   * @param pXAcc XAccessible interface.
+   * @param newDesc new description
+   * @return 
+   */
+void  AccObjectWinManager::SetDescription( XAccessible* pXAcc, Any newDesc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->SetDescription( newDesc );
+}
+
+/**
+   * Set corresponding com object's role via XAccessilbe interface and new role.
+   * @param pXAcc XAccessible interface.
+   * @param Role new role
+   * @return 
+   */
+void  AccObjectWinManager::SetRole( XAccessible* pXAcc, long Role )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if( pAccObj )
+        pAccObj->SetRole( (short)Role );
+}
+
+/**
+   * Judge if a XAccessible object is a container object.
+   * @param pAccessible XAccessible interface.
+   * @return If XAccessible object is container.
+   */
+sal_Bool AccObjectWinManager::IsContainer(XAccessible* pAccessible)
+{
+    try
+    {
+        if(pAccessible)
+        {
+            Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+            if(xContext.is())
+            {
+                switch( xContext->getAccessibleRole() )
+                {
+                case /*AccessibleRole::*/DIALOG:
+                case /*AccessibleRole::*/FRAME:
+                case /*AccessibleRole::*/WINDOW:
+                case /*AccessibleRole::*/ROOT_PANE:
+                case /*AccessibleRole::*/CANVAS:
+                case /*AccessibleRole::*/COMBO_BOX:
+                case /*AccessibleRole::*/DOCUMENT:
+                case /*AccessibleRole::*/EMBEDDED_OBJECT:
+                case /*AccessibleRole::*/END_NOTE:
+                case /*AccessibleRole::*/FILLER:
+                case /*AccessibleRole::*/FOOTNOTE:
+                case /*AccessibleRole::*/FOOTER:
+                case /*AccessibleRole::*/GRAPHIC:
+                case /*AccessibleRole::*/GROUP_BOX:
+                case /*AccessibleRole::*/HEADER:
+                case /*AccessibleRole::*/LAYERED_PANE:
+                case /*AccessibleRole::*/MENU_BAR:
+                case /*AccessibleRole::*/POPUP_MENU:
+                case /*AccessibleRole::*/OPTION_PANE:
+                case /*AccessibleRole::*/PAGE_TAB:
+                case /*AccessibleRole::*/PAGE_TAB_LIST:
+                case /*AccessibleRole::*/PANEL:
+                case /*AccessibleRole::*/SCROLL_PANE:
+                case /*AccessibleRole::*/SPLIT_PANE:
+                case /*AccessibleRole::*/STATUS_BAR:
+                case /*AccessibleRole::*/TABLE_CELL:
+                case /*AccessibleRole::*/TEXT_FRAME:
+                case /*AccessibleRole::*/TOOL_BAR:
+                case /*AccessibleRole::*/VIEW_PORT:
+                case /*AccessibleRole::*/SHAPE:
+                    return sal_True;
+                    break;
+                case /*AccessibleRole::*/COLUMN_HEADER:
+                case /*AccessibleRole::*/TABLE:
+                    if(!IsStateManageDescendant(pAccessible))
+                        return sal_True;
+                    break;
+                case /*AccessibleRole::*/MENU:
+                    return sal_True;
+                    break;
+                default:
+                    return sal_False;
+                }
+            }
+        }
+    }
+    catch(...)
+    {
+        return sal_False;
+    }
+    return sal_False;
+}
+
+/**
+   * Judge if a XAccessible object has ManageDescendant event.
+   * @param pAccessible XAccessible interface.
+   * @return If XAccessible object is managedescendant.
+   */
+bool AccObjectWinManager::IsStateManageDescendant(XAccessible* pAccessible)
+{
+    if(pAccessible)
+    {
+        Reference<XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);
+        if(xContext.is())
+        {
+            Reference< XAccessibleStateSet > pRState = xContext->getAccessibleStateSet();
+            if( !pRState.is() )
+                return sal_False;
+
+            Sequence<short> pStates = pRState->getStates();
+            int count = pStates.getLength();
+            for( int iIndex = 0;iIndex < count;iIndex++ )
+            {
+                if(pStates[iIndex] == /*AccessibleStateType::*/MANAGES_DESCENDANTS)
+                    return sal_True;
+            }
+        }
+    }
+    return sal_False;
+}
+
+/**
+   * Query and get IAccessible interface by XAccessible interface from list.
+   * @param pXAcc XAccessible interface.
+   * @return Com accobject interface.
+   */
+IMAccessible* AccObjectWinManager::GetIMAccByXAcc(XAccessible* pXAcc)
+{
+    AccObject* pAccObj = GetAccObjByXAcc(pXAcc);
+    if(pAccObj)
+    {
+        return pAccObj->GetIMAccessible();
+    }
+    else
+    {
+        return NULL;
+    }
+}
+
+/**
+   * Query and get IAccessible interface by child id from list.
+   * @param resID, childID.
+   * @return Com accobject interface.
+   */
+IMAccessible * AccObjectWinManager::GetIAccessibleFromResID(long resID)
+{
+    XResIdToAccObjHash::iterator pIndTemp = XResIdAccList.find( resID );
+    if ( pIndTemp == XResIdAccList.end() )
+        return NULL;
+
+    AccObject* pObj = pIndTemp->second;
+
+    if(pObj->GetIMAccessible())
+        return pObj->GetIMAccessible();
+    return NULL;
+}
+/**
+   * Notify some object will be destroyed.
+   * @param pXAcc XAccessible interface.
+   * @return Com accobject interface.
+   */
+void AccObjectWinManager::NotifyDestroy(XAccessible* pXAcc)
+{
+    AccObject* accObj = GetAccObjByXAcc(pXAcc);
+    if(accObj)
+    {
+        accObj->NotifyDestroy(sal_True);
+    }
+}
+
+
+void AccObjectWinManager::UpdateChildState(com::sun::star::accessibility::XAccessible* pAccSubMenu)
+{
+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccSubMenu,UNO_QUERY);
+    if (!xContext.is())
+    {
+        return;
+    }
+    sal_Int32 nCount = xContext->getAccessibleChildCount();
+    for (sal_Int32 i = 0 ; i < nCount ; ++i)
+    {
+        Reference<com::sun::star::accessibility::XAccessible> xChild = xContext->getAccessibleChild(i);
+        if (xChild.is())
+        {
+            AccObject *pObj =  GetAccObjByXAcc(xChild.get());
+            if (pObj)
+            {
+                pObj->UpdateState();
+            }
+        }
+    }
+}
+
+
+bool AccObjectWinManager::IsSpecialToolboItem(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    if (pXAcc && oldFocus != pXAcc)
+    {
+        if(GetParentRole(pXAcc) == TOOL_BAR)
+        {
+            Reference< XAccessibleContext > pRContext(pXAcc->getAccessibleContext());
+            if (pRContext.is())
+            {
+                if(pRContext->getAccessibleRole() == TOGGLE_BUTTON)
+                {
+                    return true;
+                }
+            }
+        }
+    }
+    return false;
+}
+
+short AccObjectWinManager::GetRole(com::sun::star::accessibility::XAccessible* pXAcc)
+{
+    assert(pXAcc != NULL);
+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pXAcc->getAccessibleContext(),UNO_QUERY);
+    if(xContext.is())
+    {
+        return xContext->getAccessibleRole();
+    }
+    return -1;
+}
+
+XAccessible* AccObjectWinManager::GetAccDocByHWND( long pWnd )
+{
+    XHWNDToDocumentHash::iterator aIter;
+    aIter = XHWNDDocList.find( pWnd );
+    if ( aIter != XHWNDDocList.end() )
+    {
+        return aIter->second;
+    }
+
+    return NULL;
+}
+
+XAccessible* AccObjectWinManager::GetAccDocByAccTopWin( XAccessible* pXAcc )
+{
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    long pWnd = (long)( pAccObj->GetParentHWND() );
+    return GetAccDocByHWND( pWnd );
+}
+
+bool AccObjectWinManager::IsTopWinAcc( com::sun::star::accessibility::XAccessible* pXAcc )
+{
+    bool bRet = false;
+    AccObject* pAccObj = GetAccObjByXAcc( pXAcc );
+    if ( pAccObj )
+    {
+        bRet = ( pAccObj->GetParentObj() == NULL );
+    }
+    return bRet;
+}
\ No newline at end of file
diff --git a/main/winaccessibility/source/service/AccParagraphEventListener.cxx b/main/winaccessibility/source/service/AccParagraphEventListener.cxx
new file mode 100644
index 0000000..88ced35
--- /dev/null
+++ b/main/winaccessibility/source/service/AccParagraphEventListener.cxx
@@ -0,0 +1,145 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccParagraphEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccParagraphEventListener::AccParagraphEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccContainerEventListener(pAcc, Agent)
+{}
+AccParagraphEventListener::~AccParagraphEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccParagraphEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::CARET_CHANGED:
+        handleCaretChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::VISIBLE_DATA_CHANGED:
+        handleVisibleDataChangedEvent();
+        break;
+    case AccessibleEventId::BOUNDRECT_CHANGED:
+        handleBoundrectChangedEvent();
+        break;
+        //Added for paragraph selected state.
+    case AccessibleEventId::STATE_CHANGED:
+        {
+            short State;
+            if( (aEvent.NewValue >>= State) && (State == AccessibleStateType::SELECTED) )
+            {
+                pAgent->IncreaseState( pAccessible, State);
+                break;
+            }
+            else if( (aEvent.OldValue >>= State) && (State == AccessibleStateType::SELECTED) )
+            {
+                pAgent->DecreaseState( pAccessible, State);
+                break;
+            }
+
+            AccContainerEventListener::notifyEvent(aEvent);
+            break;
+        }
+
+    case AccessibleEventId::TEXT_SELECTION_CHANGED:
+        handleTextSelectionChangedEvent();
+        break;
+
+    default:
+        AccContainerEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the CARET_CHANGED event
+ *	@param oldValue		in UNO, this parameter is always NULL
+ *	@param newValue		in UNO, this parameter is always NULL
+ */
+void AccParagraphEventListener::handleCaretChangedEvent(Any oldValue, Any newValue)
+{
+    pAgent->UpdateLocation(pAccessible);
+    pAgent->NotifyAccEvent(UM_EVENT_OBJECT_CARETCHANGE, pAccessible);
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccParagraphEventListener::handleVisibleDataChangedEvent()
+{
+    AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccParagraphEventListener::handleBoundrectChangedEvent()
+{
+    AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param state	new state id
+ *	@param enable	true if state is set, false if state is unset
+ */
+void AccParagraphEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::EDITABLE:
+        // no msaa state
+        break;
+    case AccessibleStateType::MULTI_LINE:
+        // no msaa state mapping
+        break;
+    case AccessibleStateType::SINGLE_LINE:
+        // no msaa state mapping
+        break;
+    default:
+        AccContainerEventListener::setComponentState(state, enable);
+        break;
+    }
+}
+
+void AccParagraphEventListener::handleTextSelectionChangedEvent()
+{
+    pAgent->NotifyAccEvent(UM_EVENT_TEXT_SELECTION_CHANGED, pAccessible);
+}
+
diff --git a/main/winaccessibility/source/service/AccResource.cxx b/main/winaccessibility/source/service/AccResource.cxx
new file mode 100644
index 0000000..50c6a5c
--- /dev/null
+++ b/main/winaccessibility/source/service/AccResource.cxx
@@ -0,0 +1,85 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "AccResource.hxx"
+
+#include <tools/simplerm.hxx>
+
+// ---- needed as long as we have no contexts for components ---
+#include <vcl/svapp.hxx>
+
+//2009.04. Comment the following code because the acc resource is not necessary now. Can open them if necessary
+//#ifndef _TOOLS_INTN_HXX
+//#include <tools/intn.hxx>
+//#endif
+//#ifndef _SOLAR_HRC
+//#include <svtools/solar.hrc>
+//#endif
+
+//.........................................................................
+
+//==================================================================
+//= ResourceManager
+//==================================================================
+SimpleResMgr* ResourceManager::m_pImpl = NULL;
+
+//------------------------------------------------------------------
+ResourceManager::EnsureDelete::~EnsureDelete()
+{
+    delete ResourceManager::m_pImpl;
+}
+
+//------------------------------------------------------------------
+void ResourceManager::ensureImplExists()
+{
+	//Comment the following code because the acc resource is not necessary now. Can open them if necessary
+	/* 
+    if (m_pImpl)
+        return;
+
+    LanguageType nType = Application::GetSettings().GetUILanguage();
+
+    ByteString sFileName("winaccessibility");
+    sFileName += ByteString::CreateFromInt32( (sal_Int32)SOLARUPD );
+
+    m_pImpl = SimpleResMgr::Create(sFileName.GetBuffer(), nType);
+
+    if (m_pImpl)
+    {
+        // no that we have a impl class make sure it's deleted on unloading the library
+        static ResourceManager::EnsureDelete	s_aDeleteTheImplClas;
+    }
+  */
+}
+
+//------------------------------------------------------------------
+::rtl::OUString ResourceManager::loadString(sal_uInt16 _nResId)
+{
+    ::rtl::OUString sReturn;
+
+    ensureImplExists();
+    if (m_pImpl)
+        sReturn = m_pImpl->ReadString(_nResId);
+
+    return sReturn;
+}
+
+
diff --git a/main/winaccessibility/source/service/AccTableEventListener.cxx b/main/winaccessibility/source/service/AccTableEventListener.cxx
new file mode 100644
index 0000000..998dac7
--- /dev/null
+++ b/main/winaccessibility/source/service/AccTableEventListener.cxx
@@ -0,0 +1,146 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+#include <com/sun/star/accessibility/AccessibleTableModelChange.hpp>

+

+#include "AccTableEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTableEventListener::AccTableEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccDescendantManagerEventListener(pAcc, Agent)
+{}
+AccTableEventListener::~AccTableEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccTableEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent )
+throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+        handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+
+    case AccessibleEventId::TABLE_CAPTION_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_CAPTION_CHANGED, pAccessible);
+            break;
+        }
+    case AccessibleEventId::TABLE_COLUMN_DESCRIPTION_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_COLUMN_DESCRIPTION_CHANGED, pAccessible);
+            break;
+        }
+    case AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_COLUMN_HEADER_CHANGED, pAccessible);
+            break;
+        }
+    case AccessibleEventId::TABLE_ROW_HEADER_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_ROW_HEADER_CHANGED, pAccessible);
+            break;
+        }
+    case AccessibleEventId::TABLE_MODEL_CHANGED:
+        {
+
+            handleTableModelChangeEvent(aEvent.NewValue);
+            break;
+        }
+    case AccessibleEventId::TABLE_SUMMARY_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_SUMMARY_CHANGED, pAccessible);
+            break;
+        }
+    case AccessibleEventId::TABLE_ROW_DESCRIPTION_CHANGED:
+        {
+
+            pAgent->NotifyAccEvent(UM_EVENT_TABLE_ROW_DESCRIPTION_CHANGED, pAccessible);
+            break;
+        }
+    default:
+        AccDescendantManagerEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the ACTIVE_DESCENDANT_CHANGED event
+ *  @param	oldValue	the child to lose active
+ *  @param	newValue	the child to get active
+ */
+void AccTableEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if(newValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->InsertAccObj(pAcc,pAccessible);
+            pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+        }
+    }
+    else if (oldValue >>= xChild)
+    {
+        //delete an existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->DeleteAccObj( pAcc );
+        }
+    }
+
+}
+void AccTableEventListener::handleTableModelChangeEvent(Any newValue)

+{

+	AccessibleTableModelChange aModelChange;

+	if (newValue >>= aModelChange)

+	{

+	    if( pAccessible )

+	    {

+	        //delete all oldValue's existing children

+	        pAgent->DeleteChildrenAccObj( pAccessible );

+	        //add all oldValue's existing children

+	        pAgent->InsertChildrenAccObj( pAccessible );

+	    }		

+		pAgent->NotifyAccEvent(UM_EVENT_TABLE_MODEL_CHANGED, pAccessible);

+	}

+}

diff --git a/main/winaccessibility/source/service/AccTextComponentEventListener.cxx b/main/winaccessibility/source/service/AccTextComponentEventListener.cxx
new file mode 100644
index 0000000..c1697c0
--- /dev/null
+++ b/main/winaccessibility/source/service/AccTextComponentEventListener.cxx
@@ -0,0 +1,65 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccTextComponentEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTextComponentEventListener::AccTextComponentEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccComponentEventListener(pAcc, Agent)
+{}
+AccTextComponentEventListener::~AccTextComponentEventListener()
+{
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param state	new state id
+ *	@param enable	true if state is set, false if state is unset
+ */
+void AccTextComponentEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::EDITABLE:
+        // no msaa state mapping
+        break;
+    case AccessibleStateType::MULTI_LINE:
+        // no msaa state mapping
+        break;
+    case AccessibleStateType::SINGLE_LINE:
+        // no msaa state mapping
+        break;
+    default:
+        AccComponentEventListener::setComponentState(state, enable);
+        break;
+    }
+}
diff --git a/main/winaccessibility/source/service/AccTopWindowListener.cxx b/main/winaccessibility/source/service/AccTopWindowListener.cxx
new file mode 100644
index 0000000..2d47a2d
--- /dev/null
+++ b/main/winaccessibility/source/service/AccTopWindowListener.cxx
@@ -0,0 +1,321 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <cppuhelper/bootstrap.hxx>

+#include <com/sun/star/bridge/XUnoUrlResolver.hpp>

+#include <com/sun/star/lang/XMultiServiceFactory.hpp>

+#include <vcl/window.hxx>

+#include <toolkit/awt/Vclxwindow.hxx>

+

+#ifndef _SV_SYSDATA_HXX

+#if defined( WIN ) || defined( WNT ) || defined( OS2 )

+typedef sal_Int32 HWND;

+typedef sal_Int32 HMENU;

+typedef sal_Int32 HDC;

+typedef void *PVOID;

+typedef PVOID HANDLE;

+typedef HANDLE HFONT;

+#endif

+#include <vcl/sysdata.hxx>

+#endif

+

+#include "AccTopWindowListener.hxx"

+#include "unomsaaevent.hxx"

+

+#include <com/sun/star/awt/XExtendedToolkit.hpp>

+#include <com/sun/star/uno/XInterface.hpp>

+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>

+#include <com/sun/star/accessibility/XAccessibleEventListener.hpp>

+#include <com/sun/star/accessibility/XAccessibleComponent.hpp>

+#include <com/sun/star/accessibility/AccessibleRole.hpp>

+#include <com/sun/star/accessibility/AccessibleStateType.hpp>

+

+using namespace com::sun::star::uno;

+using namespace com::sun::star::lang;

+using namespace com::sun::star::bridge;

+using namespace com::sun::star::awt;

+using namespace rtl;

+using namespace cppu;

+//////////////////////////////////////////////////////////////////////

+// Construction/Destruction

+//////////////////////////////////////////////////////////////////////

+

+AccTopWindowListener* g_pTop = NULL;

+//when proccess exit, call FreeTopWindowListener() in svmain

+void FreeTopWindowListener()

+{

+    if( g_pTop )

+    {

+        g_pTop->release();

+        g_pTop = NULL;

+    }

+}

+

+/**

+ *	As a global method to invoke the handleWindowOpened() method

+ */

+void handleWindowOpened_impl(long pAcc)

+{

+    if( g_pTop && pAcc != NULL )

+        g_pTop->handleWindowOpened( (com::sun::star::accessibility::XAccessible*)((void*)pAcc) );

+}

+

+/**

+ *	For the new opened window, generate all the UNO accessible's object, COM object and add

+ *	accessible listener to monitor all these objects. 

+ *	@param pAccessible		the accessible of the new opened window

+ */

+void AccTopWindowListener::handleWindowOpened( com::sun::star::accessibility::XAccessible* pAccessible )

+{

+    //get SystemData from window

+    VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;

+    Window* window = pvclwindow->GetWindow();

+	// The SalFrame of window may be destructed at this time

+    const SystemEnvData* systemdata = NULL;

+	try

+	{

+		systemdata = window->GetSystemData();

+	}

+	catch(...)

+	{

+		systemdata = NULL;

+	}

+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);

+    if(!xContext.is())

+    {

+        return;

+    }

+    com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();

+    //Only AccessibleContext exist, add all listeners

+    if(pAccessibleContext != NULL && systemdata != NULL)

+    {

+        accManagerAgent.SaveTopWindowHandle((HWND)systemdata->hWnd,  pAccessible);

+

+        AddAllListeners(pAccessible,NULL,(HWND)systemdata->hWnd);

+

+        if( window->GetStyle() & WB_MOVEABLE )

+            accManagerAgent.IncreaseState( pAccessible, -1 /* U_MOVEBLE */ );

+

+        short role = pAccessibleContext->getAccessibleRole();

+

+

+        if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU ||

+                role == com::sun::star::accessibility::AccessibleRole::MENU )

+        {

+            accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPSTART, pAccessible);

+        }

+

+        if (role == com::sun::star::accessibility::AccessibleRole::FRAME ||

+                role == com::sun::star::accessibility::AccessibleRole::DIALOG ||

+                role == com::sun::star::accessibility::AccessibleRole::WINDOW || 

+				role == com::sun::star::accessibility::AccessibleRole::ALERT)

+        {

+            accManagerAgent.NotifyAccEvent(UM_EVENT_SHOW, pAccessible);

+        }

+    }

+}

+

+AccTopWindowListener::AccTopWindowListener():

+        accManagerAgent(),

+        m_refcount(1)

+{

+}

+

+AccTopWindowListener::~AccTopWindowListener()

+{

+}

+

+/**

+ *	It is invoked when a new window is opened, the source of this EventObject is the window

+ */

+void AccTopWindowListener::windowOpened( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)

+{

+    if ( !e.Source.is())

+    {

+        return;

+    }

+

+    Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );

+    com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();

+    if ( pAccessible == NULL)

+    {

+        return;

+    }

+

+    handleWindowOpened(pAccessible);

+

+}

+

+/**

+ *	Add the accessible event listener to object and all its children objects. 

+ *	@param	pAccessible		the accessible object

+ *	@param	pParentXAcc		the parent of current accessible object

+ *	@param	pWND			the handle of top window which current object resides

+ */

+void AccTopWindowListener::AddAllListeners(com::sun::star::accessibility::XAccessible* pAccessible, com::sun::star::accessibility::XAccessible* pParentXAcc, HWND pWND)

+{

+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);

+    if(!xContext.is())

+    {

+        return;

+    }

+    com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();

+    if(pAccessibleContext == NULL)

+    {

+        return;

+    }

+

+    accManagerAgent.InsertAccObj( pAccessible, pParentXAcc,pWND );

+

+    if (!accManagerAgent.IsContainer(pAccessible))

+    {

+        return;

+    }

+

+

+    short role = pAccessibleContext->getAccessibleRole();

+    if(com::sun::star::accessibility::AccessibleRole::DOCUMENT == role )

+    {

+        if(accManagerAgent.IsStateManageDescendant(pAccessible))

+        {        	

+            return ;

+        }

+    }

+

+

+    int count = pAccessibleContext->getAccessibleChildCount();

+    for (int i=0;i<count;i++)

+    {

+        Reference<com::sun::star::accessibility::XAccessible> mxAccessible

+        = pAccessibleContext->getAccessibleChild(i);

+

+        com::sun::star::accessibility::XAccessible* mpAccessible = mxAccessible.get();

+        if(mpAccessible != NULL)

+        {

+            Reference<com::sun::star::accessibility::XAccessibleContext> mxAccessibleContext

+            = mpAccessible->getAccessibleContext();

+            com::sun::star::accessibility::XAccessibleContext* mpContext = mxAccessibleContext.get();

+            if(mpContext != NULL)

+            {

+                //fprintf(output, "go on add child's children event listener\n");

+                AddAllListeners(mpAccessible,pAccessible,pWND);

+            }

+        }

+    }

+}

+

+void AccTopWindowListener::windowClosing( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+/**

+ *	Invoke this method when the top window is closed, remove all the objects and its children

+ *	from current manager's cache, and remove the COM object and the accessible event listener

+ *	assigned to the accessible objects.

+ */

+void AccTopWindowListener::windowClosed( const ::com::sun::star::lang::EventObject& e ) throw (::com::sun::star::uno::RuntimeException)

+{

+    if ( !e.Source.is())

+    {

+        return;

+    }

+    Reference< com::sun::star::accessibility::XAccessible > xAccessible ( e.Source, UNO_QUERY );

+    com::sun::star::accessibility::XAccessible* pAccessible = xAccessible.get();

+    if ( pAccessible == NULL)

+    {

+        return;

+    }

+

+

+    VCLXWindow* pvclwindow = (VCLXWindow*)pAccessible;

+    Window* window = pvclwindow->GetWindow();

+    const SystemEnvData* systemdata=window->GetSystemData();

+

+    Reference<com::sun::star::accessibility::XAccessibleContext> xContext(pAccessible->getAccessibleContext(),UNO_QUERY);

+    if(!xContext.is())

+    {

+        return;

+    }

+    com::sun::star::accessibility::XAccessibleContext* pAccessibleContext = xContext.get();

+

+    short role = -1;

+    if(pAccessibleContext != NULL)

+    {

+        role = pAccessibleContext->getAccessibleRole();

+

+        if (role == com::sun::star::accessibility::AccessibleRole::POPUP_MENU ||

+                role == com::sun::star::accessibility::AccessibleRole::MENU)

+        {

+            accManagerAgent.NotifyAccEvent(UM_EVENT_MENUPOPUPEND, pAccessible);

+        }

+    }

+

+

+    accManagerAgent.DeleteChildrenAccObj( pAccessible );

+    if( role != com::sun::star::accessibility::AccessibleRole::POPUP_MENU )

+        accManagerAgent.DeleteAccObj( pAccessible );

+

+}

+

+void AccTopWindowListener::windowMinimized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+void AccTopWindowListener::windowNormalized( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+void AccTopWindowListener::windowActivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+void AccTopWindowListener::windowDeactivated( const ::com::sun::star::lang::EventObject& ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+void AccTopWindowListener::disposing( const ::com::sun::star::lang::EventObject&  ) throw (::com::sun::star::uno::RuntimeException)

+{

+}

+

+//need to investigate further

+::com::sun::star::uno::Any SAL_CALL AccTopWindowListener::queryInterface( const ::com::sun::star::uno::Type& aType ) throw (::com::sun::star::uno::RuntimeException)

+{

+    if (aType.equals( ::getCppuType( (Reference< com::sun::star::awt::XTopWindowListener> const *)0 ) ))

+    {

+        Reference< com::sun::star::awt::XTopWindowListener> xTopListener( static_cast< com::sun::star::awt::XTopWindowListener* >(this));

+        return makeAny(xTopListener);

+    }

+    return Any();

+}

+

+void AccTopWindowListener::acquire( ) throw ()

+{

+    ::osl_incrementInterlockedCount( &m_refcount );

+}

+

+void AccTopWindowListener::release() throw ()

+{

+    // thread-safe decrementation of reference count

+    if (0 == ::osl_decrementInterlockedCount( &m_refcount ))

+    {

+        delete this; // shutdown this object

+    }

+}

diff --git a/main/winaccessibility/source/service/AccTreeEventListener.cxx b/main/winaccessibility/source/service/AccTreeEventListener.cxx
new file mode 100644
index 0000000..865cc85
--- /dev/null
+++ b/main/winaccessibility/source/service/AccTreeEventListener.cxx
@@ -0,0 +1,87 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccTreeEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccTreeEventListener::AccTreeEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccDescendantManagerEventListener(pAcc, Agent)
+{}
+AccTreeEventListener::~AccTreeEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject	the event object which contains information about event
+ */
+void  AccTreeEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::ACTIVE_DESCENDANT_CHANGED:
+        handleActiveDescendantChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    default:
+        AccDescendantManagerEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the ACTIVE_DESCENDANT_CHANGED event
+ *  @param	oldValue	the child to lose active
+ *  @param	newValue	the child to get active
+ */
+void AccTreeEventListener::handleActiveDescendantChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if(newValue >>= xChild )
+    {
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->InsertAccObj(pAcc,pAccessible);
+            pAgent->NotifyAccEvent(UM_EVENT_ACTIVE_DESCENDANT_CHANGED, pAcc);
+            pActiveDescendant = pAcc;
+        }
+    }
+    if (oldValue >>= xChild)
+    {
+        //delete an existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->DeleteAccObj( pAcc );
+        }
+    }
+
+}
diff --git a/main/winaccessibility/source/service/AccWindowEventListener.cxx b/main/winaccessibility/source/service/AccWindowEventListener.cxx
new file mode 100644
index 0000000..f563c10
--- /dev/null
+++ b/main/winaccessibility/source/service/AccWindowEventListener.cxx
@@ -0,0 +1,152 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <com/sun/star/accessibility/XAccessible.hpp>
+#include <com/sun/star/accessibility/AccessibleStateType.hpp>
+#include <com/sun/star/accessibility/AccessibleEventId.hpp>
+#include <com/sun/star/accessibility/AccessibleRole.hpp>
+#include <com/sun/star/accessibility/XAccessibleEventBroadcaster.hpp>
+

+#include "AccWindowEventListener.hxx"
+#include "AccObjectManagerAgent.hxx"
+#include "unomsaaevent.hxx"
+
+using namespace com::sun::star::uno;
+using namespace com::sun::star::accessibility;
+
+AccWindowEventListener::AccWindowEventListener(com::sun::star::accessibility::XAccessible* pAcc, AccObjectManagerAgent* Agent)
+        :AccEventListener(pAcc, Agent)
+{}
+AccWindowEventListener::~AccWindowEventListener()
+{
+}
+
+/**
+ *	Uno's event notifier when event is captured
+ *	@param AccessibleEventObject: the event object which contains information about event
+ */
+void  AccWindowEventListener::notifyEvent( const ::com::sun::star::accessibility::AccessibleEventObject& aEvent ) throw (::com::sun::star::uno::RuntimeException)
+{
+    switch (aEvent.EventId)
+    {
+    case AccessibleEventId::CHILD:
+        handleChildChangedEvent(aEvent.OldValue, aEvent.NewValue);
+        break;
+    case AccessibleEventId::VISIBLE_DATA_CHANGED:
+        handleVisibleDataChangedEvent();
+        break;
+    case AccessibleEventId::BOUNDRECT_CHANGED:
+        handleBoundrectChangedEvent();
+        break;
+    default:
+        AccEventListener::notifyEvent(aEvent);
+        break;
+    }
+}
+
+/**
+ *	handle the VISIBLE_DATA_CHANGED event
+ */
+void AccWindowEventListener::handleVisibleDataChangedEvent()
+{
+    AccEventListener::handleVisibleDataChangedEvent();
+}
+
+/**
+ *	handle the BOUNDRECT_CHANGED event
+ */
+void AccWindowEventListener::handleBoundrectChangedEvent()
+{
+    AccEventListener::handleBoundrectChangedEvent();
+}
+
+/**
+ *	handle the CHILD event
+ *	@param	oldValue	the child to be deleted
+ *	@param	newValue	the child to be added
+ */
+void AccWindowEventListener::handleChildChangedEvent(Any oldValue, Any newValue)
+{
+    Reference< XAccessible > xChild;
+    if( newValue >>= xChild)
+    {
+        //create a new child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            //add this child
+            pAgent->InsertAccObj( pAcc,pAccessible);
+            //add all oldValue's existing children
+            pAgent->InsertChildrenAccObj(pAcc);
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_ADDED, pAcc);
+        }
+        else
+        {}
+    }
+    else if (oldValue >>= xChild)
+    {
+        //delete a existing child
+        if(xChild.is())
+        {
+            XAccessible* pAcc = xChild.get();
+            pAgent->NotifyAccEvent(UM_EVENT_CHILD_REMOVED, pAcc);
+            pAgent->DeleteChildrenAccObj( pAcc );
+            //delete this child
+            pAgent->DeleteAccObj( pAcc );
+        }
+        else
+        {}
+    }
+}
+
+/**
+ *	set the new state and fire the MSAA event
+ *	@param state	new state id
+ *	@param enable	true if state is set, false if state is unset
+ */
+void AccWindowEventListener::setComponentState(short state, bool enable )
+{
+    // only the following state can be fired state event.
+    switch (state)
+    {
+    case AccessibleStateType::ICONIFIED:
+        // no msaa state
+        break;
+    case AccessibleStateType::VISIBLE:
+        // UNO !VISIBLE == MSAA INVISIBLE
+        if( enable )
+            pAgent->IncreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        else
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::VISIBLE );
+        break;
+    case AccessibleStateType::SHOWING:
+        // UNO !SHOWING == MSAA OFFSCREEN
+        if( enable )
+        {
+            pAgent->IncreaseState( pAccessible, AccessibleStateType::SHOWING );
+        }
+        else
+            pAgent->DecreaseState( pAccessible, AccessibleStateType::SHOWING );
+        break;
+    default:
+        break;
+    }
+}
diff --git a/main/winaccessibility/source/service/ResIDGenerator.cxx b/main/winaccessibility/source/service/ResIDGenerator.cxx
new file mode 100644
index 0000000..4ea0d67
--- /dev/null
+++ b/main/winaccessibility/source/service/ResIDGenerator.cxx
@@ -0,0 +1,54 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include "ResIDGenerator.hxx"
+
+/**
+   * Destructor 
+   *
+   * @param   
+   * @return  
+   */
+ResIDGenerator::~ResIDGenerator()
+{
+}
+
+/**
+   * SubList stores those IDs that were ever generated and deleted, the method 
+   * return the ID from subList first if subList is not empty,else return ++max. 
+   * Add the obsolete IDs by calling SetSub method
+   * 
+   * @param   
+   * @return  new resource ID.
+   */
+long ResIDGenerator::GenerateNewResID()
+{
+    if (max == LONG_MAX)
+    {
+        if (!subList.empty())
+        {
+            long nRes = *(subList.begin());
+            subList.pop_front();
+            return nRes;
+        }
+    }
+    return -(++max);
+}
diff --git a/main/winaccessibility/source/service/checkmt.cxx b/main/winaccessibility/source/service/checkmt.cxx
new file mode 100644
index 0000000..139fd64
--- /dev/null
+++ b/main/winaccessibility/source/service/checkmt.cxx
@@ -0,0 +1,36 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#include "checkmt.hxx"
+#include <vcl/svapp.hxx>
+
+bool IsInMainThread()
+{
+    if( Application::GetMainThreadIdentifier() == ::vos::OThread::getCurrentIdentifier())
+        return true;
+    else
+        return false;
+}
+
+vos::IMutex& GetSolarMutex()
+{
+    return Application::GetSolarMutex();
+}
diff --git a/main/winaccessibility/source/service/checkmt.hxx b/main/winaccessibility/source/service/checkmt.hxx
new file mode 100644
index 0000000..fbdbb83
--- /dev/null
+++ b/main/winaccessibility/source/service/checkmt.hxx
@@ -0,0 +1,28 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/
+
+#pragma once
+
+#include <vos/mutex.hxx>
+
+bool IsInMainThread();
+
+vos::IMutex&  GetSolarMutex();
diff --git a/main/winaccessibility/source/service/exports.dxp b/main/winaccessibility/source/service/exports.dxp
new file mode 100644
index 0000000..f0e1c69
--- /dev/null
+++ b/main/winaccessibility/source/service/exports.dxp
@@ -0,0 +1,2 @@
+component_getImplementationEnvironment
+component_getFactory
diff --git a/main/winaccessibility/source/service/makefile.mk b/main/winaccessibility/source/service/makefile.mk
new file mode 100644
index 0000000..4d1ec1a
--- /dev/null
+++ b/main/winaccessibility/source/service/makefile.mk
@@ -0,0 +1,118 @@
+#**************************************************************
+#  
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#  
+#    http://www.apache.org/licenses/LICENSE-2.0
+#  
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+#  
+#**************************************************************
+
+.IF "$(GUI)"=="WNT"
+PRJ=..$/..
+PRJNAME=winaccessibility
+TARGET=winaccessibility
+LIBTARGET=NO
+USE_DEFFILE=TRUE
+ENABLE_EXCEPTIONS=TRUE
+VERSIONOBJ=
+AUTOSEG=true
+NO_BSYMBOLIC=	TRUE
+
+# output directory (one dir for each project)
+UNOUCROUT=$(OUT)$/inc
+# adding to inludepath
+INCPRE+=$(UNOUCROUT)
+INCPRE+=$(MISC)
+# --- Settings -----------------------------------------------------
+
+.INCLUDE :  settings.mk
+
+# --- Files --------------------------------------------------------
+SLOFILES=   $(SLO)$/AccObject.obj		\
+            $(SLO)$/ResIDGenerator.obj		\
+            $(SLO)$/AccObjectWinManager.obj			\
+            $(SLO)$/AccObjectManagerAgent.obj			\
+            $(SLO)$/AccEventListener.obj	\
+            $(SLO)$/AccComponentEventListener.obj	\
+            $(SLO)$/AccContainerEventListener.obj	\
+            $(SLO)$/AccDialogEventListener.obj	\
+            $(SLO)$/AccFrameEventListener.obj	\
+            $(SLO)$/AccWindowEventListener.obj	\
+            $(SLO)$/AccMenuEventListener.obj	\
+            $(SLO)$/AccTextComponentEventListener.obj	\
+            $(SLO)$/AccObjectContainerEventListener.obj	\
+            $(SLO)$/AccParagraphEventListener.obj	\
+            $(SLO)$/AccDescendantManagerEventListener.obj	\
+            $(SLO)$/AccListEventListener.obj	\
+            $(SLO)$/AccTableEventListener.obj	\
+            $(SLO)$/AccTreeEventListener.obj	\
+            $(SLO)$/AccTopWindowListener.obj	\
+			$(SLO)$/msaaservice_impl.obj 	\
+			$(SLO)$/checkmt.obj	\
+			$(SLO)$/AccResource.obj
+
+#SRCFILES=winaccessibility.src
+#RES1FILELIST=$(SRS)$/winaccessibility.srs
+#RESLIB1NAME=$(TARGET)
+#RESLIB1SRSFILES=$(RES1FILELIST)
+
+SHL1TARGET=winaccessibility
+SHL1IMPLIB=i$(SHL1TARGET)
+SHL1STDLIBS=\
+				$(VCLLIB)		\
+				$(CPPULIB)		\
+				$(SALLIB)		\
+				$(CPPUHELPERLIB) \
+				$(TOOLSLIB) \
+				$(TKLIB)		\
+				$(VOSLIB)	\
+			    $(UWINAPILIB)      \
+				$(GDI32LIB)        \
+				$(WINSPOOLLIB)     \
+				$(OLE32LIB)       \
+				$(SHELL32LIB)      \
+				$(ADVAPI32LIB)     \
+				$(IMM32LIB)		\
+				$(UUIDLIB)			\
+				oleacc.lib				
+				
+SHL1OBJS=$(SLOFILES) 
+SHL1VERSIONOBJ=
+SHL1DESCRIPTIONOBJ=
+
+DEF1NAME=$(SHL1TARGET)
+DEF1EXPORTFILE=exports.dxp
+
+
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE :	target.mk
+
+ALLTAR : \
+    $(MISC)/winaccessibility.component
+
+.IF "$(OS)" == "WNT"
+my_platform = .windows
+.END
+
+$(MISC)/winaccessibility.component .ERRREMOVE : \
+        $(SOLARENV)/bin/createcomponent.xslt winaccessibility.component
+    $(XSLTPROC) --nonet --stringparam uri \
+        '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
+        $(SOLARENV)/bin/createcomponent.xslt winaccessibility.component
+
+
+.ENDIF			# "$(GUI)"=="WNT"
diff --git a/main/winaccessibility/source/service/msaaservice_impl.cxx b/main/winaccessibility/source/service/msaaservice_impl.cxx
new file mode 100644
index 0000000..ca6c045
--- /dev/null
+++ b/main/winaccessibility/source/service/msaaservice_impl.cxx
@@ -0,0 +1,289 @@
+/**************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+ *************************************************************/

+

+#include <cppuhelper/implbase3.hxx>
+#include <cppuhelper/factory.hxx>
+#include <cppuhelper/implementationentry.hxx>
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+#include <com/sun/star/accessibility/XMSAAService.hpp>
+
+#include <com/sun/star/awt/XExtendedToolkit.hpp>
+#include <vcl/svapp.hxx>
+

+using namespace ::rtl; // for OUString
+using namespace ::com::sun::star; // for odk interfaces
+using namespace ::com::sun::star::uno; // for basic types
+using namespace ::com::sun::star::accessibility;
+
+using namespace ::com::sun::star::awt;
+

+typedef sal_Int32 HWND;

+
+#include "AccTopWindowListener.hxx"
+#include "g_msacc.hxx"

+
+extern void FreeTopWindowListener();
+extern long GetMSComPtr(long hWnd, long lParam, long wParam);
+extern void handleWindowOpened_impl( long pAcc);
+
+
+namespace my_sc_impl
+{
+
+extern Sequence< OUString > SAL_CALL  getSupportedServiceNames_MSAAServiceImpl();
+extern OUString SAL_CALL getImplementationName_MSAAServiceImpl();
+extern Reference< XInterface > SAL_CALL create_MSAAServiceImpl(
+        Reference< XComponentContext > const & xContext )
+    SAL_THROW( () );
+/**
+   * Method that returns the service name.
+   * @param
+   * @return Name sequence.
+   */
+static Sequence< OUString > getSupportedServiceNames_MSAAServiceImpl()
+{
+    static Sequence < OUString > *pNames = 0;
+    if( ! pNames )
+    {
+        //		MutexGuard guard( Mutex::getGlobalMutex() );
+        if( !pNames )
+        {
+            static Sequence< OUString > seqNames(1);
+            seqNames.getArray()[0] = OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.MSAAService"));
+            pNames = &seqNames;
+        }
+    }
+    return *pNames;
+}
+
+/**
+   * Method that returns the service name.
+   * @param
+   * @return Name sequence.
+   */
+static OUString getImplementationName_MSAAServiceImpl()
+{
+    static OUString *pImplName = 0;
+    if( ! pImplName )
+    {
+        //		MutexGuard guard( Mutex::getGlobalMutex() );
+        if( ! pImplName )
+        {
+            static OUString implName( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.my_sc_implementation.MSAAService") );
+            pImplName = &implName;
+        }
+    }
+    return *pImplName;
+}
+
+class MSAAServiceImpl : public ::cppu::WeakImplHelper3<
+            XMSAAService, lang::XServiceInfo, lang::XInitialization >
+{
+    OUString m_arg;
+public:
+    // focus on three given interfaces,
+    // no need to implement XInterface, XTypeProvider, XWeak
+    MSAAServiceImpl ();
+    virtual ~MSAAServiceImpl( void );
+    // XInitialization will be called upon createInstanceWithArguments[AndContext]()
+    virtual void SAL_CALL initialize( Sequence< Any > const & args )
+    throw (Exception);
+    // XMSAAService
+    virtual sal_Int32 SAL_CALL getAccObjectPtr (long hWnd, long lParam, long wParam)
+    throw (RuntimeException);
+    virtual void SAL_CALL handleWindowOpened(sal_Int32)
+    throw (RuntimeException);
+    // XServiceInfo
+    virtual OUString SAL_CALL getImplementationName()
+    throw (RuntimeException);
+    virtual sal_Bool SAL_CALL supportsService( OUString const & serviceName )
+    throw (RuntimeException);
+    virtual Sequence< OUString > SAL_CALL getSupportedServiceNames()
+    throw (RuntimeException);
+};
+
+/**
+   * Implemention of XInitialization.
+   * @param
+   * @return.
+   */
+void MSAAServiceImpl::initialize( Sequence< Any > const & args ) throw (Exception)
+{
+    if (1 != args.getLength())
+    {
+        throw lang::IllegalArgumentException(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("give a string instanciating this component!") ),
+            (::cppu::OWeakObject *)this, // resolve to XInterface reference
+            0 ); // argument pos
+    }
+    if (! (args[ 0 ] >>= m_arg))
+    {
+        throw lang::IllegalArgumentException(
+            OUString( RTL_CONSTASCII_USTRINGPARAM("no string given as argument!") ),
+            (::cppu::OWeakObject *)this, // resolve to XInterface reference
+            0 ); // argument pos
+    }
+}
+
+/**
+   * Implemention of getAccObjectPtr.
+   * @param
+   * @return Com interface.
+   */
+sal_Int32 MSAAServiceImpl::getAccObjectPtr ( long hWnd, long lParam, long wParam) throw (RuntimeException)
+{
+    return GetMSComPtr(hWnd, lParam, wParam);
+}
+
+/**
+   * Implemention of handleWindowOpened,the method will be invoked when a top window
+   * opened and AT starts up.
+   * @param
+   * @return
+   */
+void MSAAServiceImpl::handleWindowOpened( sal_Int32 pAcc)
+{
+    handleWindowOpened_impl(pAcc);
+}
+
+/**
+   * Implemention of XServiceInfo.
+   * @param
+   * @return Implementataion name.
+   */
+OUString MSAAServiceImpl::getImplementationName() throw (RuntimeException)
+{
+    // unique implementation name
+    return OUString( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.accessibility.my_sc_impl.MSAAService") );
+}
+
+/**
+   * Implemention of XServiceInfo,return support service name.
+   * @param Service name.
+   * @return If the service name is supported.
+   */
+sal_Bool MSAAServiceImpl::supportsService( OUString const & serviceName ) throw (RuntimeException)
+{
+    // this object only supports one service, so the test is simple
+    return serviceName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM("com.sun.star.accessibility.MSAAService") );
+}
+
+/**
+   * Implemention of XServiceInfo,return all service names.
+   * @param.
+   * @return service name sequence.
+   */
+Sequence< OUString > MSAAServiceImpl::getSupportedServiceNames() throw (RuntimeException)
+{
+    return getSupportedServiceNames_MSAAServiceImpl();
+}
+
+/**
+   * Static method that can create an entity of our MSAA Service
+   * @param xContext No use here.
+   * @return The object interface.
+   */
+Reference< XInterface > SAL_CALL create_MSAAServiceImpl( Reference< XComponentContext > const & /*xContext*/ ) SAL_THROW( () )
+{
+    MSAAServiceImpl* xxx = new MSAAServiceImpl();
+    //return static_cast< lang::XTypeProvider * >(  xxx );
+    Reference< XMSAAService > p( xxx );
+    return p;
+}
+
+/**
+   * Constructor.
+   * @param 
+   * @return
+   */
+MSAAServiceImpl::MSAAServiceImpl()
+{
+    Reference< XExtendedToolkit > xToolkit =
+        Reference< XExtendedToolkit >(Application::GetVCLToolkit(), UNO_QUERY);
+
+    if(xToolkit.is())
+    {
+        AccTopWindowListener *accListener;
+        accListener = new AccTopWindowListener();
+        g_pTop = accListener;
+        Reference< XTopWindowListener> x(accListener);
+        xToolkit->addTopWindowListener(x);
+    }
+}
+
+/**
+   * Static method that can create an entity of our MSAA Service
+   * @param Destructor
+   * @return
+   */
+MSAAServiceImpl::~MSAAServiceImpl()
+{
+
+    // As all folders and streams contain references to their parents,
+    // we must remove these references so that they will be deleted when
+    // the hash_map of the root folder is cleared, releasing all subfolders
+    // and substreams which in turn release theirs, etc. When xRootFolder is
+    // released when this destructor completes, the folder tree should be
+    // deleted fully (and automagically).
+    FreeTopWindowListener();
+
+
+}
+
+}
+
+/* shared lib exports implemented without helpers in service_impl1.cxx */
+namespace my_sc_impl
+{
+static struct ::cppu::ImplementationEntry s_component_entries [] =
+    {
+        {
+            create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
+            getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
+            0, 0
+        },
+        {
+            create_MSAAServiceImpl, getImplementationName_MSAAServiceImpl,
+            getSupportedServiceNames_MSAAServiceImpl, ::cppu::createSingleComponentFactory,
+            0, 0
+        },
+        { 0, 0, 0, 0, 0, 0 }
+    };
+}
+
+extern "C"
+{
+    void SAL_CALL component_getImplementationEnvironment(
+        sal_Char const ** ppEnvTypeName, uno_Environment ** /*ppEnv*/ )
+    {
+        *ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
+    }

+    void * SAL_CALL component_getFactory(
+        sal_Char const * implName, lang::XMultiServiceFactory * xMgr,
+        registry::XRegistryKey * xRegistry )
+    {
+        return ::cppu::component_getFactoryHelper(
+                   implName, xMgr, xRegistry, ::my_sc_impl::s_component_entries );
+    }
+}
diff --git a/main/winaccessibility/source/service/winaccessibility.component b/main/winaccessibility/source/service/winaccessibility.component
new file mode 100644
index 0000000..d2dfe39
--- /dev/null
+++ b/main/winaccessibility/source/service/winaccessibility.component
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--**********************************************************************
+ * 
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ * 
+**********************************************************************-->
+<component loader="com.sun.star.loader.SharedLibrary"
+    xmlns="http://openoffice.org/2010/uno-components">
+  <implementation name="com.sun.star.accessibility.my_sc_implementation.MSAAService">
+    <service name="com.sun.star.accessibility.MSAAService"/>
+  </implementation>
+</component>