Commits

Anonymous committed d521ed5

accstuff: merged remaining changes from CWS oo31ia2, module sc

  • Participants
  • Parent commits c72dcda

Comments (0)

Files changed (62)

sc/inc/chgtrack.hxx

 #endif
 
 #define DEBUG_CHANGETRACK 0
+//IAccessibility2 Implementation 2009-----
+class ScChangeAction;
+class ScAppOptions;
+class ScActionColorChanger
+{
+private:
+	const ScAppOptions&		rOpt;
+	const ScStrCollection&	rUsers;
+	String					aLastUserName;
+	sal_uInt16					nLastUserIndex;
+	ColorData				nColor;
 
-
+public:
+				ScActionColorChanger( const ScChangeTrack& rTrack );
+				~ScActionColorChanger() {}
+				void		Update( const ScChangeAction& rAction );
+				ColorData	GetColor() const	{ return nColor; }
+};
+//-----IAccessibility2 Implementation 2009
 class ScBaseCell;
 class ScDocument;
 

sc/inc/detfunc.hxx

 	static ColorData GetCommentColor();
 	static void InitializeColors();
 	static sal_Bool	IsColorsInitialized();
+//IAccessibility2 Implementation 2009-----
+	static void AppendChangTrackNoteSeparator(String &str);
+//-----IAccessibility2 Implementation 2009
 };
 
 

sc/inc/document.hxx

 
     sal_Int16           mnNamedRangesLockCount;
 
+//IAccessibility2 Implementation 2009-----
+	String msDocAccTitle;
 public:
+	// SC_DLLPUBLIC sal_Bool RowHidden( SCROW nRow, SCTAB nTab );
+	//inline sal_Bool 		RowHidden( SCROW nRow, SCTAB nTab );		// FillInfo
+	virtual void setDocAccTitle( const String& rTitle ) { msDocAccTitle = rTitle; }
+	virtual const String getDocAccTitle() const { return msDocAccTitle; }
+
+private:	
+	sal_Bool bReadOnly;  // MT: Really needed???
+
+public:
+	virtual void setDocReadOnly( sal_Bool b){ bReadOnly = b; }
+	virtual sal_Bool getDocReadOnly() const { return bReadOnly; }
+	sal_Bool IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder);
+	void GetCellChangeTrackNote( const ScAddress &cell,String &strTrackText,sal_Bool &pbLeftEdge);
+//-----IAccessibility2 Implementation 2009
 	SC_DLLPUBLIC sal_uLong			GetCellCount() const;		// alle Zellen
     SCSIZE          GetCellCount(SCTAB nTab, SCCOL nCol) const;
 	sal_uLong			GetWeightedCount() const;	// Formeln und Edit staerker gewichtet
 public:
 	SC_DLLPUBLIC 				ScDocument( ScDocumentMode eMode = SCDOCMODE_DOCUMENT,
 								SfxObjectShell* pDocShell = NULL );
-	SC_DLLPUBLIC 				~ScDocument();
+	SC_DLLPUBLIC 				virtual ~ScDocument();
 
 	inline ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >
 					GetServiceManager() const { return xServiceManager; }
 	SC_DLLPUBLIC void			InitDrawLayer( SfxObjectShell* pDocShell = NULL );
 	XColorTable*	GetColorTable();
 
+//IAccessibility2 Implementation 2009-----
+	ScTable*      GetTableByIndex(sal_Int32 nIndex);
+//-----IAccessibility2 Implementation 2009
 	SC_DLLPUBLIC sfx2::LinkManager*		GetLinkManager() const;
 
 	SC_DLLPUBLIC const ScDocOptions&		GetDocOptions() const;

sc/inc/drwlayer.hxx

 							const Point& rWinPoint, const Window& rCmpWnd );
 
     static ScMacroInfo* GetMacroInfo( SdrObject* pObj, sal_Bool bCreate = sal_False );
+//IAccessibility2 Implementation 2009-----
+	virtual ImageMap* GetImageMapForObject(SdrObject* pObj);
+	virtual sal_Int32 GetHyperlinkCount(SdrObject* pObj);
+//-----IAccessibility2 Implementation 2009
 
 private:
 	static SfxObjectShell* pGlobalDrawPersist;			// fuer AllocModel
         SCROW mnCurRow;
         SCROW mnUBound;
     };
+
+//IAccessibility2 Implementation 2009-----
+public :
+	ScColumn* GetColumnByIndex(sal_Int32 index);
+//-----IAccessibility2 Implementation 2009
 };
 
 

sc/source/core/data/documen2.cxx

 #include "recursionhelper.hxx"
 #include "lookupcache.hxx"
 #include "externalrefmgr.hxx"
+//IAccessibility2 Implementation 2009-----
+#include "appoptio.hxx"
+#include "scmod.hxx"
+#include "../../ui/inc/viewutil.hxx"
+//-----IAccessibility2 Implementation 2009
 #include "tabprotection.hxx"
 #include "formulaparserpool.hxx"
 #include "clipparam.hxx"
         mbExecuteLinkEnabled( true ),
         mbChangeReadOnlyEnabled( false ),
         mbStreamValidLocked( false ),
-        mnNamedRangesLockCount( 0 )
+        mnNamedRangesLockCount( 0 ),
+	bReadOnly(sal_False)
 {
     SetStorageGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT);
 
     if( pLookupCacheMapImpl )
         pLookupCacheMapImpl->clear();
 }
+//IAccessibility2 Implementation 2009-----
+sal_Bool ScDocument::IsCellInChangeTrack(const ScAddress &cell,Color *pColCellBoder)
+{
+	ScChangeTrack* pTrack = GetChangeTrack();
+	ScChangeViewSettings* pSettings = GetChangeViewSettings();
+	if ( !pTrack || !pTrack->GetFirst() || !pSettings || !pSettings->ShowChanges() )
+		return sal_False;			// nix da oder abgeschaltet
+	ScActionColorChanger aColorChanger(*pTrack);
+	//	Clipping passiert von aussen
+	//!	ohne Clipping, nur betroffene Zeilen painten ??!??!?
+	const ScChangeAction* pAction = pTrack->GetFirst();
+	while (pAction)
+	{
+		ScChangeActionType eType;
+		if ( pAction->IsVisible() )
+		{
+			eType = pAction->GetType();
+			const ScBigRange& rBig = pAction->GetBigRange();
+			if ( rBig.aStart.Tab() == cell.Tab())
+			{
+				ScRange aRange = rBig.MakeRange();
+				if ( eType == SC_CAT_DELETE_ROWS )
+					aRange.aEnd.SetRow( aRange.aStart.Row() );
+				else if ( eType == SC_CAT_DELETE_COLS )
+					aRange.aEnd.SetCol( aRange.aStart.Col() );
+				if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+				{
+					if (aRange.In(cell))
+					{
+						if (pColCellBoder != NULL)
+						{
+							aColorChanger.Update( *pAction );
+							Color aColor( aColorChanger.GetColor() );
+							*pColCellBoder = aColor;
+						}
+						return sal_True;
+					}
+				}
+			}
+			if ( eType == SC_CAT_MOVE &&
+				((const ScChangeActionMove*)pAction)->
+				GetFromRange().aStart.Tab() == cell.Col() )
+			{
+				ScRange aRange = ((const ScChangeActionMove*)pAction)->
+					GetFromRange().MakeRange();
+				if (ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+				{
+					if (aRange.In(cell))
+					{
+						if (pColCellBoder != NULL)
+						{
+							aColorChanger.Update( *pAction );
+							Color aColor( aColorChanger.GetColor() );
+							*pColCellBoder = aColor;
+						}
+						return sal_True;
+					}
+				}
+			}
+		}
+		pAction = pAction->GetNext();
+	}
+	return sal_False;
+}
+void ScDocument::GetCellChangeTrackNote( const ScAddress &aCellPos,String &aTrackText,sal_Bool &bLeftEdge)
+{
+	aTrackText=String();
+	//	Change-Tracking
+	ScChangeTrack* pTrack = GetChangeTrack();
+	ScChangeViewSettings* pSettings = GetChangeViewSettings();
+	if ( pTrack && pTrack->GetFirst() && pSettings && pSettings->ShowChanges())
+	{
+		const ScChangeAction* pFound = NULL;
+		const ScChangeAction* pFoundContent = NULL;
+		const ScChangeAction* pFoundMove = NULL;
+		long nModified = 0;
+		const ScChangeAction* pAction = pTrack->GetFirst();
+		while (pAction)
+		{
+			if ( pAction->IsVisible() &&
+				 ScViewUtil::IsActionShown( *pAction, *pSettings, *this ) )
+			{
+				ScChangeActionType eType = pAction->GetType();
+				const ScBigRange& rBig = pAction->GetBigRange();
+				if ( rBig.aStart.Tab() == aCellPos.Tab())
+				{
+					ScRange aRange = rBig.MakeRange();
+					if ( eType == SC_CAT_DELETE_ROWS )
+						aRange.aEnd.SetRow( aRange.aStart.Row() );
+					else if ( eType == SC_CAT_DELETE_COLS )
+						aRange.aEnd.SetCol( aRange.aStart.Col() );
+					if ( aRange.In( aCellPos ) )
+					{
+						pFound = pAction;		// der letzte gewinnt
+						switch ( eType )
+						{
+							case SC_CAT_CONTENT :
+								pFoundContent = pAction;
+							break;
+							case SC_CAT_MOVE :
+								pFoundMove = pAction;
+							break;
+							default:
+								break;
+						}
+						++nModified;
+					}
+				}
+				if ( eType == SC_CAT_MOVE )
+				{
+					ScRange aRange =
+						((const ScChangeActionMove*)pAction)->
+						GetFromRange().MakeRange();
+					if ( aRange.In( aCellPos ) )
+					{
+						pFound = pAction;
+						++nModified;
+					}
+				}
+			}
+			pAction = pAction->GetNext();
+		}
+		if ( pFound )
+		{
+			if ( pFoundContent && pFound->GetType() != SC_CAT_CONTENT )
+				pFound = pFoundContent;		// Content gewinnt
+			if ( pFoundMove && pFound->GetType() != SC_CAT_MOVE &&
+					pFoundMove->GetActionNumber() >
+					pFound->GetActionNumber() )
+				pFound = pFoundMove;		// Move gewinnt
+			//	bei geloeschten Spalten: Pfeil auf die linke Seite der Zelle
+			if ( pFound->GetType() == SC_CAT_DELETE_COLS )
+				bLeftEdge = sal_True;
+			DateTime aDT = pFound->GetDateTime();
+			aTrackText  = pFound->GetUser();
+			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ", " ));
+            aTrackText += ScGlobal::pLocaleData->getDate(aDT);
+			aTrackText += ' ';
+            aTrackText += ScGlobal::pLocaleData->getTime(aDT);
+			aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( ":\n" ));
+			String aComStr=pFound->GetComment();
+			if(aComStr.Len()>0)
+			{
+				aTrackText += aComStr;
+				aTrackText.AppendAscii(RTL_CONSTASCII_STRINGPARAM( "\n( " ));
+			}
+			pFound->GetDescription( aTrackText, this );
+			if(aComStr.Len()>0)
+			{
+				aTrackText +=')';
+			}
+		}
+	}
+}
+//-----IAccessibility2 Implementation 2009

