summaryrefslogtreecommitdiffstats
path: root/accessibility/source/extended/AccessibleGridControlTable.cxx
diff options
context:
space:
mode:
authorMihaela Kedikova <misheto@openoffice.org>2010-03-22 11:17:10 +0100
committerMihaela Kedikova <misheto@openoffice.org>2010-03-22 11:17:10 +0100
commita3ab9e8435dc16a89589e552a66485da4eb60d04 (patch)
treed601d19eec70acb6e125e426d3f14bdeb216ccdb /accessibility/source/extended/AccessibleGridControlTable.cxx
parent#i10000# reenabled missing include (diff)
downloadcore-a3ab9e8435dc16a89589e552a66485da4eb60d04.tar.gz
core-a3ab9e8435dc16a89589e552a66485da4eb60d04.zip
recent changes for grid control
Diffstat (limited to 'accessibility/source/extended/AccessibleGridControlTable.cxx')
-rwxr-xr-xaccessibility/source/extended/AccessibleGridControlTable.cxx97
1 files changed, 44 insertions, 53 deletions
diff --git a/accessibility/source/extended/AccessibleGridControlTable.cxx b/accessibility/source/extended/AccessibleGridControlTable.cxx
index 3b51c986b8b1..8457406010de 100755
--- a/accessibility/source/extended/AccessibleGridControlTable.cxx
+++ b/accessibility/source/extended/AccessibleGridControlTable.cxx
@@ -54,8 +54,6 @@ namespace accessibility {
// ============================================================================
-// Ctor/Dtor/disposing --------------------------------------------------------
-
DBG_NAME( AccessibleGridControlTable )
AccessibleGridControlTable::AccessibleGridControlTable(
@@ -64,12 +62,10 @@ AccessibleGridControlTable::AccessibleGridControlTable(
AccessibleTableControlObjType _eType) :
AccessibleGridControlTableBase( rxParent, rTable, _eType )
{
- DBG_CTOR( AccessibleGridControlTable, NULL );
}
AccessibleGridControlTable::~AccessibleGridControlTable()
{
- DBG_DTOR( AccessibleGridControlTable, NULL );
}
// XAccessibleContext ---------------------------------------------------------
@@ -197,20 +193,28 @@ Sequence< sal_Int32 > SAL_CALL AccessibleGridControlTable::getSelectedAccessible
// Sequence< sal_Int32 > aSelSeq;
// implGetSelectedColumns( aSelSeq );
// return aSelSeq;
- return NULL;
+ Sequence< sal_Int32 > aSelSeq(0);
+ return aSelSeq;
}
-//To Do: not implemented yet
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleRowSelected( sal_Int32 nRow )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- //TCSolarGuard aSolarGuard;
- //::osl::MutexGuard aGuard( getOslMutex() );
- //ensureIsAlive();
- //ensureIsValidRow( nRow );
- //return implIsRowSelected( nRow );
- (void) nRow;
- return sal_False;
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidRow( nRow );
+ sal_Bool bSelected = sal_False;
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0; i<selectedRows.getLength(); i++)
+ {
+ if(nRow == selectedRows[i])
+ {
+ bSelected = sal_True;
+ continue;
+ }
+ }
+ return bSelected;
}
//columns aren't selectable
@@ -241,16 +245,14 @@ sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleSelected(
sal_Int32 nRow, sal_Int32 nColumn )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- /*TCSolarGuard aSolarGuard;
+ TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidAddress( nRow, nColumn );
- return implIsRowSelected( nRow ) || implIsColumnSelected( nColumn );*/
- (void) nRow;
(void) nColumn;
- return sal_False;
+ //selection of single cells not possible, so if row is selected, the cell will be selected too
+ return isAccessibleRowSelected(nRow);
}
-//To Do: not implemented yet
void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
@@ -258,48 +260,51 @@ void SAL_CALL AccessibleGridControlTable::selectAccessibleChild( sal_Int32 nChil
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
ensureIsValidIndex( nChildIndex );
- //if( isRowBar() )
- // implSelectRow( nChildIndex, sal_True );
- //else
- // implSelectColumn( implToVCLColumnPos( nChildIndex ), sal_True );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ std::vector< sal_Int32 > selectedRows = m_aTable.GetSelectedRows();
+ selectedRows.push_back(nRow);
}
-//To Do - not implemented yet
sal_Bool SAL_CALL AccessibleGridControlTable::isAccessibleChildSelected( sal_Int32 nChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
{
- // using interface methods - no mutex
- /*return isRowBar() ?
- isAccessibleRowSelected( nChildIndex ) :
- isAccessibleColumnSelected( nChildIndex );*/
- (void)nChildIndex;
- return FALSE;
+ TCSolarGuard aSolarGuard;
+ ::osl::MutexGuard aGuard( getOslMutex() );
+ ensureIsAlive();
+ ensureIsValidIndex( nChildIndex );
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ sal_Int32 nRow = (nChildIndex / nColumns);
+ return isAccessibleRowSelected(nRow);
}
-//To Do - not implemented yet
void SAL_CALL AccessibleGridControlTable::clearAccessibleSelection()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
+ for(int i=0;i<m_aTable.GetSelectedRows().size();i++)
+ m_aTable.RemoveSelectedRow((sal_Int32)i);
}
-//To Do - not implemented yet
void SAL_CALL AccessibleGridControlTable::selectAllAccessibleChildren()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ for(int i=0;i<m_aTable.GetRowCount();i++)
+ selectedRows[i]=i;
}
-//To Do - not implemented yet
sal_Int32 SAL_CALL AccessibleGridControlTable::getSelectedAccessibleChildCount()
throw ( uno::RuntimeException )
{
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- return 0;
+ Sequence< sal_Int32 > selectedRows = getSelectedAccessibleRows();
+ sal_Int32 nColumns = m_aTable.GetColumnCount();
+ return selectedRows.getLength()*nColumns;
}
-//To Do - not implemented yet
Reference< XAccessible > SAL_CALL
AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
@@ -307,10 +312,12 @@ AccessibleGridControlTable::getSelectedAccessibleChild( sal_Int32 nSelectedChild
TCSolarGuard aSolarGuard;
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
- (void)nSelectedChildIndex;
- return NULL;
+ if(isAccessibleChildSelected(nSelectedChildIndex))
+ return getAccessibleChild(nSelectedChildIndex);
+ else
+ return NULL;
}
-//To Do - not implemented yet
+//not implemented yet, because only row selection possible
void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
sal_Int32 nSelectedChildIndex )
throw ( lang::IndexOutOfBoundsException, uno::RuntimeException )
@@ -319,14 +326,6 @@ void SAL_CALL AccessibleGridControlTable::deselectAccessibleChild(
::osl::MutexGuard aGuard( getOslMutex() );
ensureIsAlive();
(void)nSelectedChildIndex;
- // method may throw lang::IndexOutOfBoundsException
- //if ( isAccessibleChildSelected(nSelectedChildIndex) )
- //{
- // if( isRowBar() )
- // implSelectRow( nSelectedChildIndex, sal_False );
- // else
- // implSelectColumn( implToVCLColumnPos( nSelectedChildIndex ), sal_False );
- //}
}
// XInterface -----------------------------------------------------------------
@@ -367,14 +366,6 @@ Rectangle AccessibleGridControlTable::implGetBoundingBoxOnScreen()
return m_aTable.calcTableRect();
}
// internal helper methods ----------------------------------------------------
-//To Do - not implemented yet
-//sal_Int32 AccessibleGridControlTable::implGetChildIndexFromSelectedIndex(
-// sal_Int32 nSelectedChildIndex )
-// throw ( lang::IndexOutOfBoundsException )
-//{
-// (void)nSelectedChildIndex;
-// return 0;
-//}
Reference< XAccessibleTable > AccessibleGridControlTable::implGetHeaderBar(
sal_Int32 nChildIndex )
throw ( uno::RuntimeException )