Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/accselectionhelper.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/accselectionhelper.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/accselectionhelper.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/accselectionhelper.cxx Wed Nov 27 17:25:40 2013 @@ -38,6 +38,14 @@ #include <flyfrm.hxx> +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/accessibility/AccessibleStateType.hpp> +#include <com/sun/star/accessibility/XAccessibleStateSet.hpp> +#include <fmtanchr.hxx> +//-----IAccessibility2 Implementation 2009 + +using namespace ::com::sun::star::accessibility; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; @@ -111,6 +119,43 @@ void SwAccessibleSelectionHelper::select // return bRet; } +//IAccessibility2 Implementation 2009----- +//When the selected state of the SwFrmOrObj is setted, return true. +static sal_Bool lcl_getSelectedState(const SwAccessibleChild& aChild, + SwAccessibleContext* pContext, + SwAccessibleMap* pMap) +{ + Reference< XAccessible > xAcc; + if ( aChild.GetSwFrm() ) + { + xAcc = pMap->GetContext( aChild.GetSwFrm(), sal_False ); + } + else if ( aChild.GetDrawObject() ) + { + xAcc = pMap->GetContext( aChild.GetDrawObject(), pContext, sal_False ); + } + + if( xAcc.is() ) + { + Reference< XAccessibleContext > pRContext = xAcc->getAccessibleContext(); + if(!pRContext.is()) + return sal_False; + Reference<XAccessibleStateSet> pRStateSet = pRContext->getAccessibleStateSet(); + if( pRStateSet.is() ) + { + Sequence<short> pStates = pRStateSet->getStates(); + long count = pStates.getLength(); + for( int i = 0; i < count; i++ ) + { + if( pStates[i] == AccessibleStateType::SELECTED) + return sal_True; + } + } + } + return sal_False; +} +//-----IAccessibility2 Implementation 2009 + sal_Bool SwAccessibleSelectionHelper::isAccessibleChildSelected( sal_Int32 nChildIndex ) throw ( lang::IndexOutOfBoundsException, @@ -137,6 +182,14 @@ sal_Bool SwAccessibleSelectionHelper::is { bRet = pFEShell->IsObjSelected( *aChild.GetDrawObject() ); } + //IAccessibility2 Implementation 2009----- + //If the SwFrmOrObj is not selected directly in the UI, we should check whether it is selected in the selection cursor. + if( !bRet ) + { + if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) == sal_True) + bRet = sal_True; + } + //-----IAccessibility2 Implementation 2009 } return bRet; @@ -194,11 +247,11 @@ sal_Int32 SwAccessibleSelectionHelper::g const SwFlyFrm* pFlyFrm = pFEShell->GetCurrFlyFrm(); if( pFlyFrm ) { - if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == - rContext.GetFrm() ) - { + //IAccessibility2 Implementation 2009----- + //if( rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == + // rContext.GetFrm() ) nCount = 1; - } + //-----IAccessibility2 Implementation 2009 } else { @@ -226,6 +279,26 @@ sal_Int32 SwAccessibleSelectionHelper::g } } } + //IAccessibility2 Implementation 2009----- + //If the SwFrmOrObj is not selected directly in the UI, + //we should check whether it is selected in the selection cursor. + if( nCount == 0 ) + { + ::std::list< SwAccessibleChild > aChildren; + rContext.GetChildren( *(rContext.GetMap()), aChildren ); + ::std::list< SwAccessibleChild >::const_iterator aIter = + aChildren.begin(); + ::std::list< SwAccessibleChild >::const_iterator aEndIter = + aChildren.end(); + while( aIter != aEndIter ) + { + const SwAccessibleChild& aChild = *aIter; + if( lcl_getSelectedState( aChild, &rContext, rContext.GetMap() ) ) + nCount++; + ++aIter; + } + } + //-----IAccessibility2 Implementation 2009 } return nCount; } @@ -249,12 +322,28 @@ Reference<XAccessible> SwAccessibleSelec const SwFlyFrm *pFlyFrm = pFEShell->GetCurrFlyFrm(); if( pFlyFrm ) { - if( 0 == nSelectedChildIndex && - rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == - rContext.GetFrm() ) - { - aChild = pFlyFrm; - } + //IAccessibility2 Implementation 2009----- + if( 0 == nSelectedChildIndex ) + { + if(rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview()) == rContext.GetFrm() ) + { + aChild = pFlyFrm; + } + else + { + const SwFrmFmt *pFrmFmt = pFlyFrm->GetFmt(); + if (pFrmFmt) + { + const SwFmtAnchor& pAnchor = pFrmFmt->GetAnchor(); + if( pAnchor.GetAnchorId() == FLY_AS_CHAR ) + { + const SwFrm *pParaFrm = rContext.GetParent( SwAccessibleChild(pFlyFrm), rContext.IsInPagePreview() ); + aChild = pParaFrm; + } + } + } + } + //-----IAccessibility2 Implementation 2009 } else {
Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.cxx Wed Nov 27 17:25:40 2013 @@ -49,9 +49,14 @@ #include <accmap.hxx> #include <access.hrc> #include <acctable.hxx> - +#include <rowfrm.hxx> +#include <layfrm.hxx> #include <com/sun/star/accessibility/XAccessibleText.hpp> +#include <editeng/brshitem.hxx> +#include <swatrset.hxx> +#include <frmatr.hxx> + using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::rtl::OUString; @@ -67,6 +72,8 @@ typedef ::std::set < sal_Int32, Int32Les typedef ::std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl; typedef ::std::list < Int32Pair_Impl > Int32PairList_Impl; +const int SELECTION_WITH_NUM =10; + class SwAccTableSelHander_Impl { public: @@ -88,6 +95,10 @@ class SwAccessibleTableData_Impl bool mbOnlyTableColumnHeader; void CollectData( const SwFrm *pFrm ); + //IAccessibility2 Implementation 2009----- + void CollectColumnHeaderData( const SwFrm *pFrm ); + void CollectRowHeaderData( const SwFrm *pFrm ); + //-----IAccessibility2 Implementation 2009 void CollectExtents( const SwFrm *pFrm ); sal_Bool FindCell( const Point& rPos, const SwFrm *pFrm , @@ -182,6 +193,99 @@ void SwAccessibleTableData_Impl::Collect } } +//IAccessibility2 Implementation 2009----- +void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm ) +{ + const SwAccessibleChildSList aList( *pFrm, mrAccMap ); + SwAccessibleChildSList::const_iterator aIter( aList.begin() ); + SwAccessibleChildSList::const_iterator aEndIter( aList.end() ); + while( aIter != aEndIter ) + { + const SwAccessibleChild& rLower = *aIter; + const SwFrm *pLower = rLower.GetSwFrm(); + if( pLower ) + { + if( pLower->IsRowFrm() ) + { + + const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine(); + while( pLine->GetUpper() ) + pLine = pLine->GetUpper()->GetUpper(); + + // Headerline? + //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine) + //return ; + + maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() ); + + CollectRowHeaderData( pLower ); + + + } + else if( pLower->IsCellFrm() && + rLower.IsAccessible( mbIsInPagePreview ) ) + { + //Added by yanjun. Can't find the "GetRowHeaderFlag" function(Need vefiry). + //if(((SwCellFrm*)pLower)->GetRowHeaderFlag()) + // maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() ); + } + else + { + CollectRowHeaderData( pLower ); + } + } + ++aIter; + } +} +//-----IAccessibility2 Implementation 2009 + +void SwAccessibleTableData_Impl::CollectColumnHeaderData( const SwFrm *pFrm ) +{ + const SwAccessibleChildSList aList( *pFrm, mrAccMap ); + SwAccessibleChildSList::const_iterator aIter( aList.begin() ); + SwAccessibleChildSList::const_iterator aEndIter( aList.end() ); + while( aIter != aEndIter ) + { + const SwAccessibleChild& rLower = *aIter; + const SwFrm *pLower = rLower.GetSwFrm(); + if( pLower ) + { + if( pLower->IsRowFrm() ) + { + + const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine(); + while( pLine->GetUpper() ) + pLine = pLine->GetUpper()->GetUpper(); + + // Headerline? + //if(mpTabFrm->GetTable()->GetTabLines()[ 0 ] != pLine) + //return ; + + //if the current line is now header line, then return ; + sal_Int16 iCurrentRowIndex = mpTabFrm->GetTable()->GetTabLines().GetPos( pLine); + if(iCurrentRowIndex >= mpTabFrm->GetTable()->_GetRowsToRepeat()) + return ; + + maRows.insert( pLower->Frm().Top() - maTabFrmPos.Y() ); + + CollectColumnHeaderData( pLower ); + + + } + else if( pLower->IsCellFrm() && + rLower.IsAccessible( mbIsInPagePreview ) ) + { + maColumns.insert( pLower->Frm().Left() - maTabFrmPos.X() ); + } + else + { + CollectColumnHeaderData( pLower ); + } + } + ++aIter; + } +} +//-----IAccessibility2 Implementation 2009 void SwAccessibleTableData_Impl::CollectExtents( const SwFrm *pFrm ) { const SwAccessibleChildSList aList( *pFrm, mrAccMap ); @@ -396,7 +500,11 @@ const SwFrm *SwAccessibleTableData_Impl: inline sal_Int32 SwAccessibleTableData_Impl::GetRowCount() const { - return static_cast< sal_Int32 >( maRows.size() ); + //IAccessibility2 Implementation 2009----- + sal_Int32 count = static_cast< sal_Int32 >( maRows.size() ) ; + count = (count <=0)? 1:count; + //-----IAccessibility2 Implementation 2009 + return count; } inline sal_Int32 SwAccessibleTableData_Impl::GetColumnCount() const @@ -696,8 +804,12 @@ void SwAccessibleTable::GetStates( ::utl::AccessibleStateSetHelper& rStateSet ) { SwAccessibleContext::GetStates( rStateSet ); - + //IAccessibility2 Implementation 2009----- + //Solution:Add resizable state to table + rStateSet.AddState( AccessibleStateType::RESIZABLE ); // MULTISELECTABLE + rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE ); + //-----IAccessibility2 Implementation 2009 SwCrsrShell* pCrsrShell = GetCrsrShell(); if( pCrsrShell ) rStateSet.AddState( AccessibleStateType::MULTI_SELECTABLE ); @@ -727,6 +839,9 @@ SwAccessibleTable::SwAccessibleTable( OUString sArg2( GetFormattedPageNumber() ); sDesc = GetResource( STR_ACCESS_TABLE_DESC, &sArg1, &sArg2 ); + //IAccessibility2 Implementation 2009----- + UpdateTableData(); + //-----IAccessibility2 Implementation 2009 } SwAccessibleTable::~SwAccessibleTable() @@ -784,8 +899,7 @@ void SwAccessibleTable::Modify( const Sf case RES_OBJECTDYING: // mba: it seems that this class intentionally does not call code in base class SwClient - if( GetRegisteredIn() == - static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) + if( pOld && ( GetRegisteredIn() == static_cast< SwModify *>( static_cast< const SwPtrMsgPoolItem * >( pOld )->pObject ) ) ) GetRegisteredInNonConst()->Remove( this ); break; @@ -809,6 +923,13 @@ uno::Any SwAccessibleTable::queryInterfa uno::Reference<XAccessibleSelection> xSelection( this ); aRet <<= xSelection; } + //IAccessibility2 Implementation 2009----- + else if ( rType == ::getCppuType((uno::Reference<XAccessibleTableSelection> *)0) ) + { + uno::Reference<XAccessibleTableSelection> xTableExtent( this ); + aRet <<= xTableExtent; + } + //-----IAccessibility2 Implementation 2009 else { aRet = SwAccessibleContext::queryInterface(rType); @@ -981,6 +1102,9 @@ sal_Int32 SAL_CALL SwAccessibleTable::ge CHECK_FOR_DEFUNC( XAccessibleTable ) + //IAccessibility2 Implementation 2009----- + UpdateTableData(); + //-----IAccessibility2 Implementation 2009 GetTableData().CheckRowAndCol( nRow, nColumn, this ); Int32Set_Impl::const_iterator aSttCol( @@ -1011,6 +1135,9 @@ sal_Int32 SAL_CALL SwAccessibleTable::ge vos::OGuard aGuard(Application::GetSolarMutex()); CHECK_FOR_DEFUNC( XAccessibleTable ) + //IAccessibility2 Implementation 2009----- + UpdateTableData(); + //-----IAccessibility2 Implementation 2009 GetTableData().CheckRowAndCol( nRow, nColumn, this ); @@ -1045,6 +1172,25 @@ uno::Reference< XAccessibleTable > SAL_C SwAccessibleTable::getAccessibleColumnHeaders( ) throw (uno::RuntimeException) { +// MT IA2: Which one should win nowadys??? +/* + // IA2 version: + uno::Reference< XAccessibleTable > xRet; + SwTabFrm* pTabFrm =( SwTabFrm*)( GetFrm() ); + if (pTabFrm) + { + if(pTabFrm->GetTable()->_GetRowsToRepeat() > 0) + { + //for errata table header + SwAccessibleTableData_Impl *mpHeadTableData = new SwAccessibleTableData_Impl( pTabFrm, sal_False, sal_True); + //for errata table header + SwAccessibleTable *pHeadAccessibleTable = new SwAccessibleTable(GetMap(),pTabFrm); + pHeadAccessibleTable->SetTableData(mpHeadTableData); + xRet = pHeadAccessibleTable; + } + } + return xRet; +*/ // --> OD 2010-03-10 #i87532# // assure that return accesible object is empty, if no column header exists. SwAccessibleTableColHeaders* pTableColHeaders = @@ -1346,6 +1492,15 @@ void SwAccessibleTable::InvalidatePosOrS { vos::OGuard aGuard(Application::GetSolarMutex()); + //IAccessibility2 Implementation 2009----- + //need to update children + SwAccessibleTableData_Impl *pNewTableData = CreateNewTableData(); + if( !pNewTableData->CompareExtents( GetTableData() ) ) + { + delete mpTableData; + mpTableData = pNewTableData; + FireTableChangeEvent(*mpTableData); + } if( HasTableData() ) GetTableData().SetTablePos( GetFrm()->Frm().Pos() ); @@ -1402,6 +1557,34 @@ void SwAccessibleTable::InvalidateChildP // <-- if( !pNewTableData->CompareExtents( GetTableData() ) ) { + //IAccessibility2 Implementation 2009----- + if(pNewTableData->GetRowCount()!= mpTableData->GetRowCount()) + { + Int32Set_Impl::const_iterator aSttCol( GetTableData().GetColumnIter( 0 ) ); + Int32Set_Impl::const_iterator aSttRow( GetTableData().GetRowIter( 1 ) ); + const SwFrm *pCellFrm = GetTableData().GetCellAtPos( *aSttCol, *aSttRow, sal_False ); + Int32Set_Impl::const_iterator aSttCol2( pNewTableData->GetColumnIter( 0 ) ); + Int32Set_Impl::const_iterator aSttRow2( pNewTableData->GetRowIter( 0 ) ); + const SwFrm *pCellFrm2 = pNewTableData->GetCellAtPos( *aSttCol2, *aSttRow2, sal_False ); + + if(pCellFrm == pCellFrm2) + { + AccessibleTableModelChange aModelChange; + aModelChange.Type = AccessibleTableModelChangeType::UPDATE; + aModelChange.FirstRow = 0; + aModelChange.LastRow = mpTableData->GetRowCount() - 1; + aModelChange.FirstColumn = 0; + aModelChange.LastColumn = mpTableData->GetColumnCount() - 1; + + AccessibleEventObject aEvent; + aEvent.EventId = AccessibleEventId::TABLE_COLUMN_HEADER_CHANGED; + aEvent.NewValue <<= aModelChange; + + FireAccessibleEvent( aEvent ); + } + } + else + //-----IAccessibility2 Implementation 2009 FireTableChangeEvent( GetTableData() ); ClearTableData(); mpTableData = pNewTableData; @@ -1674,6 +1857,153 @@ void SAL_CALL SwAccessibleTable::deselec pCrsrShell->EndAction(); } +//IAccessibility2 Implementation 2009----- +void SwAccessibleTable::SetTableData(SwAccessibleTableData_Impl* mpNewTableData) +{ + mpTableData = mpNewTableData; +} + +sal_Int32 SAL_CALL SwAccessibleTable::getBackground() + throw (::com::sun::star::uno::RuntimeException) +{ + const SvxBrushItem &rBack = GetFrm()->GetAttrSet()->GetBackground(); + sal_uInt32 crBack = rBack.GetColor().GetColor(); + + if (COL_AUTO == crBack) + { + uno::Reference<XAccessible> xAccDoc = getAccessibleParent(); + if (xAccDoc.is()) + { + uno::Reference<XAccessibleComponent> xCompoentDoc(xAccDoc,uno::UNO_QUERY); + if (xCompoentDoc.is()) + { + crBack = (sal_uInt32)xCompoentDoc->getBackground(); + } + } + } + return crBack; +} + +void SwAccessibleTable::FireSelectionEvent( ) +{ + AccessibleEventObject aEvent; + + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_REMOVE; + +// int nRemove = m_vecCellRemove.size(); +// int nAdd = m_vecCellAdd.size(); + + VEC_CELL::iterator vi = m_vecCellRemove.begin(); + for (; vi != m_vecCellRemove.end() ; ++vi) + { + SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi); + OSL_ASSERT(pAccCell != NULL ); + pAccCell->FireAccessibleEvent(aEvent); + } + + if (m_vecCellAdd.size() <= SELECTION_WITH_NUM) + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_ADD; + vi = m_vecCellAdd.begin(); + for (; vi != m_vecCellAdd.end() ; ++vi) + { + SwAccessibleContext *pAccCell = const_cast<SwAccessibleContext *>(*vi); + OSL_ASSERT(pAccCell != NULL ); + pAccCell->FireAccessibleEvent(aEvent); + } + return ; + } + else + { + aEvent.EventId = AccessibleEventId::SELECTION_CHANGED_WITHIN; + FireAccessibleEvent(aEvent); + } +} + +void SwAccessibleTable::ClearSelectionCellCache() +{ + m_vecCellAdd.clear(); + m_vecCellRemove.clear(); +} + +void SwAccessibleTable::AddSelectionCell(const SwAccessibleContext* pAccCell ,sal_Bool bAddOrRemove) +{ + if (bAddOrRemove) + { + m_vecCellAdd.push_back(pAccCell); + } + else + { + m_vecCellRemove.push_back(pAccCell); + } +} + +//===== XAccessibleTableSelection ============================================ +sal_Bool SAL_CALL SwAccessibleTable::selectRow( sal_Int32 row ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if( isAccessibleColumnSelected( row ) ) + return sal_True; + + long lCol, lColumnCount, lChildIndex; + lColumnCount = getAccessibleColumnCount(); + for(lCol = 0; lCol < lColumnCount; lCol ++) + { + lChildIndex = getAccessibleIndex(row, lCol); + selectAccessibleChild(lChildIndex); + } + + return sal_True; +} +sal_Bool SAL_CALL SwAccessibleTable::selectColumn( sal_Int32 column ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if( isAccessibleColumnSelected( column ) ) + return sal_True; + + long lRow, lRowCount, lChildIndex; + lRowCount = getAccessibleRowCount(); + + for(lRow = 0; lRow < lRowCount; lRow ++) + { + lChildIndex = getAccessibleIndex(lRow, column); + selectAccessibleChild(lChildIndex); + } + return sal_True; +} +sal_Bool SAL_CALL SwAccessibleTable::unselectRow( sal_Int32 row ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if( isAccessibleSelected( row , 0 ) && isAccessibleSelected( row , getAccessibleColumnCount()-1 ) ) + { + SwCrsrShell* pCrsrShell = GetCrsrShell(); + if( pCrsrShell != NULL ) + { + pCrsrShell->StartAction(); + pCrsrShell->ClearMark(); + pCrsrShell->EndAction(); + return sal_True; + } + } + return sal_True; +} +sal_Bool SAL_CALL SwAccessibleTable::unselectColumn( sal_Int32 column ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if( isAccessibleSelected( 0 , column ) && isAccessibleSelected( getAccessibleRowCount()-1,column)) + { + SwCrsrShell* pCrsrShell = GetCrsrShell(); + if( pCrsrShell != NULL ) + { + pCrsrShell->StartAction(); + pCrsrShell->ClearMark(); + pCrsrShell->EndAction(); + return sal_True; + } + } + return sal_True; +} +//-----IAccessibility2 Implementation 2009 // --> OD 2007-06-28 #i77106# // implementation of class <SwAccessibleTableColHeaders> SwAccessibleTableColHeaders::SwAccessibleTableColHeaders( SwAccessibleMap *pMap2, Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acctable.hxx Wed Nov 27 17:25:40 2013 @@ -23,6 +23,12 @@ #ifndef _ACCTABLE_HXX #define _ACCTABLE_HXX #include <com/sun/star/accessibility/XAccessibleTable.hpp> +//IAccessibility2 Implementation 2009----- +#ifndef _COM_SUN_STAR_ACCESSIBILITY_XAccessibleTableSelection_HPP_ +#include <com/sun/star/accessibility/XAccessibleTableSelection.hpp> +#endif +#include <vector> +//-----IAccessibility2 Implementation 2009 #include <com/sun/star/accessibility/XAccessibleSelection.hpp> #include <acccontext.hxx> @@ -40,6 +46,7 @@ class SwAccessibleTable : public SwAccessibleContext, public ::com::sun::star::accessibility::XAccessibleTable, public ::com::sun::star::accessibility::XAccessibleSelection, + public ::com::sun::star::accessibility::XAccessibleTableSelection, public SwClient { SwAccessibleTableData_Impl *mpTableData; // the table's data, prot by Sol-Mutex @@ -85,6 +92,9 @@ protected: // Is table data evailable? sal_Bool HasTableData() const { return (mpTableData != 0); } + //IAccessibility2 Implementation 2009----- + void SetTableData(SwAccessibleTableData_Impl* mpNewTableData) ; + //-----IAccessibility2 Implementation 2009 virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew); public: @@ -187,7 +197,17 @@ public: virtual sal_Int32 SAL_CALL getAccessibleColumn( sal_Int32 nChildIndex ) throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException); - + //IAccessibility2 Implementation 2009----- + //===== XAccessibleTableSelection ============================================ + virtual sal_Bool SAL_CALL selectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL selectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectRow( sal_Int32 row ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + virtual sal_Bool SAL_CALL unselectColumn( sal_Int32 column ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException) ; + //-----IAccessibility2 Implementation 2009 //===== XServiceInfo ==================================================== /** Returns an identifier for the implementation of this object. @@ -254,6 +274,17 @@ public: throw ( ::com::sun::star::lang::IndexOutOfBoundsException, ::com::sun::star::uno::RuntimeException ); + //IAccessibility2 Implementation 2009----- + //===== XAccessibleComponent ============================================ + sal_Int32 SAL_CALL getBackground() + throw (::com::sun::star::uno::RuntimeException); + typedef std::vector<const SwAccessibleContext*> VEC_CELL; + VEC_CELL m_vecCellAdd; + VEC_CELL m_vecCellRemove; + void FireSelectionEvent( ); + void ClearSelectionCellCache(); + void AddSelectionCell(const SwAccessibleContext* ,sal_Bool bAddOrRemove); + //-----IAccessibility2 Implementation 2009 }; inline SwAccessibleTableData_Impl& SwAccessibleTable::GetTableData() Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.cxx Wed Nov 27 17:25:40 2013 @@ -44,6 +44,11 @@ // <-- #include "acctextframe.hxx" +//IAccessibility2 Implementation 2009----- +#ifndef _DOC_HXX +#include <doc.hxx> +#endif +//-----IAccessibility2 Implementation 2009 using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using ::rtl::OUString; @@ -152,6 +157,125 @@ void SwAccessibleTextFrame::Modify( cons } } +//IAccessibility2 Implementation 2009----- +//===== XInterface ========================================================== + +com::sun::star::uno::Any SAL_CALL + SwAccessibleTextFrame::queryInterface (const com::sun::star::uno::Type & rType) + throw (::com::sun::star::uno::RuntimeException) +{ + ::com::sun::star::uno::Any aReturn = SwAccessibleContext::queryInterface (rType); + if ( ! aReturn.hasValue()) + aReturn = ::cppu::queryInterface (rType, + static_cast< ::com::sun::star::accessibility::XAccessibleSelection* >(this) + ); + return aReturn; +} + + + + +void SAL_CALL + SwAccessibleTextFrame::acquire (void) + throw () +{ + SwAccessibleContext::acquire (); +} + +void SAL_CALL + SwAccessibleTextFrame::release (void) + throw () +{ + SwAccessibleContext::release (); +} + +// +//===== XAccessibleSelection ============================================ +// + +//-------------------------------------------------------------------------------- +void SAL_CALL SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAccessibleChild( sal_Int32 )> - missing implementation" ); +} + +//---------------------------------------------------------------------------------- +sal_Bool SAL_CALL SwAccessibleTextFrame::isAccessibleChildSelected( sal_Int32 nChildIndex ) + throw (lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + uno::Reference<XAccessible> xAcc = getAccessibleChild( nChildIndex ); + uno::Reference<XAccessibleContext> xContext; + if( xAcc.is() ) + xContext = xAcc->getAccessibleContext(); + + if( xContext.is() ) + { + if( xContext->getAccessibleRole() == AccessibleRole::PARAGRAPH ) + { + uno::Reference< ::com::sun::star::accessibility::XAccessibleText > + xText(xAcc, uno::UNO_QUERY); + if( xText.is() ) + { + if( xText->getSelectionStart() >= 0 ) return sal_True; + } + } + } + + return sal_False; +} + +//--------------------------------------------------------------------- +void SAL_CALL SwAccessibleTextFrame::clearAccessibleSelection( ) + throw ( uno::RuntimeException ) +{ + DBG_ASSERT( false, "<SwAccessibleTextFrame::clearAccessibleSelection( )> - missing implementation" ); +} + +//------------------------------------------------------------------------- +void SAL_CALL SwAccessibleTextFrame::selectAllAccessibleChildren( ) + throw ( uno::RuntimeException ) +{ + DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( )> - missing implementation" ); +} + +//---------------------------------------------------------------------------- +sal_Int32 SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChildCount() + throw ( uno::RuntimeException ) +{ + sal_Int32 nCount = 0; + sal_Int32 TotalCount = getAccessibleChildCount(); + for( sal_Int32 i = 0; i < TotalCount; i++ ) + if( isAccessibleChildSelected(i) ) nCount++; + + return nCount; +} + +//-------------------------------------------------------------------------------------- +uno::Reference<XAccessible> SAL_CALL SwAccessibleTextFrame::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException) +{ + if ( nSelectedChildIndex > getSelectedAccessibleChildCount() ) + throw lang::IndexOutOfBoundsException(); + sal_Int32 i1, i2; + for( i1 = 0, i2 = 0; i1 < getAccessibleChildCount(); i1++ ) + if( isAccessibleChildSelected(i1) ) + { + if( i2 == nSelectedChildIndex ) + return getAccessibleChild( i1 ); + i2++; + } + return uno::Reference<XAccessible>(); +} + +//---------------------------------------------------------------------------------- +void SAL_CALL SwAccessibleTextFrame::deselectAccessibleChild( sal_Int32 ) + throw ( lang::IndexOutOfBoundsException, uno::RuntimeException ) +{ + DBG_ASSERT( false, "<SwAccessibleTextFrame::selectAllAccessibleChildren( sal_Int32 )> - missing implementation" ); +} +//-----IAccessibility2 Implementation 2009 + // --> OD 2009-07-14 #i73249# OUString SAL_CALL SwAccessibleTextFrame::getAccessibleName (void) throw (uno::RuntimeException) @@ -168,15 +292,29 @@ OUString SAL_CALL SwAccessibleTextFrame: return SwAccessibleFrameBase::getAccessibleName(); } // <-- + OUString SAL_CALL SwAccessibleTextFrame::getAccessibleDescription (void) throw (uno::RuntimeException) { vos::OGuard aGuard(Application::GetSolarMutex()); CHECK_FOR_DEFUNC( XAccessibleContext ) + /* MT: I guess msDesc is correct noadays? + //IAccessibility2 Implementation 2009----- + OUString longDesc; + const SwFlyFrmFmt* pFlyFmt = GetShell()->GetDoc()->FindFlyByName( GetName(), 0); + if( pFlyFmt ) + { + longDesc = OUString( pFlyFmt->GetDescription() ); + } + if( longDesc.getLength() > 0 ) + return GetName() + OUString(' ') + longDesc; + else + return GetName(); + //-----IAccessibility2 Implementation 2009 + */ return msDesc; - } OUString SAL_CALL SwAccessibleTextFrame::getImplementationName() Modified: openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.hxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.hxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.hxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/access/acctextframe.hxx Wed Nov 27 17:25:40 2013 @@ -24,13 +24,18 @@ #define _ACCTEXTFRAME_HXX #include "accframebase.hxx" +//IAccessibility2 Implementation 2009----- +#include <com/sun/star/accessibility/XAccessibleSelection.hpp> +//-----IAccessibility2 Implementation 2009 + class SwFlyFrm; namespace utl { class AccessibleRelationSetHelper; } namespace com { namespace star { namespace accessibility { struct AccessibleRelation; } } } -class SwAccessibleTextFrame : public SwAccessibleFrameBase +class SwAccessibleTextFrame : public SwAccessibleFrameBase, + public ::com::sun::star::accessibility::XAccessibleSelection { private: // --> OD 2009-07-14 #i73249# @@ -48,6 +53,43 @@ public: SwAccessibleTextFrame( SwAccessibleMap* pInitMap, const SwFlyFrm* pFlyFrm ); + //IAccessibility2 Implementation 2009----- + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( + ::com::sun::star::uno::Type const & rType ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL acquire() throw (); + virtual void SAL_CALL release() throw (); + //===== XAccessibleSelection ============================================ + virtual void SAL_CALL selectAccessibleChild( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + virtual sal_Bool SAL_CALL isAccessibleChildSelected( + sal_Int32 nChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL clearAccessibleSelection( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual void SAL_CALL selectAllAccessibleChildren( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual sal_Int32 SAL_CALL getSelectedAccessibleChildCount( ) + throw ( ::com::sun::star::uno::RuntimeException ); + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::accessibility::XAccessible > SAL_CALL getSelectedAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + virtual void SAL_CALL deselectAccessibleChild( + sal_Int32 nSelectedChildIndex ) + throw ( ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException ); + //-----IAccessibility2 Implementation 2009 + //===== XAccessibleContext ============================================== // --> OD 2009-07-14 #i73249# Modified: openoffice/branches/alg/aw080/main/sw/source/core/attr/format.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/attr/format.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/attr/format.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/attr/format.cxx Wed Nov 27 17:25:40 2013 @@ -255,7 +255,9 @@ SwFmt::~SwFmt() } else { - while( GetDepends() ) + //IAccessibility2 Implementation 2009----- + while( GetDepends() && pParentFmt) + //-----IAccessibility2 Implementation 2009 { SwFmtChg aOldFmt(this); SwFmtChg aNewFmt(pParentFmt); Modified: openoffice/branches/alg/aw080/main/sw/source/core/bastyp/init.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/bastyp/init.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/bastyp/init.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/bastyp/init.cxx Wed Nov 27 17:25:40 2013 @@ -315,7 +315,7 @@ SfxItemInfo __FAR_DATA aSlotTab[] = { 0, 0 }, // RES_TXTATR_CHARFMT { SID_ATTR_CHAR_CJK_RUBY, 0 }, // RES_TXTATR_CJK_RUBY { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_UNKNOWN_CONTAINER - { 0, SFX_ITEM_POOLABLE }, // RES_TXTATR_DUMMY5 + { 0, 0 }, // RES_TXTATR_INPUTFIELD { 0, 0 }, // RES_TXTATR_FIELD { 0, 0 }, // RES_TXTATR_FLYCNT @@ -528,8 +528,9 @@ void _InitCore() aAttrTab[ RES_TXTATR_CHARFMT- POOLATTR_BEGIN ] = new SwFmtCharFmt( 0 ); aAttrTab[ RES_TXTATR_CJK_RUBY - POOLATTR_BEGIN ] = new SwFmtRuby( aEmptyStr ); aAttrTab[ RES_TXTATR_UNKNOWN_CONTAINER - POOLATTR_BEGIN ] = new SvXMLAttrContainerItem( RES_TXTATR_UNKNOWN_CONTAINER ); + aAttrTab[ RES_TXTATR_INPUTFIELD - POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_INPUTFIELD ); - aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld; + aAttrTab[ RES_TXTATR_FIELD- POOLATTR_BEGIN ] = new SwFmtFld( RES_TXTATR_FIELD ); aAttrTab[ RES_TXTATR_FLYCNT - POOLATTR_BEGIN ] = new SwFmtFlyCnt( 0 ); aAttrTab[ RES_TXTATR_FTN - POOLATTR_BEGIN ] = new SwFmtFtn; @@ -538,7 +539,6 @@ void _InitCore() aAttrTab[ RES_TXTATR_DUMMY3 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY3 ); aAttrTab[ RES_TXTATR_DUMMY1 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY1 ); aAttrTab[ RES_TXTATR_DUMMY2 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY2 ); - aAttrTab[ RES_TXTATR_DUMMY5 - POOLATTR_BEGIN ] = new SfxBoolItem( RES_TXTATR_DUMMY5 ); // TextAttr - Dummies aAttrTab[ RES_CHRATR_BIDIRTL - POOLATTR_BEGIN ] = new SfxInt16Item( RES_CHRATR_BIDIRTL, sal_Int16(-1) ); Modified: openoffice/branches/alg/aw080/main/sw/source/core/crsr/callnk.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/callnk.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/crsr/callnk.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/callnk.cxx Wed Nov 27 17:25:40 2013 @@ -138,7 +138,7 @@ SwCallLink::~SwCallLink() for( n = 0; n < rHts.Count(); n++ ) { const SwTxtAttr* pHt = rHts[ n ]; - pEnd = pHt->GetEnd(); + pEnd = pHt->End(); nStart = *pHt->GetStart(); // nur Start oder Start und Ende gleich, dann immer Modified: openoffice/branches/alg/aw080/main/sw/source/core/crsr/crsrsh.cxx URL: http://svn.apache.org/viewvc/openoffice/branches/alg/aw080/main/sw/source/core/crsr/crsrsh.cxx?rev=1546124&r1=1546123&r2=1546124&view=diff ============================================================================== --- openoffice/branches/alg/aw080/main/sw/source/core/crsr/crsrsh.cxx (original) +++ openoffice/branches/alg/aw080/main/sw/source/core/crsr/crsrsh.cxx Wed Nov 27 17:25:40 2013 @@ -421,6 +421,66 @@ sal_Bool SwCrsrShell::LeftRight( sal_Boo } return bRet; } +//IAccessibility2 Implementation 2009----- +void SwCrsrShell::FirePageChangeEvent(sal_uInt16 nOldPage, sal_uInt16 nNewPage) +{ +#ifdef ACCESSIBLE_LAYOUT + if( Imp()->IsAccessible() ) + Imp()->FirePageChangeEvent( nOldPage, nNewPage ); +#endif +} + +void SwCrsrShell::FireColumnChangeEvent(sal_uInt16 nOldColumn, sal_uInt16 nNewColumn) +{ +#ifdef ACCESSIBLE_LAYOUT + if( Imp()->IsAccessible() ) + Imp()->FireColumnChangeEvent( nOldColumn, nNewColumn); +#endif +} + + +void SwCrsrShell::FireSectionChangeEvent(sal_uInt16 nOldSection, sal_uInt16 nNewSection) +{ +#ifdef ACCESSIBLE_LAYOUT + if( Imp()->IsAccessible() ) + Imp()->FireSectionChangeEvent( nOldSection, nNewSection ); +#endif +} +bool SwCrsrShell::bColumnChange() +{ + + sal_uInt16 nCurrCol = 0; + SwFrm* pCurrFrm = GetCurrFrm(sal_False); + + if (pCurrFrm == NULL) + { + return sal_False; + } + + SwFrm* pCurrCol=((SwFrm*)pCurrFrm)->FindColFrm(); + + while(pCurrCol== NULL && pCurrFrm!=NULL ) + { + SwLayoutFrm* pParent = pCurrFrm->GetUpper(); + if(pParent!=NULL) + { + pCurrCol=((SwFrm*)pParent)->FindColFrm(); + pCurrFrm = (SwFrm*)pParent; + } + else + { + break; + } + } + if(oldColFrm == pCurrCol) + return sal_False; + else + { + oldColFrm = pCurrCol; + return sal_True; + } +} +//-----IAccessibility2 Implementation 2009 // --> OD 2008-04-02 #refactorlists# void SwCrsrShell::MarkListLevel( const String& sListId, @@ -899,8 +959,10 @@ void SwCrsrShell::SwapPam() // Ansonsten wird er auf die gewaehlte SSelection gesetzt. -sal_Bool SwCrsrShell::ChgCurrPam( const Point & rPt, - sal_Bool bTstOnly, sal_Bool bTstHit ) +sal_Bool SwCrsrShell::ChgCurrPam( + const Point & rPt, + sal_Bool bTstOnly, + sal_Bool bTstHit ) { SET_CURR_SHELL( this ); @@ -1351,9 +1413,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 return; // wenn nicht, dann kein Update !! } - // --> OD 2005-12-14 #i27301# SwNotifyAccAboutInvalidTextSelections aInvalidateTextSelections( *this ); - // <-- if ( bIgnoreReadonly ) { @@ -1767,7 +1827,7 @@ void SwCrsrShell::UpdateCrsr( sal_uInt16 if( pBlockCrsr ) RefreshBlockCursor(); - if( !bIdleEnd && bHasFocus && !bBasicHideCrsr ) + if( !bIdleEnd && bHasFocus && !bBasicHideCrsr ) { if( pTblCrsr ) pTblCrsr->SwSelPaintRects::Show(); @@ -2083,23 +2143,25 @@ void SwCrsrShell::ShowCrsrs( sal_Bool bC void SwCrsrShell::ShowCrsr() { - if( !bBasicHideCrsr ) - { - bSVCrsrVis = sal_True; - UpdateCrsr(); - } + if( !bBasicHideCrsr ) + { + bSVCrsrVis = sal_True; + pCurCrsr->SetShowTxtInputFldOverlay( true ); + UpdateCrsr(); + } } void SwCrsrShell::HideCrsr() { - if( !bBasicHideCrsr ) - { - bSVCrsrVis = sal_False; - // evt. die sel. Bereiche aufheben !! - SET_CURR_SHELL( this ); - pVisCrsr->Hide(); - } + if( !bBasicHideCrsr ) + { + bSVCrsrVis = sal_False; + // evt. die sel. Bereiche aufheben !! + SET_CURR_SHELL( this ); + pCurCrsr->SetShowTxtInputFldOverlay( false ); + pVisCrsr->Hide(); + } } @@ -2599,6 +2661,9 @@ SwCrsrShell::SwCrsrShell( SwCrsrShell& r // UpdateCrsr( 0 ); // OD 11.02.2003 #100556# mbMacroExecAllowed = rShell.IsMacroExecAllowed(); + //IAccessibility2 Implementation 2009----- + oldColFrm = NULL; + //-----IAccessibility2 Implementation 2009 } @@ -2936,42 +3001,38 @@ sal_Bool SwCrsrShell::FindValidCntntNode } -void SwCrsrShell::NewCoreSelection() -{ -} - - sal_Bool SwCrsrShell::IsCrsrReadonly() const { if ( GetViewOptions()->IsReadonly() || - // --> FME 2004-06-29 #114856# Formular view - GetViewOptions()->IsFormView() ) - // <-- - { - SwFrm *pFrm = GetCurrFrm( sal_False ); + GetViewOptions()->IsFormView() ) // Formular view + { + SwFrm *pFrm = GetCurrFrm( sal_False ); const SwFlyFrm* pFly; const SwSection* pSection; if( pFrm && pFrm->IsInFly() && - (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() && - pFly->Lower() && - !pFly->Lower()->IsNoTxtFrm() && - !GetDrawView()->areSdrObjectsSelected() ) - { - return sal_False; - } - // --> FME 2004-06-22 #114856# edit in readonly sections + (pFly = pFrm->FindFlyFrm())->GetFmt()->GetEditInReadonly().GetValue() && + pFly->Lower() && + !pFly->Lower()->IsNoTxtFrm() && + !GetDrawView()->areSdrObjectsSelected() ) + { + return sal_False; + } + // edit in readonly sections else if ( pFrm && pFrm->IsInSct() && - 0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) && - pSection->IsEditInReadonlyFlag() ) + 0 != ( pSection = pFrm->FindSctFrm()->GetSection() ) && + pSection->IsEditInReadonlyFlag() ) + { + return sal_False; + } + else if ( !IsMultiSelection() && CrsrInsideInputFld() ) { return sal_False; } - // <-- - return sal_True; - } - return sal_False; + return sal_True; + } + return sal_False; }