You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by hd...@apache.org on 2013/11/18 13:54:10 UTC

svn commit: r1543021 [13/29] - in /openoffice/branches/rejuvenate01: ./ main/ main/accessibility/inc/accessibility/extended/ main/accessibility/inc/accessibility/helper/ main/accessibility/inc/accessibility/standard/ main/accessibility/source/extended/...

Modified: openoffice/branches/rejuvenate01/main/svx/inc/svx/svdmrkv.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/inc/svx/svdmrkv.hxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/inc/svx/svdmrkv.hxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/inc/svx/svdmrkv.hxx Mon Nov 18 12:53:58 2013
@@ -511,6 +511,9 @@ public:
 	// Endpunkt der Spiegelachse
     const Point& GetRef2() const { return aRef1; }
     void SetRef2(const Point& rPt);
+//IAccessibility2 Implementation 2009-----
+	void UnmarkObj(SdrObject* pObj);
+//-----IAccessibility2 Implementation 2009
 };
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////

Modified: openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoashp.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoashp.hxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoashp.hxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoashp.hxx Mon Nov 18 12:53:58 2013
@@ -258,6 +258,10 @@ public:
 	static bool doConstructOrthogonal(const ::rtl::OUString& rName);
 
 	using SdrTextObj::NbcSetOutlinerParaObject;
+
+	//IAccessibility2 Implementation 2009-----
+	::rtl::OUString GetCustomShapeName();
+	//-----IAccessibility2 Implementation 2009
 };
 
 #endif //_SVDOASHP_HXX

Modified: openoffice/branches/rejuvenate01/main/svx/inc/svx/svdobj.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/inc/svx/svdobj.hxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/inc/svx/svdobj.hxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/inc/svx/svdobj.hxx Mon Nov 18 12:53:58 2013
@@ -452,6 +452,9 @@ protected:
 	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 @@ public:
     // #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 );
 

Modified: openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoole2.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoole2.hxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoole2.hxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/inc/svx/svdoole2.hxx Mon Nov 18 12:53:58 2013
@@ -84,6 +84,9 @@ protected:
 	void Init();
 
 public:
+//IAccessibility2 Implementation 2009-----
+	String GetStyleString();
+//-----IAccessibility2 Implementation 2009
 	TYPEINFO();
 
 	SdrOle2Obj(FASTBOOL bFrame_=sal_False);

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleControlShape.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleControlShape.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleControlShape.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleControlShape.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ namespace
 		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< XAccessible > SAL_CALL Access
 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 @@ void SAL_CALL AccessibleControlShape::el
 {
     // 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

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleEmptyEditSource.cxx Mon Nov 18 12:53:58 2013
@@ -153,7 +153,7 @@ namespace accessibility
         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; }

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleFrameSelector.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleFrameSelector.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleFrameSelector.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleFrameSelector.cxx Mon Nov 18 12:53:58 2013
@@ -190,7 +190,10 @@ sal_Int32 AccFrameSelector::getAccessibl
 
 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 @@ Reference< XAccessibleRelationSet > AccF
     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::NotifyAccessibleE
 
 void AccFrameSelector::Invalidate()
 {
+	if ( mpFrameSel )
+    {
+        mpFrameSel->RemoveEventListener( LINK( this, AccFrameSelector, WindowEventListener ) );
+    }
     mpFrameSel = 0;
     EventObject aEvent;
     Reference < XAccessibleContext > xThis( this );

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleGraphicShape.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleGraphicShape.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleGraphicShape.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleGraphicShape.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ AccessibleGraphicShape::~AccessibleGraph
 ::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 @@ uno::Sequence<uno::Type> SAL_CALL
     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
+
+

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleOLEShape.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleOLEShape.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleOLEShape.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleOLEShape.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ uno::Sequence<uno::Type> SAL_CALL
 
 	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.

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleShape.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleShape.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleShape.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleShape.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ OUString GetOptionalProperty (
 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 @@ AccessibleShape::AccessibleShape (
 	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 @@ void AccessibleShape::UpdateStates (void
     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 @@ sal_Bool AccessibleShape::GetState (sal_
     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 @@ uno::Reference<XAccessible> SAL_CALL
     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 @@ uno::Reference<XAccessibleStateSet> SAL_
 
 	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 @@ uno::Reference<XAccessibleStateSet> SAL_
                 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 @@ sal_Int32 SAL_CALL AccessibleShape::getB
             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 @@ com::sun::star::uno::Any SAL_CALL
         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 @@ void SAL_CALL
 {
     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 @@ void SAL_CALL
     {
         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 @@ void AccessibleShape::ViewForwarderChang
     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)
-    {
-        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));
-        }
-
+    //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 )
+    {
+    	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 @@ void AccessibleShape::UpdateNameAndDescr
     {
     }
 }
+//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

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleTextHelper.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleTextHelper.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleTextHelper.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/AccessibleTextHelper.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ using namespace ::com::sun::star::access
 
 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 @@ namespace accessibility
         {
             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 @@ namespace accessibility
             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 @@ namespace accessibility
 
                 // 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 @@ namespace accessibility
                                                                                    mxFrontEnd, GetEditSource(), nCurrPara ).first ),
                                           AccessibleEventId::CHILD );
                     }
+		    //IAccessibility2 Implementation 2009-----
+				/*
                 }
                 else
                 {
@@ -897,7 +968,8 @@ namespace accessibility
                         // clear reference
                         maParaManager.Release( nCurrPara );
                     }
-                }
+                }*/
+				//-----IAccessibility2 Implementation 2009
             }
         }
         catch( const uno::Exception& )