sc/source/core/data/document.cxx

 	return sal_False;
 }
 
+//IAccessibility2 Implementation 2009-----
+ScTable* ScDocument::GetTableByIndex(sal_Int32 nIndex)
+{
+  if ( nIndex <= MAXTAB && nIndex >= 0)
+     return  pTab[nIndex];
+
+  return NULL;
+}
+//-----IAccessibility2 Implementation 2009
 
 sal_Bool ScDocument::ValidTabName( const String& rName ) const
 {

sc/source/core/data/drwlayer.cxx

     }
     return 0;
 }
+//IAccessibility2 Implementation 2009-----
+ImageMap* ScDrawLayer::GetImageMapForObject(SdrObject* pObj)
+{
+	ScIMapInfo* pIMapInfo = const_cast<ScIMapInfo*>( GetIMapInfo( pObj ) );
+	if ( pIMapInfo )
+	{
+		return const_cast<ImageMap*>( &(pIMapInfo->GetImageMap()) );
+	}
+	return NULL;
+}
 
+sal_Int32 ScDrawLayer::GetHyperlinkCount(SdrObject* pObj)
+{
+	sal_Int32 nHLCount = 0;
+	ScMacroInfo* pMacroInfo = GetMacroInfo(pObj, sal_False);
+	if (pMacroInfo)
+		// MT IA2: GetHlink*( doesn|t exist in DEV300 anymore...
+		nHLCount = 0; // pMacroInfo->GetHlink().getLength() > 0 ? 1 : 0;
+	return nHLCount;
+}
+//-----IAccessibility2 Implementation 2009
 void ScDrawLayer::SetGlobalDrawPersist(SfxObjectShell* pPersist)			// static
 {
 	DBG_ASSERT(!pGlobalDrawPersist,"SetGlobalDrawPersist mehrfach");

sc/source/core/data/table2.cxx

 	return n;
 }
 
