Added new method to Accessibility::Table; see RFE #326536.
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 12 Jul 2006 14:59:47 +0000 (14:59 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Wed, 12 Jul 2006 14:59:47 +0000 (14:59 +0000)
git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@835 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
cspi/spi.h
cspi/spi_table.c
idl/Accessibility_Table.idl
libspi/table.c

index c05db52..98c600f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,26 @@
 2006-07-12  Bill Haneman <billh@gnome.org> modifications to patch from
 2006-07-12  Ariel Rios  <arios@us.ibm.com>
 
+       See RFE #326536.
+       
+       * idl/Accessibility_Table.idl:
+       (getRowColumnExtentsAtIndex): New method for getting
+       selection status and extents in one API call.
+
+       * libspi/table.c:
+       (impl_getRowColumnExtentsAtIndex): Implementation of
+       new method above.
+       (spi_table_class_init): Add above to epv.
+
+       * cspi/spi.h:
+       * cspi/spi_table.c:
+       (AccessibleTable_getRowColumnExtentsAtIndex): New
+       method, retrieves selection status and row/col extents
+       for a table cell in a single API call.
+
+2006-07-12  Bill Haneman <billh@gnome.org> modifications to patch from
+2006-07-12  Ariel Rios  <arios@us.ibm.com>
+
        * cspi/bonobo/cspi-bonobo.c: Remove warning adding <cspi/spi-private.h>
 
        * cspi/spi_text.c: 
index 0eb4821..71d3d51 100644 (file)
@@ -908,6 +908,12 @@ AccessibleTable_getColumnExtentAt (AccessibleTable *obj,
                                    long int row,
                                    long int column);
 
+SPIBoolean
+AccessibleTable_getRowColumnExtentsAtIndex (AccessibleTable *obj,
+                                           long int index, long int *row, long int *col, 
+                                           long int *row_extents, long int *col_extents, 
+                                           long int *is_selected);
+
 Accessible *
 AccessibleTable_getRowHeader (AccessibleTable *obj,
                              long int row);
index da083db..a42f4bc 100644 (file)
@@ -717,6 +717,47 @@ AccessibleTable_removeColumnSelection (AccessibleTable *obj,
   return retval;
 }
 
+
+SPIBoolean
+AccessibleTable_getRowColumnExtentsAtIndex (AccessibleTable *obj,
+                                           long int index, long int *row, long int *col, 
+                                           long int *row_extents, long int *col_extents, 
+                                           long int *is_selected){
+  SPIBoolean retval;
+  CORBA_long cRow,  cCol, cRow_extents, cCol_extents; 
+  CORBA_boolean cIs_selected;
+
+  cspi_return_val_if_fail (obj != NULL, FALSE);
+
+  retval = Accessibility_Table_getRowColumnExtentsAtIndex (CSPI_OBJREF (obj),
+                                                          index, &cRow, &cCol,
+                                                          &cRow_extents, &cCol_extents,
+                                                          &cIs_selected,
+                                                          cspi_ev ());
+
+  if (!cspi_check_ev ("getRowColumnExtentsAtIndex")){
+    
+    *row = 0;
+    *col = 0;
+    *row_extents = 0;
+    *col_extents = 0;
+    *is_selected = FALSE;
+    retval = FALSE;
+  }
+
+  else {
+    *row = cRow;
+    *col = cCol;
+    *row_extents = cRow_extents;;
+    *col_extents = cCol_extents;
+    *is_selected = cIs_selected;;
+  }
+  
+  return retval;
+
+}
+
+
 /**
  * AccessibleTable_isSelected:
  * @obj: a pointer to the #AccessibleTable implementor on which to operate.
index 0e2ee67..a995ba3 100644 (file)
@@ -291,7 +291,52 @@ typedef sequence<long> LongSeq;
     * \c False if not. 
     **/
    boolean removeColumnSelection (in long column);
-
+   /** 
+    * Given a child index, determine the row and column indices and 
+    * extents, and whether the cell is currently selected.  If
+    * the child at \c index is not a cell (for instance, if it is 
+    * a summary, caption, etc.), \c False is returned.
+    *
+    * @param index the index of the Table child whose row/column 
+    * extents are requested.
+    * @param row back-filled with the first table row associated with
+    * the cell with child index \c index.
+    * @param col back-filled with the first table column associated 
+    * with the cell with child index \c index.
+    * @param row_extents back-filled with the number of table rows 
+    * across which child \c i extends.
+    * @param col_extents back-filled with the number of table columns
+    * across which child \c i extends.
+    * @param is_selected a boolean which is back-filled with \c True
+    * if the child at index \c i corresponds to a selected table cell,
+    * \c False otherwise.
+    *
+    * Example:
+    * If the Table child at index '6' extends across columns 5 and 6 of
+    * row 2 of a Table instance, and is currently selected, then
+    * \code
+    * retval = table::getRowColumnExtentsAtIndex (6, row, col, 
+    *                                             row_extents,
+    *                                             col_extents,
+    *                                             is_selected);
+    * \endcode
+    * will return True, and after the call
+    * \c row, \c col, \c row_extents, \c col_extents,
+    * and \c is_selected will contain \c 2, \c 5, \c 1, \c 2, and 
+    * \c True, respectively.
+    *
+    * @returns \c True if the index is associated with a valid table
+    * cell, \c False if the index does not correspond to a cell.  If 
+    * \c False is returned, the values of the out parameters are 
+    * undefined.
+    * 
+    * @since AT-SPI 1.7.0
+    **/
+    boolean getRowColumnExtentsAtIndex (in long index, out long row, 
+                                       out long col, 
+                                       out long row_extents, 
+                                       out long col_extents, 
+                                       out boolean is_selected);
     /** \cond
      * unImplemented:
      *
@@ -304,7 +349,6 @@ typedef sequence<long> LongSeq;
     void unImplemented5 ();
     void unImplemented6 ();
     void unImplemented7 ();
-    void unImplemented8 ();
     /** \endcond */
   };
 };
index 2c834cb..33290dd 100644 (file)
@@ -438,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,
@@ -484,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