@@ -1376,6 +1448,12 @@ namespace accessibility
                         {
                             case HINT_BEGEDIT:
                             {
+			    //IAccessibility2 Implementation 2009-----
+								if(!IsActive())
+								{
+									break;
+								}
+//-----IAccessibility2 Implementation 2009
                                 // change children state
                                 maParaManager.SetActive();
 

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManager.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManager.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManager.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManager.cxx Mon Nov 18 12:53:58 2013
@@ -86,7 +86,22 @@ long ChildrenManager::GetChildCount (voi
     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)

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ long ChildrenManagerImpl::GetChildCount 
 }
 
 
-
+//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 @@ sal_Bool ChildrenManagerImpl::ReplaceChi
 
     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 @@ void ChildrenManagerImpl::UpdateSelectio
     // 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 @@ void ChildrenManagerImpl::UpdateSelectio
 
             // 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 @@ void ChildrenManagerImpl::UpdateSelectio
             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;

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.hxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.hxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/ChildrenManagerImpl.hxx Mon Nov 18 12:53:58 2013
@@ -126,6 +126,11 @@ public:
     */
     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 @@ public:
 		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.

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/ShapeTypeHandler.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/ShapeTypeHandler.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/ShapeTypeHandler.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/ShapeTypeHandler.cxx Mon Nov 18 12:53:58 2013
@@ -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 @@ long ShapeTypeHandler::GetSlotId (const 
         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;

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/charmapacc.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/charmapacc.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/charmapacc.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/charmapacc.cxx Mon Nov 18 12:53:58 2013
@@ -166,7 +166,8 @@ Reference< XAccessible > SAL_CALL SvxSho
 // -----------------------------------------------------------------------------
 ::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 @@ Reference< XAccessible > SAL_CALL SvxSho
     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 @@ void SvxShowCharSetAcc::implSelect( sal_
 // -----------------------------------------------------------------------------
 ::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 @@ uno::Reference< accessibility::XAccessib
 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_Int16 SAL_CALL SvxShowCharSetItemAcc
 	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 @@ uno::Reference< accessibility::XAccessib
 
     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 @@ uno::Reference< accessibility::XAccessib
        	    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 );
     }
 

Modified: openoffice/branches/rejuvenate01/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/rejuvenate01/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx?rev=1543021&r1=1543020&r2=1543021&view=diff
==============================================================================
--- openoffice/branches/rejuvenate01/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx (original)
+++ openoffice/branches/rejuvenate01/main/svx/source/accessibility/svxrectctaccessiblecontext.cxx Mon Nov 18 12:53:58 2013
@@ -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;
 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_Int32 SAL_CALL SvxRectCtlAccessibleC
 
 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 @@ sal_Int16 SAL_CALL SvxRectCtlAccessibleC
 */
 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 @@ Reference< XAccessibleStateSet > SAL_CAL
 
 	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 @@ void SvxRectCtlAccessibleContext::checkC
 		// 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 @@ void SvxRectCtlAccessibleContext::select
 			{	// 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 @@ void SvxRectCtlAccessibleContext::select
 			{
 				pChild = mpChilds[ nNew ];
 				if( pChild )
-					pChild->setStateChecked( sal_True );
+					pChild->setStateChecked( sal_True, bFireFocus );
 			}
 		}
 		else
@@ -666,12 +745,12 @@ void SvxRectCtlAccessibleContext::select
 	}
 }
 
-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 @@ sal_Int16 SAL_CALL SvxRectCtlChildAccess
 */
 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 @@ Any SAL_CALL SvxRectCtlChildAccessibleCo
 	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 @@ Rectangle SvxRectCtlChildAccessibleConte
 
 	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 @@ void SvxRectCtlChildAccessibleContext::s
 		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.