+//IAccessibility2 Implementation 2009-----
+ScColumn* ScTable::GetColumnByIndex(sal_Int32 index)
+{
+	if( index <= MAXCOL && index >= 0 )
+	{
+		return &(aCol[index]);
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
+

sc/source/core/tool/detfunc.cxx

 	return bColorsInitialized;
 }
 
+//IAccessibility2 Implementation 2009-----
+void ScDetectiveFunc::AppendChangTrackNoteSeparator(String &aDisplay)
+{
+	aDisplay.AppendAscii( RTL_CONSTASCII_STRINGPARAM("\n--------\n") );	
+}
+//-----IAccessibility2 Implementation 2009
+

sc/source/ui/Accessibility/AccessibleCell.cxx

 #include "editsrc.hxx"
 #include "dociter.hxx"
 #include "cell.hxx"
-
+// Sym2_3295----, added by Steve Yin
+#include "validat.hxx"
+// ----Sym2_3295
 #ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX
 #include <unotools/accessiblestatesethelper.hxx>
 #endif
 #include <comphelper/sequence.hxx>
 #include <float.h>
 
+//IAccessibility2 Implementation 2009-----
+#include "AccessibleSpreadsheet.hxx"
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
 
 	//=====  XInterface  =====================================================
 
-IMPLEMENT_FORWARD_XINTERFACE2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+IMPLEMENT_FORWARD_XINTERFACE3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl )
 
     //=====  XTypeProvider  ===================================================
 
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase )
+IMPLEMENT_FORWARD_XTYPEPROVIDER3( ScAccessibleCell, ScAccessibleCellBase, AccessibleStaticTextBase, ScAccessibleCellAttributeImpl )
 
 	//=====  XAccessibleComponent  ============================================
 
 		pStateSet->AddState(AccessibleStateType::DEFUNC);
     else
     {
+//IAccessibility2 Implementation 2009-----
+		if (IsFormulaMode())
+		{
+			pStateSet->AddState(AccessibleStateType::ENABLED);
+		    pStateSet->AddState(AccessibleStateType::MULTI_LINE);
+			pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+			if (IsOpaque(xParentStates))
+				pStateSet->AddState(AccessibleStateType::OPAQUE);
+			pStateSet->AddState(AccessibleStateType::SELECTABLE);
+			if (IsSelected())
+				pStateSet->AddState(AccessibleStateType::SELECTED);
+			if (isShowing())
+				pStateSet->AddState(AccessibleStateType::SHOWING);
+			pStateSet->AddState(AccessibleStateType::TRANSIENT);
+			if (isVisible())
+				pStateSet->AddState(AccessibleStateType::VISIBLE);
+			return pStateSet;
+		}
+//-----IAccessibility2 Implementation 2009
 	    if (IsEditable(xParentStates))
 	    {
 		    pStateSet->AddState(AccessibleStateType::EDITABLE);
 	    pStateSet->AddState(AccessibleStateType::ENABLED);
 	    pStateSet->AddState(AccessibleStateType::MULTI_LINE);
 	    pStateSet->AddState(AccessibleStateType::MULTI_SELECTABLE);
+//IAccessibility2 Implementation 2009-----
+	    pStateSet->AddState(AccessibleStateType::FOCUSABLE);
+//-----IAccessibility2 Implementation 2009
 	    if (IsOpaque(xParentStates))
 		    pStateSet->AddState(AccessibleStateType::OPAQUE);
 	    pStateSet->AddState(AccessibleStateType::SELECTABLE);
 
 sal_Bool ScAccessibleCell::IsSelected()
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		const ScAccessibleSpreadsheet *pSheet =static_cast<const ScAccessibleSpreadsheet*>(mxParent.get());
+		if (pSheet)
+		{
+			return pSheet->IsScAddrFormulaSel(maCellAddress);
+		}
+		return sal_False;
+	}
+//-----IAccessibility2 Implementation 2009
 	sal_Bool bResult(sal_False);
 	if (mpViewShell && mpViewShell->GetViewData())
 	{
 
 ::std::auto_ptr< SvxEditSource > ScAccessibleCell::CreateEditSource(ScTabViewShell* pViewShell, ScAddress aCell, ScSplitPos eSplitPos)
 {
+//IAccessibility2 Implementation 2009-----
+	if (IsFormulaMode())
+	{
+		return ::std::auto_ptr< SvxEditSource >();
+	}
+//-----IAccessibility2 Implementation 2009
 	::std::auto_ptr < ScAccessibleTextData > pAccessibleCellTextData
         ( new ScAccessibleCellTextData( pViewShell, aCell, eSplitPos, this ) );
 	::std::auto_ptr< SvxEditSource > pEditSource (new ScAccessibilityEditSource(pAccessibleCellTextData));
 		pRelationSet->AddRelation(aRelation);
 	}
 }
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString ReplaceOneChar(::rtl::OUString oldOUString, ::rtl::OUString replacedChar, ::rtl::OUString replaceStr)
+{
+	int iReplace = -1;
+	iReplace = oldOUString.lastIndexOf(replacedChar);
+	if (iReplace > -1)
+	{
+		for(;iReplace>-1;)
+		{
+			oldOUString = oldOUString.replaceAt(iReplace,1, replaceStr);
+			iReplace=oldOUString.lastIndexOf(replacedChar,iReplace);
+		}
+	}
+	return oldOUString;
+}
+::rtl::OUString ReplaceFourChar(::rtl::OUString oldOUString)
+{
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("\\"),::rtl::OUString::createFromAscii("\\\\"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(";"),::rtl::OUString::createFromAscii("\\;"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii("="),::rtl::OUString::createFromAscii("\\="));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(","),::rtl::OUString::createFromAscii("\\,"));
+	oldOUString = ReplaceOneChar(oldOUString,::rtl::OUString::createFromAscii(":"),::rtl::OUString::createFromAscii("\\:"));
+	return oldOUString;
+}
+
+uno::Any SAL_CALL ScAccessibleCell::get_attributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	uno::Any strRet;
+	if (mpViewShell)
+	{
+		const ::rtl::OUString strAttr(::rtl::OUString::createFromAscii(":"));
+		const ::rtl::OUString strSplit(::rtl::OUString::createFromAscii(";"));
+		::rtl::OUString strFor = mpViewShell->GetFormula(maCellAddress) ;
+		strFor = strFor.replaceAt(0,1,::rtl::OUString::createFromAscii(""));
+		strFor = ReplaceFourChar(strFor);
+		strFor =::rtl::OUString::createFromAscii("Formula:") + strFor;		
+		strFor +=strSplit; 
+		strFor +=::rtl::OUString::createFromAscii("Note:");
+		strFor +=ReplaceFourChar(GetAllDisplayNote());		
+		strFor +=strSplit; 
+		strFor += getShadowAttrs();//the string returned contains the spliter ";"
+		strFor += getBorderAttrs();//the string returned contains the spliter ";"
+		//end of cell attributes
+		if( mpDoc )
+		{
+			strFor += ::rtl::OUString::createFromAscii("isdropdown:");			
+			if( IsDropdown() ) 
+				strFor+= ::rtl::OUString::createFromAscii("true");
+			else
+				strFor+= ::rtl::OUString::createFromAscii("false");
+			strFor += ::rtl::OUString::createFromAscii(";");
+		}
+		strRet <<= strFor ;
+	}	
+	return strRet;
+}
+
+// Sym2_5070, cell has its own ParaIndent property, so when calling character attributes on cell, the ParaIndent should replace the ParaLeftMargin if its value is not zero.
+uno::Sequence< beans::PropertyValue > SAL_CALL ScAccessibleCell::getCharacterAttributes( sal_Int32 nIndex, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aRequestedAttributes ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	uno::Sequence< beans::PropertyValue > aAttribs = AccessibleStaticTextBase::getCharacterAttributes( nIndex, aRequestedAttributes );
+	beans::PropertyValue *pAttribs = aAttribs.getArray();
+
+	sal_uInt16 nParaIndent = static_cast< const SfxUInt16Item* >( mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_INDENT ) )->GetValue();
+	if (nParaIndent > 0)
+	{
+		::rtl::OUString sLeftMarginName (::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParaLeftMargin")));		
+		for (int i = 0; i < aAttribs.getLength(); ++i)
+		{
+			if (sLeftMarginName == pAttribs[i].Name)
+			{
+				pAttribs[i].Value = uno::makeAny( nParaIndent );
+				break;
+			}
+		}
+	}
+	return aAttribs;
+}
+
+sal_Bool ScAccessibleCell::IsFormulaMode()
+{
+	ScAccessibleSpreadsheet* pSheet =static_cast<ScAccessibleSpreadsheet*>(mxParent.get());
+	if (pSheet)
+	{
+		return pSheet->IsFormulaMode();
+	}
+	return sal_False;	
+}
+sal_Bool ScAccessibleCell::IsDropdown()
+{	
+	sal_uInt16 nPosX = maCellAddress.Col();
+	sal_uInt16 nPosY = sal_uInt16(maCellAddress.Row());
+	sal_uInt16 nTab = maCellAddress.Tab();
+	// Sym2_3295----, added by Steve Yin
+	sal_uInt32 nValidation = static_cast< const SfxUInt32Item* >( mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_VALIDDATA ) )->GetValue();
+    if( nValidation )
+    {
+        const ScValidationData* pData = mpDoc->GetValidationEntry( nValidation );
+        if( pData && pData->HasSelectionList() )
+            return sal_True;
+    }
+	// ----Sym2_3295
+	ScMergeFlagAttr* pAttr;
+	pAttr = (ScMergeFlagAttr*)mpDoc->GetAttr( nPosX, nPosY, nTab, ATTR_MERGE_FLAG );
+	if( pAttr->HasAutoFilter() )
+	{
+		return sal_True;	
+	}
+	else
+	{
+		sal_uInt16 nTabCount = mpDoc->GetTableCount();
+		if ( nTab+1<nTabCount && mpDoc->IsScenario(nTab+1) && !mpDoc->IsScenario(nTab) )
+		{
+			sal_uInt16 i;
+			ScMarkData aMarks;
+			for (i=nTab+1; i<nTabCount && mpDoc->IsScenario(i); i++)
+				mpDoc->MarkScenario( i, nTab, aMarks, sal_False, SC_SCENARIO_SHOWFRAME );
+			ScRangeList aRanges;
+			aMarks.FillRangeListWithMarks( &aRanges, sal_False );
+			sal_Bool bHasScenario;
+			sal_uInt16 nRangeCount = (sal_uInt16)aRanges.Count();
+			for (i=0; i<nRangeCount; i++)
+			{
+				ScRange aRange = *aRanges.GetObject(i);
+				mpDoc->ExtendTotalMerge( aRange );
+				sal_Bool bTextBelow = ( aRange.aStart.Row() == 0 );
+				// MT IA2: Not used: sal_Bool bIsInScen = sal_False;
+				if ( bTextBelow )
+				{
+					bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aEnd.Row() == nPosY-1);
+				}
+				else
+				{
+					bHasScenario = (aRange.aStart.Col() == nPosX && aRange.aStart.Row() == nPosY+1);
+				}
+				if( bHasScenario ) return sal_True;
+			}
+		}
+	}
+	return sal_False;
+}
+//-----IAccessibility2 Implementation 2009

sc/source/ui/Accessibility/AccessibleCellBase.cxx

 #include "sc.hrc"
 #endif
 #include "unonames.hxx"
-
+//IAccessibility2 Implementation 2009-----
+#include "detfunc.hxx"
+#include "chgtrack.hxx"
+//-----IAccessibility2 Implementation 2009
 #ifndef _COM_SUN_STAR_ACCESSIBILITY_XACCESSIBLEROLE_HPP_
 #include <com/sun/star/accessibility/AccessibleRole.hpp>
 #endif
 #include <rtl/uuid.h>
 #include <comphelper/sequence.hxx>
 #include <sfx2/objsh.hxx>
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/sheet/XSheetAnnotation.hpp>
+#include <com/sun/star/sheet/XSheetAnnotationAnchor.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+//-----IAccessibility2 Implementation 2009
 
 #include <float.h>
 
     ScAccessibleCellBase::createAccessibleName(void)
     throw (uno::RuntimeException)
 {
-	String sName( ScResId(STR_ACC_CELL_NAME) );
+//IAccessibility2 Implementation 2009-----
+	//String sName( ScResId(STR_ACC_CELL_NAME) );
 	String sAddress;
 	// Document not needed, because only the cell address, but not the tablename is needed
 	// always us OOO notation
 	maCellAddress.Format( sAddress, SCA_VALID, NULL );
-	sName.SearchAndReplaceAscii("%1", sAddress);
+	//sName.SearchAndReplaceAscii("%1", sAddress);
     /*  #i65103# ZoomText merges cell address and contents, e.g. if value 2 is
         contained in cell A1, ZT reads "cell A twelve" instead of "cell A1 - 2".
         Simple solution: Append a space character to the cell address. */
-    sName.Append( ' ' );
-    return rtl::OUString(sName);
+    //sName.Append( ' ' );
+    //return rtl::OUString(sName);
+    return rtl::OUString(sAddress);
+//-----IAccessibility2 Implementation 2009
 }
 
 	//=====  XAccessibleValue  ================================================
     IsObjectValid();
 	uno::Any aAny;
 	if (mpDoc)
