You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by st...@apache.org on 2013/04/23 11:51:53 UTC

svn commit: r1470868 [30/40] - in /openoffice/branches/ia2: ./ ext_libraries/coinmp/ ext_libraries/serf/ ext_libraries/serf/win/ extras/l10n/source/fi/ main/ main/animations/source/animcore/ main/automation/source/communi/ main/basctl/source/basicide/ ...

Modified: openoffice/branches/ia2/main/sw/source/core/access/accmap.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/access/accmap.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/access/accmap.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/access/accmap.cxx Tue Apr 23 09:51:15 2013
@@ -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 @@ SwAccessibleObjShape_Impl
 		{
 			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 @@ private:
 	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 @@ public:
 
     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 @@ public:
           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 @@ public:
         : 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 @@ public:
     {
         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 @@ static sal_Bool AreInSameTable( const un
 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 @@ void SwAccessibleMap::InvalidateShapeSel
 		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;
+
+	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;
 
-void SwAccessibleMap::DoInvalidateShapeSelection()
+	{
+		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 @@ void SwAccessibleMap::DoInvalidateShapeS
 	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 @@ void SwAccessibleMap::DoInvalidateShapeS
 
 	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 @@ void SwAccessibleMap::DoInvalidateShapeS
                                                     GetShell()->IsPreView() );
                     aParents.push_back( pParent );
 				}
+				*/
 			}
 
 			--nShapes;
 			++pShape;
 		}
-		if( aParents.size() > 0 )
+
+		const int SELECTION_WITH_NUM =10;
+		if (vecxShapeAdd.size() > SELECTION_WITH_NUM )
 		{
-			::std::list< const SwFrm * >::const_iterator aIter = aParents.begin();
-			::std::list< const SwFrm * >::const_iterator aEndIter = aParents.end();
-			while( aIter != aEndIter )
+			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)
 			{
-				::vos::ORef< SwAccessibleContext > xParentAccImpl;
+				::accessibility::AccessibleShape *pAccShape = static_cast< ::accessibility::AccessibleShape * >(vi->getBodyPtr());
+				if (pAccShape)
 				{
-					vos::OGuard aGuard( maMutex );
-					if(  mpFrmMap )
+					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 )
 					{
-						SwAccessibleContextMap_Impl::const_iterator aMapIter =
-							mpFrmMap->find( *aIter );
-						if( aMapIter != mpFrmMap->end() )
+						uno::Reference< XAccessible > xPara = pAccShape->getAccessibleParent();
+						if (xPara.is())
 						{
-							uno::Reference < XAccessible > xAcc( (*aMapIter).second );
-							xParentAccImpl =
-								static_cast< SwAccessibleContext *>( xAcc.get() );
+							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);
+								}
+							}
 						}
 					}
 				}
-				if( xParentAccImpl.isValid() )
+			}
+		}
+		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)
 				{
-					AccessibleEventObject aEvent;
-					aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
-					xParentAccImpl->FireAccessibleEvent( aEvent );
+					SwAccessibleParagraph* pAccPara = static_cast< SwAccessibleParagraph *>(xPara.get());
+					if (m_setParaAdd.count(pAccPara) == 0 )
+					{
+						m_setParaRemove.insert(pAccPara);
+					}
 				}
-
-				++aIter;
 			}
-		}
-
+		}		
 		delete[] pShapes;
 	}
 }
 
+//Marge with DoInvalidateShapeSelection
+/*
 void SwAccessibleMap::DoInvalidateShapeFocus()
 {
 	const ViewShell *pVSh = GetShell();
@@ -1177,7 +1702,8 @@ void SwAccessibleMap::DoInvalidateShapeF
 		delete[] pShapes;
 	}
 }
-
+*/
+//-----IAccessibility2 Implementation 2009
 
 SwAccessibleMap::SwAccessibleMap( ViewShell *pSh ) :
 	mpFrmMap( 0  ),
@@ -1193,7 +1719,8 @@ SwAccessibleMap::SwAccessibleMap( ViewSh
 	mnPara( 1 ),
 	mnFootnote( 1 ),
 	mnEndnote( 1 ),
-	mbShapeSelected( sal_False )
+	mbShapeSelected( sal_False ),
+	mpSeletedFrmMap(NULL)//IAccessibility2 Implementation 2009
 {
 	pSh->GetLayout()->AddAccessibleShell();
 }
@@ -1214,10 +1741,28 @@ SwAccessibleMap::~SwAccessibleMap()
 		}
 	}
 
