X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=libspi%2Ftable.c;h=33290dd1770ce07467b0c8781737f8b45f819386;hb=9e35d068cb22995064eac08df7dc332fc4c38f7d;hp=75d3cec31779591961fa59e45f736116281b6baa;hpb=6b8a17da4e4bd45f748da8455b8ffad4c9942a59;p=platform%2Fcore%2Fuifw%2Fat-spi2-atk.git diff --git a/libspi/table.c b/libspi/table.c index 75d3cec..33290dd 100644 --- a/libspi/table.c +++ b/libspi/table.c @@ -172,7 +172,7 @@ impl_getRowDescription (PortableServer_Servant servant, const char *rv; AtkTable *table = get_table_from_servant (servant); - g_return_val_if_fail (table != NULL, 0); + g_return_val_if_fail (table != NULL, NULL); rv = atk_table_get_row_description (table, row); @@ -197,7 +197,7 @@ impl_getColumnDescription (PortableServer_Servant servant, g_return_val_if_fail (table != NULL, CORBA_string_dup ("")); - rv = atk_table_get_row_description (table, column); + rv = atk_table_get_column_description (table, column); if (rv) { @@ -269,12 +269,42 @@ impl_getColumnHeader (PortableServer_Servant servant, return spi_accessible_new_return (header, FALSE, ev); } +static CORBA_long +impl__get_nSelectedRows (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + gint *selectedRows = NULL; + gint retval = 0; + AtkTable *table = get_table_from_servant (servant); + + bonobo_return_val_if_fail (table != NULL, 0, ev); + + retval = atk_table_get_selected_rows (table, &selectedRows); + if (selectedRows) g_free (selectedRows); + return retval; +} + + +static CORBA_long +impl__get_nSelectedColumns (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + gint *selectedColumns = NULL; + gint retval = 0; + AtkTable *table = get_table_from_servant (servant); + + bonobo_return_val_if_fail (table != NULL, 0, ev); + + retval = atk_table_get_selected_columns (table, &selectedColumns); + if (selectedColumns) g_free (selectedColumns); + return retval; +} static Accessibility_LongSeq * impl_getSelectedRows (PortableServer_Servant servant, CORBA_Environment *ev) { - gint *selectedRows; + gint *selectedRows = NULL; gint length; Accessibility_LongSeq *retval; AtkTable *table = get_table_from_servant (servant); @@ -283,7 +313,7 @@ impl_getSelectedRows (PortableServer_Servant servant, length = atk_table_get_selected_rows (table, &selectedRows); - bonobo_return_val_if_fail (length > 0, NULL, ev); + bonobo_return_val_if_fail (length >= 0, NULL, ev); retval = Accessibility_LongSeq__alloc (); retval->_maximum = retval->_length = length; @@ -294,7 +324,7 @@ impl_getSelectedRows (PortableServer_Servant servant, retval->_buffer[length] = selectedRows[length]; } - g_free (selectedRows); + if (selectedRows) g_free (selectedRows); return retval; } @@ -304,7 +334,7 @@ static Accessibility_LongSeq * impl_getSelectedColumns (PortableServer_Servant servant, CORBA_Environment *ev) { - gint *selectedColumns; + gint *selectedColumns = NULL; gint length; Accessibility_LongSeq *retval; AtkTable *table = get_table_from_servant (servant); @@ -324,7 +354,7 @@ impl_getSelectedColumns (PortableServer_Servant servant, retval->_buffer[length] = (CORBA_long) selectedColumns[length]; } - g_free (selectedColumns); + if (selectedColumns) g_free (selectedColumns); return retval; } @@ -408,6 +438,47 @@ impl_removeColumnSelection (PortableServer_Servant servant, static CORBA_boolean +impl_getRowColumnExtentsAtIndex (PortableServer_Servant servant, + const CORBA_long index, + CORBA_long *row, + CORBA_long *column, + CORBA_long *row_extents, + CORBA_long *col_extents, + CORBA_boolean *is_selected, + CORBA_Environment *ev) +{ + + AtkObject *cell; + AtkRole role; + AtkTable *table = get_table_from_servant (servant); + gint intColumn, intRow, intRow_extents, intCol_extents; + gboolean boolIs_selected; + + g_return_val_if_fail (table != NULL, FALSE); + + intColumn = atk_table_get_column_at_index (table, index); + intRow = atk_table_get_row_at_index (table, index); + intRow_extents = atk_table_get_row_extent_at (table, intRow, intColumn); + intCol_extents = atk_table_get_column_extent_at (table, intRow, intColumn); + boolIs_selected = atk_table_is_selected (table, intRow, intColumn); + + *column = intColumn; + *row = intRow; + *row_extents = intRow_extents; + *col_extents = intCol_extents; + *is_selected = boolIs_selected; + + cell = atk_table_ref_at (table, intRow, intColumn); + role = atk_object_get_role (cell); + + if (role == ATK_ROLE_TABLE_CELL) + return TRUE; + + return FALSE; + +} + +static CORBA_boolean impl_isSelected (PortableServer_Servant servant, const CORBA_long row, const CORBA_long column, @@ -433,6 +504,8 @@ spi_table_class_init (SpiTableClass *klass) epv->_get_summary = impl__get_summary; epv->_get_nRows = impl__get_nRows; epv->_get_nColumns = impl__get_nColumns; + epv->_get_nSelectedRows = impl__get_nSelectedRows; + epv->_get_nSelectedColumns = impl__get_nSelectedColumns; epv->getAccessibleAt = impl_getAccessibleAt; epv->getIndexAt = impl_getIndexAt; epv->getRowAtIndex = impl_getRowAtIndex; @@ -452,6 +525,7 @@ spi_table_class_init (SpiTableClass *klass) epv->removeRowSelection = impl_removeRowSelection; epv->removeColumnSelection = impl_removeColumnSelection; epv->isSelected = impl_isSelected; + epv->getRowColumnExtentsAtIndex = impl_getRowColumnExtentsAtIndex; } static void