-		aAny <<= mpDoc->GetValue(maCellAddress);
-
+//IAccessibility2 Implementation 2009-----
+		//aAny <<= mpDoc->GetValue(maCellAddress);
+	{
+		String valStr;
+		mpDoc->GetString(maCellAddress.Col(),maCellAddress.Row(),maCellAddress.Tab(), valStr);
+		aAny <<= rtl::OUString(valStr);
+	}
+//-----IAccessibility2 Implementation 2009
 	return aAny;
 }
 
 		bEditable = sal_True;
 	return bEditable;
 }
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString SAL_CALL ScAccessibleCellBase::GetNote(void)
+								throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+    IsObjectValid();
+    rtl::OUString msNote;
+    if (mpDoc)
+    {
+        SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+        if ( pObjSh )
+        {
+            uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+            if ( xSpreadDoc.is() )
+            {
+                uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+                uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+                if ( xIndex.is() )
+                {
+                    uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+                    uno::Reference<sheet::XSpreadsheet> xTable;
+                    if (aTable>>=xTable)
+                    {
+                        uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+                        if (xCell.is())
+                        {
+							uno::Reference <sheet::XSheetAnnotationAnchor> xAnnotationAnchor ( xCell, uno::UNO_QUERY);
+							if(xAnnotationAnchor.is())
+							{
+								uno::Reference <sheet::XSheetAnnotation> xSheetAnnotation = xAnnotationAnchor->getAnnotation();
+								if (xSheetAnnotation.is())
+								{
+									uno::Reference <text::XSimpleText> xText (xSheetAnnotation, uno::UNO_QUERY);
+									if (xText.is())
+									{
+										msNote = xText->getString();
+									}
+								}
+							}
+                        }
+                    }
+                }
+            }
+        }
+    }
+	return msNote;
+}
+#ifndef _COM_SUN_STAR_TABLE_SHADOWFORMAT_HPP_
+#include <com/sun/star/table/ShadowFormat.hpp>
+#endif
+::rtl::OUString SAL_CALL ScAccessibleCellBase::getShadowAttrs(void)
+										throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+	IsObjectValid();
+	table::ShadowFormat aShadowFmt;
+	if (mpDoc)
+	{
+		SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+		if ( pObjSh )
+		{
+			uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+			if ( xSpreadDoc.is() )
+			{
+				uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+				uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+				if ( xIndex.is() )
+				{
+					uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+					uno::Reference<sheet::XSpreadsheet> xTable;
+					if (aTable>>=xTable)
+					{
+						uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+						if (xCell.is())
+						{
+							uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+							if (xCellProps.is())
+							{
+								uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_SHADOW)));
+								aAny >>= aShadowFmt;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	//construct shadow attributes string
+	rtl::OUString sShadowAttrs( RTL_CONSTASCII_USTRINGPARAM("Shadow:") );
+	rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") );
+	rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") );
+	sal_Int32 nLocationVal = 0;
+	switch( aShadowFmt.Location )
+	{
+	case table::ShadowLocation_TOP_LEFT:
+		nLocationVal = 1;
+		break;
+	case table::ShadowLocation_TOP_RIGHT:
+		nLocationVal = 2;
+		break;
+	case table::ShadowLocation_BOTTOM_LEFT:
+		nLocationVal = 3;
+		break;
+	case table::ShadowLocation_BOTTOM_RIGHT:
+		nLocationVal = 4;
+		break;
+	default:
+		break;
+	}
+	//if there is no shadow property for the cell
+	if ( nLocationVal == 0 )
+	{
+		sShadowAttrs += sOuterSplit;
+		return sShadowAttrs;
+	}
+	//else return all the shadow properties
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Location=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)nLocationVal );
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ShadowWidth=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.ShadowWidth ) ;
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("IsTransparent=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Bool)aShadowFmt.IsTransparent ) ;
+	sShadowAttrs += sInnerSplit;
+	sShadowAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("Color=") );
+	sShadowAttrs += rtl::OUString::valueOf( (sal_Int32)aShadowFmt.Color );
+	sShadowAttrs += sOuterSplit;
+	return sShadowAttrs;
+}
+#ifndef _COM_SUN_STAR_TABLE_BORDERLINE_HPP_
+#include <com/sun/star/table/BorderLine.hpp>
+#endif
+::rtl::OUString SAL_CALL ScAccessibleCellBase::getBorderAttrs(void) 
+										throw (::com::sun::star::uno::RuntimeException)
+{
+	ScUnoGuard aGuard;
+	IsObjectValid();
+	table::BorderLine aTopBorder;
+	table::BorderLine aBottomBorder;
+	table::BorderLine aLeftBorder;
+	table::BorderLine aRightBorder;
+	if (mpDoc)
+	{
+		SfxObjectShell* pObjSh = mpDoc->GetDocumentShell();
+		if ( pObjSh )
+		{
+			uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( pObjSh->GetModel(), uno::UNO_QUERY );
+			if ( xSpreadDoc.is() )
+			{
+				uno::Reference<sheet::XSpreadsheets> xSheets = xSpreadDoc->getSheets();
+				uno::Reference<container::XIndexAccess> xIndex( xSheets, uno::UNO_QUERY );
+				if ( xIndex.is() )
+				{
+					uno::Any aTable = xIndex->getByIndex(maCellAddress.Tab());
+					uno::Reference<sheet::XSpreadsheet> xTable;
+					if (aTable>>=xTable)
+					{
+						uno::Reference<table::XCell> xCell = xTable->getCellByPosition(maCellAddress.Col(), maCellAddress.Row());
+						if (xCell.is())
+						{
+							uno::Reference<beans::XPropertySet> xCellProps(xCell, uno::UNO_QUERY);
+							if (xCellProps.is())
+							{
+								uno::Any aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_TOPBORDER)));
+								aAny >>= aTopBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_BOTTBORDER)));
+								aAny >>= aBottomBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_LEFTBORDER)));
+								aAny >>= aLeftBorder;
+								aAny = xCellProps->getPropertyValue(rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(SC_UNONAME_RIGHTBORDER)));
+								aAny >>= aRightBorder;
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+
+	Color aColor;
+	sal_Bool bIn = mpDoc ? mpDoc->IsCellInChangeTrack(maCellAddress,&aColor) : sal_False;
+	if (bIn)
+	{
+		aTopBorder.Color = aColor.GetColor();
+		aBottomBorder.Color = aColor.GetColor();
+		aLeftBorder.Color = aColor.GetColor();
+		aRightBorder.Color = aColor.GetColor();
+		aTopBorder.OuterLineWidth =2;
+		aBottomBorder.OuterLineWidth =2;
+		aLeftBorder.OuterLineWidth =2;
+		aRightBorder.OuterLineWidth =2;
+	}
+
+	//construct border attributes string
+	rtl::OUString sBorderAttrs;
+	rtl::OUString sInnerSplit( RTL_CONSTASCII_USTRINGPARAM(",") );
+	rtl::OUString sOuterSplit( RTL_CONSTASCII_USTRINGPARAM(";") );
+	//top border
+	//if top of the cell has no border
+	if ( aTopBorder.InnerLineWidth == 0 && aTopBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:;") );
+	}
+	else//add all the border properties to the return string.
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("TopBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aTopBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//bottom border
+	if ( aBottomBorder.InnerLineWidth == 0 && aBottomBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorde:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("BottomBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aBottomBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//left border
+	if ( aLeftBorder.InnerLineWidth == 0 && aLeftBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LeftBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aLeftBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	//right border
+	if ( aRightBorder.InnerLineWidth == 0 && aRightBorder.OuterLineWidth == 0 )
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:;") );
+	}
+	else
+	{
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("RightBorder:Color=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.Color );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("InnerLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.InnerLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("OuterLineWidth=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.OuterLineWidth );
+		sBorderAttrs += sInnerSplit;
+		sBorderAttrs += rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("LineDistance=") );
+		sBorderAttrs += rtl::OUString::valueOf( (sal_Int32)aRightBorder.LineDistance );
+		sBorderAttrs += sOuterSplit;
+	}
+	return sBorderAttrs;
+}
+//end of cell attributes
+
+::rtl::OUString SAL_CALL ScAccessibleCellBase::GetAllDisplayNote(void)
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	::rtl::OUString strNote;
+	String strTrackText;
+	if (mpDoc)
+	{
+		sal_Bool bLeftedge=sal_False;
+		mpDoc->GetCellChangeTrackNote(maCellAddress,strTrackText,bLeftedge);
+	}	
+	if (strTrackText.Len() > 0 )
+	{
+		ScDetectiveFunc::AppendChangTrackNoteSeparator(strTrackText);
+		strNote = strTrackText;
+	}
+	strNote += GetNote();
+	return strNote;
+}
+//-----IAccessibility2 Implementation 2009

sc/source/ui/Accessibility/AccessibleDataPilotControl.cxx

 #include <com/sun/star/accessibility/AccessibleStateType.hpp>
 #include <com/sun/star/accessibility/AccessibleEventId.hpp>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/XAccessibleAction.hpp>
+#include <comphelper/accessiblekeybindinghelper.hxx>
+#include <com/sun/star/awt/KeyModifier.hpp>
+#include <vcl/keycodes.hxx>
+//-----IAccessibility2 Implementation 2009
+#ifndef _UTL_ACCESSIBLESTATESETHELPER_HXX
 #include <unotools/accessiblestatesethelper.hxx>
 #include <rtl/uuid.h>
 #include <tools/gen.hxx>
 #include <toolkit/helper/convert.hxx>
 #include <tools/debug.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <com/sun/star/accessibility/AccessibleRelationType.hpp>
+#include <unotools/accessiblerelationsethelper.hxx>
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 
 class ScAccessibleDataPilotButton
 	:	public ScAccessibleContextBase
+//IAccessibility2 Implementation 2009-----
+	, public ::com::sun::star::accessibility::XAccessibleAction
+//-----IAccessibility2 Implementation 2009
 {
 public:
 	//=====  internal  ========================================================
 protected:
 	virtual ~ScAccessibleDataPilotButton(void);
 public:
+//IAccessibility2 Implementation 2009-----
+	// XAccessibleAction
+	virtual sal_Int32 SAL_CALL getAccessibleActionCount( ) throw (::com::sun::star::uno::RuntimeException);
+	virtual sal_Bool SAL_CALL doAccessibleAction ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::rtl::OUString SAL_CALL getAccessibleActionDescription ( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleKeyBinding > SAL_CALL getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException);
+	///=====  XInterface  =====================================================
+	virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( 
+		::com::sun::star::uno::Type const & rType ) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual void SAL_CALL acquire() throw ();
+	virtual void SAL_CALL release() throw ();
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleComponent  ============================================
 
     virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible >
             ::com::sun::star::accessibility::XAccessibleStateSet> SAL_CALL
     	getAccessibleStateSet(void)
         throw (::com::sun::star::uno::RuntimeException);
-
+//IAccessibility2 Implementation 2009-----
+	::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > 
+		SAL_CALL getAccessibleRelationSet(	) throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
 	///=====  XServiceInfo  ====================================================
 
     /**	Returns an identifier for the implementation of this object.
     {
         DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
 
+//IAccessibility2 Implementation 2009-----
+		if(maChildren.size()==0)
+			return ;
+//-----IAccessibility2 Implementation 2009
         sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex());
         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
         if (xTempAcc.is() && maChildren[nIndex].pAcc)
 {
     if (mpFieldWindow)
     {
-        DBG_ASSERT(mpFieldWindow->GetFieldCount() == maChildren.size(), "did not recognize a child count change");
-
+        DBG_ASSERT(static_cast<sal_uInt32>(mpDPFieldWindow->GetFieldCount()) == maChildren.size(), "did not recognize a child count change");
+//IAccessibility2 Implementation 2009-----
+		if(maChildren.size()==0)
+			return ;
+//-----IAccessibility2 Implementation 2009
         sal_Int32 nIndex(mpFieldWindow->GetSelectedIndex());
         uno::Reference < XAccessible > xTempAcc = maChildren[nIndex].xWeakAcc;
         if (xTempAcc.is() && maChildren[nIndex].pAcc)
         ::com::sun::star::accessibility::XAccessible>& rxParent,
         ScPivotFieldWindow* pFieldWindow,
         sal_Int32 nIndex)
-    : ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+//IAccessibility2 Implementation 2009-----
+//change role frome PUSH_BUTTON to BUTTON_MENU
+    //: ScAccessibleContextBase(rxParent, AccessibleRole::PUSH_BUTTON),
+    : ScAccessibleContextBase(rxParent, AccessibleRole::BUTTON_MENU),
+//-----IAccessibility2 Implementation 2009
     mpFieldWindow(pFieldWindow),
     mnIndex(nIndex)
 {
 
     return pStateSet;
 }
+//IAccessibility2 Implementation 2009-----
+::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessibleRelationSet > 
+	SAL_CALL ScAccessibleDataPilotButton::getAccessibleRelationSet(	) throw (::com::sun::star::uno::RuntimeException)
+{
+	utl::AccessibleRelationSetHelper* pRelationSetHelper = new utl::AccessibleRelationSetHelper;
+	uno::Reference< accessibility::XAccessibleRelationSet > xSet = pRelationSetHelper;
+	if(mxParent.is())
+	{
+		uno::Sequence< uno::Reference< uno::XInterface > > aSequence(1);
+		aSequence[0] = mxParent;
+		pRelationSetHelper->AddRelation( accessibility::AccessibleRelation( accessibility::AccessibleRelationType::MEMBER_OF, aSequence ) );
+	}
 
+	return xSet;
+
+}
+//-----IAccessibility2 Implementation 2009
 	///=====  XServiceInfo  ====================================================
 
 ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::getImplementationName(void)
 ::rtl::OUString SAL_CALL ScAccessibleDataPilotButton::createAccessibleDescription(void)
         throw (::com::sun::star::uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+	 if (mpDPFieldWindow)
+        return mpDPFieldWindow->GetHelpText();
+//-----IAccessibility2 Implementation 2009
     return rtl::OUString();
 }
 
     else
         return Rectangle();
 }
+//IAccessibility2 Implementation 2009-----
+// -----------------------------------------------------------------------------
+// XAccessibleAction
+// -----------------------------------------------------------------------------
+sal_Int32 ScAccessibleDataPilotButton::getAccessibleActionCount( ) throw (uno::RuntimeException)
+{
+	return 1;
+}
+// -----------------------------------------------------------------------------
+sal_Bool ScAccessibleDataPilotButton::doAccessibleAction ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw lang::IndexOutOfBoundsException();
+	return sal_True;
+}
+// -----------------------------------------------------------------------------
+::rtl::OUString ScAccessibleDataPilotButton::getAccessibleActionDescription ( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, uno::RuntimeException)
+{
+	if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+        throw lang::IndexOutOfBoundsException();
+	return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(  "press" ) );
+}
+// -----------------------------------------------------------------------------
+::com::sun::star::uno::Reference< XAccessibleKeyBinding > ScAccessibleDataPilotButton::getAccessibleActionKeyBinding( sal_Int32 nIndex ) throw (lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException)
+{
+    if ( nIndex < 0 || nIndex >= getAccessibleActionCount() )
+		throw lang::IndexOutOfBoundsException();
+	  comphelper::OAccessibleKeyBindingHelper* pKeyBindingHelper = new comphelper::OAccessibleKeyBindingHelper();
+    ::com::sun::star::uno::Reference< XAccessibleKeyBinding > xKeyBinding = pKeyBindingHelper;
+    ScDPFieldWindow* pWindow = mpDPFieldWindow;
+    if ( pWindow )
+    {
+        awt::KeyStroke aKeyStroke;
+        aKeyStroke.Modifiers = 0;
+        aKeyStroke.KeyCode = KEY_SPACE;
+        pKeyBindingHelper->AddKeyBinding( aKeyStroke );
+    }
+    return xKeyBinding;
+}
+//=====  XInterface  =====================================================
+uno::Any SAL_CALL ScAccessibleDataPilotButton::queryInterface( uno::Type const & rType )
+	throw (::com::sun::star::uno::RuntimeException)
+{
+	uno::Any aAny (ScAccessibleContextBase::queryInterface(rType));
+	if(!aAny.hasValue())
+	{
+	  aAny = ::cppu::queryInterface (rType,
+            static_cast<XAccessibleAction*>(this)
+            );
+	}
+    return aAny;
+}
+void SAL_CALL ScAccessibleDataPilotButton::acquire() 
+	throw ()
+{
+	ScAccessibleContextBase::acquire();
+}
+void SAL_CALL ScAccessibleDataPilotButton::release()
+	throw ()
+{
+	ScAccessibleContextBase::release();
+}
+//-----IAccessibility2 Implementation 2009
+

sc/source/ui/Accessibility/AccessibleDocument.cxx

 #include <unotools/accessiblerelationsethelper.hxx>
 #include <toolkit/helper/convert.hxx>
 
+//IAccessibility2 Implementation 2009-----
+#include <svx/AccessibleControlShape.hxx>
+#include <svx/AccessibleShape.hxx>
+#include <svx/ShapeTypeHandler.hxx>
+#include <svx/SvxShapeTypes.hxx>
+#include <sfx2/objsh.hxx>
+#include <editeng/editview.hxx>
+#include <editeng/editeng.hxx>
+//-----IAccessibility2 Implementation 2009
 #include <list>
 #include <algorithm>
+//IAccessibility2 Implementation 2009-----
+#include "AccessibleCell.hxx"
 
+#include "svx/unoapi.hxx"
+// Sym2_3241----, added by Steve Yin
+#include "scmod.hxx"
+// ----Sym2_3241
+//-----IAccessibility2 Implementation 2009
 using namespace	::com::sun::star;
 using namespace	::com::sun::star::accessibility;
 using ::std::for_each;
 		const ::accessibility::AccessibleShapeTreeInfo& _rShapeTreeInfo
 	)	throw (::com::sun::star::uno::RuntimeException);
 
+//IAccessibility2 Implementation 2009-----
+	virtual ::accessibility::AccessibleControlShape* GetAccControlShapeFromModel
+		(::com::sun::star::beans::XPropertySet* pSet) 
+		throw (::com::sun::star::uno::RuntimeException);
+	virtual  ::com::sun::star::uno::Reference<
+            ::com::sun::star::accessibility::XAccessible>
+        GetAccessibleCaption (const ::com::sun::star::uno::Reference<
+            ::com::sun::star::drawing::XShape>& xShape)
+			throw (::com::sun::star::uno::RuntimeException);
+//-----IAccessibility2 Implementation 2009
     ///=====  Internal  ========================================================
     void SetDrawBroadcaster();
 
     return bResult;
 }
 
+//IAccessibility2 Implementation 2009-----
+::accessibility::AccessibleControlShape * ScChildrenShapes::GetAccControlShapeFromModel(::com::sun::star::beans::XPropertySet* pSet) throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 count = GetCount();
+	for (sal_Int32 index=0;index<count;index++)
+	{
+		ScAccessibleShapeData* pShape = maZOrderedShapes[index];
+            	if (pShape)
+   	     	{
+   	     		::accessibility::AccessibleShape* pAccShape = pShape->pAccShape;
+          	 	if (pAccShape  && ::accessibility::ShapeTypeHandler::Instance().GetTypeId (pAccShape->GetXShape()) == ::accessibility::DRAWING_CONTROL)
+          	  	{
+				::accessibility::AccessibleControlShape *pCtlAccShape = static_cast < ::accessibility::AccessibleControlShape* >(pAccShape);
+				if (pCtlAccShape && pCtlAccShape->GetControlModel() == pSet)
+					return pCtlAccShape;
+			  }
+            	}
+	}
+	return NULL;
+}
+::com::sun::star::uno::Reference < ::com::sun::star::accessibility::XAccessible >
+ScChildrenShapes::GetAccessibleCaption (const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape>& xShape)
+			throw (::com::sun::star::uno::RuntimeException)
+{
+	sal_Int32 count = GetCount();
+	for (sal_Int32 index=0;index<count;index++)
+	{
+		ScAccessibleShapeData* pShape = maZOrderedShapes[index];
+			if (pShape && pShape->xShape == xShape )
+   	     	{
+				::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > xNewChild(  pShape->pAccShape );	
+//				uno::Reference<XAccessible> xNewChild( pShape->pAccShape , uno::UNO_QUERY );					
+				if(xNewChild.get())
+				return xNewChild;
+			}
+	}
+	return NULL;
+}
+//-----IAccessibility2 Implementation 2009
 sal_Int32 ScChildrenShapes::GetCount() const
 {
 	SdrPage* pDrawPage = GetDrawPage();
         std::vector < uno::Reference < drawing::XShape > > aShapes;
         FillShapes(aShapes);
 
+//IAccessibility2 Implementation 2009-----
+		if(aShapes.size()<=0) return xAccessible;
+//-----IAccessibility2 Implementation 2009
         SortedShapes::iterator aItr;
         if (FindShape(aShapes[nSelectedChildIndex], aItr))
             xAccessible = Get(aItr - maZOrderedShapes.begin());
     }
     else
         mnShapesSelected = 0;
+//IAccessibility2 Implementation 2009-----
+	SdrObject *pFocusedObj = NULL;
+	if( mnShapesSelected == 1 && aShapesList.size() == 1)
+	{
+		pFocusedObj = GetSdrObjectFromXShape(aShapesList[0]->xShape);
+	}
+//-----IAccessibility2 Implementation 2009
     ScShapeDataLess aLess;
     std::sort(aShapesList.begin(), aShapesList.end(), aLess);
-
+//IAccessibility2 Implementation 2009-----
+	SortedShapes vecSelectedShapeAdd;
+	SortedShapes vecSelectedShapeRemove;
+	sal_Bool bHasSelect=sal_False;
+//-----IAccessibility2 Implementation 2009
     SortedShapes::iterator aXShapesItr(aShapesList.begin());
     SortedShapes::const_iterator aXShapesEndItr(aShapesList.end());
     SortedShapes::iterator aDataItr(maZOrderedShapes.begin());
                         (*aDataItr)->pAccShape->SetState(AccessibleStateType::SELECTED);
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
                         bResult = sal_True;
+//IAccessibility2 Implementation 2009-----
+						vecSelectedShapeAdd.push_back((*aDataItr));
+//-----IAccessibility2 Implementation 2009
                     }
                     aFocusedItr = aDataItr;
                 }
+//IAccessibility2 Implementation 2009-----
+				else
+				{
+					 bHasSelect = sal_True;
+				}
+//-----IAccessibility2 Implementation 2009
                 ++aDataItr;
                 ++aXShapesItr;
             }
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::SELECTED);
                         (*aDataItr)->pAccShape->ResetState(AccessibleStateType::FOCUSED);
                         bResult = sal_True;
+//IAccessibility2 Implementation 2009-----
+						vecSelectedShapeRemove.push_back(*aDataItr);
+//-----IAccessibility2 Implementation 2009
                     }
                 }
                 ++aDataItr;
         else
             ++aDataItr;
     }
-    if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+//IAccessibility2 Implementation 2009-----
+	bool bWinFocus=false;
+	ScGridWindow* pWin = static_cast<ScGridWindow*>(mpViewShell->GetWindowByPos(meSplitPos));
+	if (pWin)
+	{
+		bWinFocus = pWin->HasFocus();
+	}
+	const SdrMarkList* pMarkList = NULL;
+	SdrObject* pMarkedObj = NULL;
+	SdrObject* pUpObj = NULL;
+	sal_Bool bIsFocuseMarked = sal_True;
+	if( mpViewShell && mnShapesSelected == 1 && bWinFocus)	
+	{		
+		ScDrawView* pScDrawView = mpViewShell->GetViewData()->GetScDrawView();
+		if( pScDrawView )
+		{
+			if( pScDrawView->GetMarkedObjectList().GetMarkCount() == 1 )
+			{
+				pMarkList = &(pScDrawView->GetMarkedObjectList());
+				pMarkedObj = pMarkList->GetMark(0)->GetMarkedSdrObj();
+				uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
+				if( aFocusedItr != aDataEndItr &&
+					(*aFocusedItr)->xShape.is() && 
+					xMarkedXShape.is() && 
+					(*aFocusedItr)->xShape != xMarkedXShape )
+					bIsFocuseMarked = sal_False;
+			}
+		}
+	}
+    //if ((aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1))
+    if ( bIsFocuseMarked && (aFocusedItr != aDataEndItr) && (*aFocusedItr)->pAccShape && (mnShapesSelected == 1) && bWinFocus)
+	{
         (*aFocusedItr)->pAccShape->SetState(AccessibleStateType::FOCUSED);
+	}
+	else if( pFocusedObj && bWinFocus && pMarkList && pMarkList->GetMarkCount() == 1 && mnShapesSelected == 1 )
+	{		
+		if( pMarkedObj )
+		{
+			uno::Reference< drawing::XShape > xMarkedXShape (pMarkedObj->getUnoShape(), uno::UNO_QUERY);
+			pUpObj = pMarkedObj->GetUpGroup();
 
+			if( pMarkedObj == pFocusedObj )
+			{
+				if( pUpObj )
+				{
+					uno::Reference< drawing::XShape > xUpGroupXShape (pUpObj->getUnoShape(), uno::UNO_QUERY);
+					uno::Reference < XAccessible > xAccGroupShape = 
+						const_cast<ScChildrenShapes*>(this)->GetAccessibleCaption( xUpGroupXShape );
+					if( xAccGroupShape.is() )
+					{
+						::accessibility::AccessibleShape* pAccGroupShape =  
+							static_cast< ::accessibility::AccessibleShape* >(xAccGroupShape.get());
+						if( pAccGroupShape )
+						{
+							sal_Int32 nCount =  pAccGroupShape->getAccessibleChildCount();
+							for( sal_Int32 i = 0; i < nCount; i++ )
+							{
+								uno::Reference<XAccessible> xAccShape = pAccGroupShape->getAccessibleChild(i);
+								if (xAccShape.is())
+								{
+									::accessibility::AccessibleShape* pChildAccShape =  static_cast< ::accessibility::AccessibleShape* >(xAccShape.get());
+									uno::Reference< drawing::XShape > xChildShape = pChildAccShape->GetXShape();
+									if (xChildShape == xMarkedXShape)
+									{
+			                			pChildAccShape->SetState(AccessibleStateType::FOCUSED);
+									}
+									else
+									{
+										pChildAccShape->ResetState(AccessibleStateType::FOCUSED);
+									}
+								}
+							}
+						}
+					}			
+				}
+			}
+		}
+	}
+	if (vecSelectedShapeAdd.size() >= 10 )
+	{
+		AccessibleEventObject aEvent;
+		aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN;
+		aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+		mpAccessibleDocument->CommitChange(aEvent);
+	}
+	else
+	{
+		SortedShapes::iterator vi = vecSelectedShapeAdd.begin();
+		for (; vi != vecSelectedShapeAdd.end() ; ++vi )
+		{
+			AccessibleEventObject aEvent;
+			if (bHasSelect)
+			{
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD;
+			}
+			else
+			{
+				aEvent.EventId = AccessibleEventId::SELECTION_CHANGED;
+			}
+			aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+			uno::Reference< XAccessible > xChild( (*vi)->pAccShape);
+			aEvent.NewValue <<= xChild;
+			mpAccessibleDocument->CommitChange(aEvent);
+		}
+	}
+	SortedShapes::iterator vi = vecSelectedShapeRemove.begin();
+	for (; vi != vecSelectedShapeRemove.end() ; ++vi )
+	{
+		AccessibleEventObject aEvent;
+		aEvent.EventId =  AccessibleEventId::SELECTION_CHANGED_REMOVE;		
+		aEvent.Source = uno::Reference< XAccessible >(mpAccessibleDocument);
+		uno::Reference< XAccessible > xChild( (*vi)->pAccShape);
+		aEvent.NewValue <<= xChild;
+		mpAccessibleDocument->CommitChange(aEvent);
+	}
+//-----IAccessibility2 Implementation 2009
     std::for_each(aShapesList.begin(), aShapesList.end(), Destroy());
 
     return bResult;
 		const ScAccGridWinFocusGotHint& rRef = (const ScAccGridWinFocusGotHint&)rHint;
 		if (rRef.GetNewGridWin() == meSplitPos)
         {
+//IAccessibility2 Implementation 2009-----
+			uno::Reference<XAccessible> xAccessible;
+			if (mpChildrenShapes)
+			{
+				sal_Bool bTabMarked(IsTableSelected());				
+				xAccessible = mpChildrenShapes->GetSelected(0, bTabMarked);				
+			}
+			if( xAccessible.is() )
+			{				
+				uno::Any aNewValue;
+				aNewValue<<=AccessibleStateType::FOCUSED;
+				static_cast< ::accessibility::AccessibleShape* >(xAccessible.get())->
+					CommitChange(AccessibleEventId::STATE_CHANGED,
+								aNewValue,
+								uno::Any() );
+			}
+			else
+			{
             if (mxTempAcc.is() && mpTempAccEdit)
                 mpTempAccEdit->GotFocus();
             else if (mpAccessibleSpreadsheet)
                 mpAccessibleSpreadsheet->GotFocus();
             else
                 CommitFocusGained();
+			}            
+//-----IAccessibility2 Implementation 2009
         }
 	}
 	else if (rHint.ISA( SfxSimpleHint ))
             {
                 mpChildrenShapes = new ScChildrenShapes( this, mpViewShell, meSplitPos );
             }
-
+//IAccessibility2 Implementation 2009-----
+			//Invoke Init() to rebuild the mpChildrenShapes variable
+			this->Init();
+//-----IAccessibility2 Implementation 2009
 			AccessibleEventObject aEvent;
 			aEvent.EventId = AccessibleEventId::INVALIDATE_ALL_CHILDREN;
 			aEvent.Source = uno::Reference< XAccessibleContext >(this);
 			CommitChange(aEvent); // all childs changed
+//IAccessibility2 Implementation 2009-----
+			if (mpAccessibleSpreadsheet)
+				mpAccessibleSpreadsheet->FireFirstCellFocus();
+//-----IAccessibility2 Implementation 2009
 		}
         else if (rRef.GetId() == SC_HINT_ACC_MAKEDRAWLAYER)
         {
         {
             if (mpViewShell && mpViewShell->GetViewData()->HasEditView(meSplitPos))
             {
-                mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
-                    mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
-                    rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
-                uno::Reference<XAccessible> xAcc = mpTempAccEdit;
+				//IAccessibility2 Implementation 2009------
+				EditEngine* pEditEng = mpViewShell->GetViewData()->GetEditView(meSplitPos)->GetEditEngine();
+				if (pEditEng && pEditEng->GetUpdateMode())
+				{
+					mpTempAccEdit = new ScAccessibleEditObject(this, mpViewShell->GetViewData()->GetEditView(meSplitPos),
+						mpViewShell->GetWindowByPos(meSplitPos), GetCurrentCellName(),
+						rtl::OUString(String(ScResId(STR_ACC_EDITLINE_DESCR))), CellInEditMode);
+					uno::Reference<XAccessible> xAcc = mpTempAccEdit;
 
-                AddChild(xAcc, sal_True);
+					AddChild(xAcc, sal_True);
 
-                if (mpAccessibleSpreadsheet)
-                    mpAccessibleSpreadsheet->LostFocus();
-                else
-                    CommitFocusLost();
+					if (mpAccessibleSpreadsheet)
+						mpAccessibleSpreadsheet->LostFocus();
+					else
+						CommitFocusLost();
 
-                mpTempAccEdit->GotFocus();
+					mpTempAccEdit->GotFocus();
+				}
+				//------IAccessibility2 Implementation 2009
             }
         }
         else if (rRef.GetId() == SC_HINT_ACC_LEAVEEDITMODE)
 
                 mpTempAccEdit = NULL;
                 RemoveChild(mxTempAcc, sal_True);
-
-                if (mpAccessibleSpreadsheet)
+//IAccessibility2 Implementation 2009-----
+                //if (mpAccessibleSpreadsheet)
+                if (mpAccessibleSpreadsheet && mpViewShell->IsActive()) //Added by yangzhh for SC lost focus in SODC_2480.
+//-----IAccessibility2 Implementation 2009
                     mpAccessibleSpreadsheet->GotFocus();
-                else
+//IAccessibility2 Implementation 2009-----
+                //else
+                else if( mpViewShell->IsActive()) //Added by yangzhh for SC lost focus in SODC_2480.
+//-----IAccessibility2 Implementation 2009
                     CommitFocusGained();
             }
         }
 
 		CommitChange(aEvent);
 	}
+//IAccessibility2 Implementation 2009-----
+    if(mpChildrenShapes )
+	{
+		mpChildrenShapes->SelectionChanged();
+	}
+//-----IAccessibility2 Implementation 2009
 }
 
 	//=====  XInterface  =====================================================
 uno::Any SAL_CALL ScAccessibleDocument::queryInterface( uno::Type const & rType )
 	throw (uno::RuntimeException)
 {
+//IAccessibility2 Implementation 2009-----
+	uno::Any aAnyTmp;
+	if(rType == ::getCppuType((com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> *)NULL) )
+       {
+	     com::sun::star::uno::Reference<XAccessibleGetAccFlowTo> AccFromXShape = this;
+            aAnyTmp <<= AccFromXShape;
+	     return aAnyTmp;
+       }
+//-----IAccessibility2 Implementation 2009
 	uno::Any aAny (ScAccessibleDocumentImpl::queryInterface(rType));
 	return aAny.hasValue() ? aAny : ScAccessibleContextBase::queryInterface(rType);
 }
 	return pStateSet;
 }
 
+//IAccessibility2 Implementation 2009-----
+::rtl::OUString SAL_CALL
+    ScAccessibleDocument::getAccessibleName(void)
+    throw (::com::sun::star::uno::RuntimeException)
+{
+	rtl::OUString sName = String(ScResId(STR_ACC_DOC_SPREADSHEET));
+	ScDocument* pScDoc = GetDocument();
+	if ( pScDoc )
+	{
+		rtl::OUString sFileName = pScDoc->getDocAccTitle();
+		if ( !sFileName.getLength() )
+		{
+			SfxObjectShell* pObjSh = pScDoc->GetDocumentShell();
+			if ( pObjSh )
+			{
+				sFileName = pObjSh->GetTitle( SFX_TITLE_APINAME );
+			}
+		}
+		rtl::OUString sReadOnly;
+		if (pScDoc->getDocReadOnly())
+		{
+			sReadOnly = String(ScResId(STR_ACC_DOC_SPREADSHEET_READONLY));
+		}
+		if ( sFileName.getLength() )
+		{
+			sName = sFileName + sReadOnly + rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(" - ")) + sName;
+		}
+		//End by Zijie Jia 8/21/2007 SODC_8461 
+	}
+	return sName;
+}
+//-----IAccessibility2 Implementation 2009
 	///=====  XAccessibleSelection  ===========================================
 
 void SAL_CALL
 {
     return rtl::OUString();
 }
+//IAccessibility2 Implementation 2009-----
+ScDocument *ScAccessibleDocument::GetDocument() const
+{
+	return mpViewShell ? mpViewShell->GetViewData()->GetDocument() : NULL;  
+}
+ScAddress   ScAccessibleDocument::GetCurCellAddress() const
+{ 
+	return mpViewShell ? mpViewShell->GetViewData()->GetCurPos() :ScAddress(); 
+}
+uno::Any SAL_CALL ScAccessibleDocument::get_attributes() 
+		throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) 
+{
+	
+	uno::Any anyAtrribute;
+	
+	rtl::OUString sName;
+	rtl::OUString sValue;
+	sal_uInt16 sheetIndex;
+	String sSheetName;
+	sheetIndex = getVisibleTable();
+	if(GetDocument()==NULL)
+		return anyAtrribute;
+	GetDocument()->GetName(sheetIndex,sSheetName);
+	sName = rtl::OUString::createFromAscii("page-name:");
+	sValue = sName + sSheetName ;
+	sName = rtl::OUString::createFromAscii(";page-number:");
+	sValue += sName;
+	sValue += String::CreateFromInt32(sheetIndex+1) ;
+	sName = rtl::OUString::createFromAscii(";total-pages:");
+	sValue += sName;
+	sValue += String::CreateFromInt32(GetDocument()->GetTableCount());
+	sValue +=  rtl::OUString::createFromAscii(";");
+	anyAtrribute <<= sValue;
+	return anyAtrribute;
+}
+com::sun::star::uno::Sequence< com::sun::star::uno::Any > ScAccessibleDocument::GetScAccFlowToSequence()
+{
+	if ( getAccessibleChildCount() )
+	{
+		uno::Reference < XAccessible > xSCTableAcc = getAccessibleChild( 0 ); // table
+		if ( xSCTableAcc.is() )
+		{		
+			uno::Reference < XAccessibleSelection > xAccSelection( xSCTableAcc, uno::UNO_QUERY );
+			sal_Int32 nSelCount = xAccSelection->getSelectedAccessibleChildCount();
+			if( nSelCount )
+			{
+				uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 ); // selected cell
+				if ( xSel.is() )
+				{
+					uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+					if ( xSelContext.is() )
+					{										
+						if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL )
+						{
+							sal_Int32 nParaCount = 0;
+							uno::Sequence <uno::Any> aSequence(nSelCount);
+							for ( sal_Int32 i = 0; i < nSelCount; i++ )
+							{
+								xSel = xAccSelection->getSelectedAccessibleChild( i )	;
+								if ( xSel.is() )
+								{
+									xSelContext = xSel->getAccessibleContext();
+									if ( xSelContext.is() )
+									{
+										if ( xSelContext->getAccessibleRole() == AccessibleRole::TABLE_CELL )
+										{
+											aSequence[nParaCount] = uno::makeAny( xSel );
+											nParaCount++;
+										}
+									}
+								}
+							}
+							return aSequence;
+						}
+					}
+				}
+			}									
+		}
+	}
+	uno::Sequence <uno::Any> aEmpty;
+	return aEmpty;
+}
+::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >
+		SAL_CALL ScAccessibleDocument::get_AccFlowTo(const ::com::sun::star::uno::Any& rAny, sal_Int32 nType)
+		throw ( ::com::sun::star::uno::RuntimeException )
+{
+	const sal_Int32 SPELLCHECKFLOWTO = 1;
+	const sal_Int32 FINDREPLACEFLOWTO = 2;
+	if ( nType == SPELLCHECKFLOWTO )
+	{
+		uno::Reference< ::com::sun::star::drawing::XShape > xShape;
+		rAny >>= xShape;
+		if ( xShape.is() )
+		{
+			uno::Reference < XAccessible > xAcc = mpChildrenShapes->GetAccessibleCaption(xShape);
+			uno::Reference < XAccessibleSelection > xAccSelection( xAcc, uno::UNO_QUERY );
+			if ( xAccSelection.is() )
+			{
+				if ( xAccSelection->getSelectedAccessibleChildCount() ) 
+				{
+					uno::Reference < XAccessible > xSel = xAccSelection->getSelectedAccessibleChild( 0 );
+					if ( xSel.is() )
+					{
+						uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+						if ( xSelContext.is() )
+						{
+							//if in sw we find the selected paragraph here
+							if ( xSelContext->getAccessibleRole() == AccessibleRole::PARAGRAPH )
+							{
+								uno::Sequence<uno::Any> aRet( 1 );
+								aRet[0] = uno::makeAny( xSel );
+								return aRet;
+							}
+						}
+					}
+				}
+			}
+		}
+		else
+		{
+			if ( getSelectedAccessibleChildCount() ) 
+			{
+				uno::Reference < XAccessible > xSel = getSelectedAccessibleChild( 0 );
+				if ( xSel.is() )
+				{
+					uno::Reference < XAccessibleContext > xSelContext( xSel->getAccessibleContext() );
+					if ( xSelContext.is() )
+					{
+						uno::Reference < XAccessibleSelection > xAccChildSelection( xSel, uno::UNO_QUERY );
+						if ( xAccChildSelection.is() )
+						{
+							if ( xAccChildSelection->getSelectedAccessibleChildCount() )
+							{
+								uno::Reference < XAccessible > xChildSel = xAccChildSelection->getSelectedAccessibleChild( 0 );
+								if ( xChildSel.is() )
+								{
+									uno::Reference < ::com::sun::star::accessibility::XAccessibleContext > xChildSelContext( xChildSel->getAccessibleContext() );
+									if ( xChildSelContext.is() &&
+										xChildSelContext->getAccessibleRole() == ::com::sun::star::accessibility::AccessibleRole::PARAGRAPH )
+									{
+										uno::Sequence<uno::Any> aRet( 1 );
+										aRet[0] = uno::makeAny( xChildSel );
+										return aRet;	
+									}
+								}
+							}
+						}
+					}
+				}
+			}
+		}
+	}
+	else if ( nType == FINDREPLACEFLOWTO )
+	{
+		sal_Bool bSuccess;
+		rAny >>= bSuccess;
+		if ( bSuccess )
+		{
+			uno::Sequence< uno::Any> aSeq = GetScAccFlowToSequence();
+			if ( aSeq.getLength() )
+			{
+				return aSeq;
+			}
+			else if( mpAccessibleSpreadsheet )
+			{
+				uno::Reference < XAccessible > xFindCellAcc = mpAccessibleSpreadsheet->GetActiveCell();
+				// add xFindCellAcc to the return the Sequence
+				uno::Sequence< uno::Any> aSeq2(1);
+				aSeq2[0] = uno::makeAny( xFindCellAcc );
+				return aSeq2;
+			}
+		}
+	}
+	uno::Sequence< uno::Any> aEmpty;
+	return aEmpty;
+}
+void ScAccessibleDocument::SwitchViewFireFocus()
+{
+	if (mpAccessibleSpreadsheet)
+	{
+		mpAccessibleSpreadsheet->FireFirstCellFocus();
+	}
+}
+// Sym2_3241----, added by Steve Yin
+sal_Int32 SAL_CALL ScAccessibleDocument::getForeground(  )
+        throw (uno::RuntimeException)
+{
+    return COL_BLACK;
+}
+
+sal_Int32 SAL_CALL ScAccessibleDocument::getBackground(  )
+        throw (uno::RuntimeException)
+{