+	//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 @@ SwAccessibleMap::~SwAccessibleMap()
 		mpEvents = 0;
 	}
 	mpVSh->GetLayout()->RemoveAccessibleShell();
+	delete mpSeletedFrmMap;//IAccessibility2 Implementation 2009
 }
 
 uno::Reference< XAccessible > SwAccessibleMap::_GetDocumentView(
@@ -1429,7 +1975,7 @@ uno::Reference< XAccessible> SwAccessibl
 						sal_Bool bIsEndnote =
 							SwAccessibleFootnote::IsEndnote( pFtnFrm );
 						pAcc = new SwAccessibleFootnote( this, bIsEndnote,
-									(bIsEndnote ? mnEndnote++ : mnFootnote++),
+									/*(bIsEndnote ? mnEndnote++ : mnFootnote++),*/
 									pFtnFrm );
 					}
 					break;
@@ -1584,6 +2130,10 @@ uno::Reference< XAccessible> SwAccessibl
 					}
 					// TODO: focus!!!
 				}
+				//IAccessibility2 Implementation 2009-----
+				if (xAcc.is())
+					AddGroupContext(pObj, xAcc);
+				//-----IAccessibility2 Implementation 2009
 			}
 		}
 	}
@@ -1594,6 +2144,105 @@ uno::Reference< XAccessible> SwAccessibl
 
 	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 @@ void SwAccessibleMap::RemoveContext( con
 			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 @@ void SwAccessibleMap::InvalidatePosOrSiz
 	{
 		::vos::ORef< SwAccessibleContext > xAccImpl;
 		::vos::ORef< SwAccessibleContext > xParentAccImpl;
+		const SwFrm *pParent =NULL; //IAccessibility2 Implementation 2009
 		{
 			vos::OGuard aGuard( maMutex );
 
@@ -1831,7 +2484,7 @@ void SwAccessibleMap::InvalidatePosOrSiz
 				{
 					// 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 @@ void SwAccessibleMap::InvalidatePosOrSiz
 														  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 @@ void SwAccessibleMap::InvalidateCursorPo
 				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 @@ void SwAccessibleMap::InvalidateCursorPo
 					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 @@ void SwAccessibleMap::InvalidateFocus()
 			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 @@ void SwAccessibleMap::FireEvents()
 		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 @@ sal_Bool SwAccessibleMap::ReplaceChild (
 	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 @@ const SwRect& SwAccessibleMap::GetVisAre
            : GetShell()->VisArea();
 }
 
+//IAccessibility2 Implementation 2009-----
+sal_Bool SwAccessibleMap::IsDocumentSelAll()
+{
+	return GetShell()->GetDoc()->IsPrepareSelAll();
+}
+//-----IAccessibility2 Implementation 2009
+

Modified: openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.cxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.cxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.cxx Tue Apr 23 09:51:15 2013
@@ -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 SwNoTxtNode *SwAccessibleNoTextFra
 	{
 		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 @@ OUString SAL_CALL SwAccessibleNoTextFram
 	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 @@ uno::Any SAL_CALL SwAccessibleNoTextFram
         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 @@ sal_Int32 SAL_CALL SwAccessibleNoTextFra
 {
     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

Modified: openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.hxx?rev=1470868&r1=1470867&r2=1470868&view=diff
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.hxx (original)
+++ openoffice/branches/ia2/main/sw/source/core/access/accnotextframe.hxx Tue Apr 23 09:51:15 2013
@@ -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 @@ public:
 
 	// 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
 };
 
 

Added: openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.cxx?rev=1470868&view=auto
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.cxx (added)
+++ openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.cxx Tue Apr 23 09:51:15 2013
@@ -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;
+}

Added: openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.hxx
URL: http://svn.apache.org/viewvc/openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.hxx?rev=1470868&view=auto
==============================================================================
--- openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.hxx (added)
+++ openoffice/branches/ia2/main/sw/source/core/access/accnotexthyperlink.hxx Tue Apr 23 09:51:15 2013
@@ -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
+