Back to index

lightning-sunbird  0.9+nobinonly
nsMaiInterfaceTable.cpp
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
00002 /* vim:expandtab:shiftwidth=4:tabstop=4:
00003  */
00004 /* ***** BEGIN LICENSE BLOCK *****
00005  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
00006  *
00007  *
00008  * The contents of this file are subject to the Mozilla Public
00009  * License Version 1.1 (the "License"); you may not use this file
00010  * except in compliance with the License. You may obtain a copy of
00011  * the License at http://www.mozilla.org/MPL/
00012  *
00013  * Software distributed under the License is distributed on an "AS
00014  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
00015  * implied. See the License for the specific language governing
00016  * rights and limitations under the License.
00017  *
00018  * The Original Code is mozilla.org code.
00019  *
00020  * The Initial Developer of the Original Code is Sun Microsystems, Inc.
00021  * Portions created by Sun Microsystems are Copyright (C) 2002 Sun
00022  * Microsystems, Inc. All Rights Reserved.
00023  *
00024  * Original Author: Bolian Yin (bolian.yin@sun.com)
00025  *
00026  * Contributor(s):
00027  *
00028  * Alternatively, the contents of this file may be used under the terms of
00029  * either the GNU General Public License Version 2 or later (the "GPL"), or
00030  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00031  * in which case the provisions of the GPL or the LGPL are applicable instead
00032  * of those above. If you wish to allow use of your version of this file only
00033  * under the terms of either the GPL or the LGPL, and not to allow others to
00034  * use your version of this file under the terms of the NPL, indicate your
00035  * decision by deleting the provisions above and replace them with the notice
00036  * and other provisions required by the GPL or the LGPL. If you do not delete
00037  * the provisions above, a recipient may use your version of this file under
00038  * the terms of any one of the NPL, the GPL or the LGPL.
00039  *
00040  * ***** END LICENSE BLOCK ***** */
00041 
00042 #include "nsMaiInterfaceTable.h"
00043 
00044 G_BEGIN_DECLS
00045 
00046 /* table interface callbacks */
00047 static void interfaceInitCB(AtkTableIface *aIface);
00048 static AtkObject* refAtCB(AtkTable *aTable, gint aRow, gint aColumn);
00049 static gint getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn);
00050 static gint getColumnAtIndexCB(AtkTable *aTable, gint aIndex);
00051 static gint getRowAtIndexCB(AtkTable *aTable, gint aIndex);
00052 static gint getColumnCountCB(AtkTable *aTable);
00053 static gint getRowCountCB(AtkTable *aTable);
00054 static gint getColumnExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
00055 static gint getRowExtentAtCB(AtkTable *aTable, gint aRow, gint aColumn);
00056 static AtkObject* getCaptionCB(AtkTable *aTable);
00057 static const gchar* getColumnDescriptionCB(AtkTable *aTable, gint aColumn);
00058 static AtkObject* getColumnHeaderCB(AtkTable *aTable, gint aColumn);
00059 static const gchar* getRowDescriptionCB(AtkTable *aTable, gint aRow);
00060 static AtkObject* getRowHeaderCB(AtkTable *aTable, gint aRow);
00061 static AtkObject* getSummaryCB(AtkTable *aTable);
00062 static gint getSelectedColumnsCB(AtkTable *aTable, gint **aSelected);
00063 static gint getSelectedRowsCB(AtkTable *aTable, gint **aSelected);
00064 static gboolean isColumnSelectedCB(AtkTable *aTable, gint aColumn);
00065 static gboolean isRowSelectedCB(AtkTable *aTable, gint aRow);
00066 static gboolean isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn);
00067 
00068 /* what are missing now for atk table */
00069 
00070 /* ==================================================
00071    void              (* set_caption)              (AtkTable      *aTable,
00072    AtkObject     *caption);
00073    void              (* set_column_description)   (AtkTable      *aTable,
00074    gint          aColumn,
00075    const gchar   *description);
00076    void              (* set_column_header)        (AtkTable      *aTable,
00077    gint          aColumn,
00078    AtkObject     *header);
00079    void              (* set_row_description)      (AtkTable      *aTable,
00080    gint          aRow,
00081    const gchar   *description);
00082    void              (* set_row_header)           (AtkTable      *aTable,
00083    gint          aRow,
00084    AtkObject     *header);
00085    void              (* set_summary)              (AtkTable      *aTable,
00086    AtkObject     *accessible);
00087    gboolean          (* add_row_selection)        (AtkTable      *aTable,
00088    gint          aRow);
00089    gboolean          (* remove_row_selection)     (AtkTable      *aTable,
00090    gint          aRow);
00091    gboolean          (* add_column_selection)     (AtkTable      *aTable,
00092    gint          aColumn);
00093    gboolean          (* remove_column_selection)  (AtkTable      *aTable,
00094    gint          aColumn);
00095 
00097    // signal handlers
00098    //
00099    void              (* row_inserted)           (AtkTable      *aTable,
00100    gint          aRow,
00101    gint          num_inserted);
00102    void              (* column_inserted)        (AtkTable      *aTable,
00103    gint          aColumn,
00104    gint          num_inserted);
00105    void              (* row_deleted)              (AtkTable      *aTable,
00106    gint          aRow,
00107    gint          num_deleted);
00108    void              (* column_deleted)           (AtkTable      *aTable,
00109    gint          aColumn,
00110    gint          num_deleted);
00111    void              (* row_reordered)            (AtkTable      *aTable);
00112    void              (* column_reordered)         (AtkTable      *aTable);
00113    void              (* model_changed)            (AtkTable      *aTable);
00114 
00115    * ==================================================
00116    */
00117 G_END_DECLS
00118 
00119 MaiInterfaceTable::MaiInterfaceTable(nsAccessibleWrap* aAccWrap):
00120     MaiInterface(aAccWrap)
00121 {
00122 }
00123 
00124 MaiInterfaceTable::~MaiInterfaceTable()
00125 {
00126 }
00127 
00128 MaiInterfaceType
00129 MaiInterfaceTable::GetType()
00130 {
00131     return MAI_INTERFACE_TABLE;
00132 }
00133 
00134 const GInterfaceInfo *
00135 MaiInterfaceTable::GetInterfaceInfo()
00136 {
00137     static const GInterfaceInfo atk_if_table_info = {
00138         (GInterfaceInitFunc)interfaceInitCB,
00139         (GInterfaceFinalizeFunc) NULL,
00140         NULL
00141     };
00142     return &atk_if_table_info;
00143 }
00144 
00145 /* static functions */
00146 
00147 void
00148 interfaceInitCB(AtkTableIface *aIface)
00149 
00150 {
00151     g_return_if_fail(aIface != NULL);
00152 
00153     aIface->ref_at = refAtCB;
00154     aIface->get_index_at = getIndexAtCB;
00155     aIface->get_column_at_index = getColumnAtIndexCB;
00156     aIface->get_row_at_index = getRowAtIndexCB;
00157     aIface->get_n_columns = getColumnCountCB;
00158     aIface->get_n_rows = getRowCountCB;
00159     aIface->get_column_extent_at = getColumnExtentAtCB;
00160     aIface->get_row_extent_at = getRowExtentAtCB;
00161     aIface->get_caption = getCaptionCB;
00162     aIface->get_column_description = getColumnDescriptionCB;
00163     aIface->get_column_header = getColumnHeaderCB;
00164     aIface->get_row_description = getRowDescriptionCB;
00165     aIface->get_row_header = getRowHeaderCB;
00166     aIface->get_summary = getSummaryCB;
00167     aIface->get_selected_columns = getSelectedColumnsCB;
00168     aIface->get_selected_rows = getSelectedRowsCB;
00169     aIface->is_column_selected = isColumnSelectedCB;
00170     aIface->is_row_selected = isRowSelectedCB;
00171     aIface->is_selected = isCellSelectedCB;
00172 }
00173 
00174 /* static */
00175 AtkObject*
00176 refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
00177 {
00178     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00179     NS_ENSURE_TRUE(accWrap, nsnull);
00180 
00181     nsCOMPtr<nsIAccessibleTable> accTable;
00182     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00183                             getter_AddRefs(accTable));
00184     NS_ENSURE_TRUE(accTable, nsnull);
00185 
00186     nsCOMPtr<nsIAccessible> cell;
00187     nsresult rv = accTable->CellRefAt(aRow, aColumn,getter_AddRefs(cell));
00188     if (NS_FAILED(rv) || !cell)
00189         return nsnull;
00190 
00191     nsIAccessible *tmpAcc = cell;
00192     nsAccessibleWrap *cellAccWrap = NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
00193 
00194     AtkObject *atkObj = cellAccWrap->GetAtkObject();
00195     if (atkObj)
00196         g_object_ref(atkObj);
00197     return atkObj;
00198 }
00199 
00200 gint
00201 getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
00202 {
00203     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00204     NS_ENSURE_TRUE(accWrap, -1);
00205 
00206     nsCOMPtr<nsIAccessibleTable> accTable;
00207     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00208                             getter_AddRefs(accTable));
00209     NS_ENSURE_TRUE(accTable, -1);
00210 
00211     PRInt32 index;
00212     nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
00213     NS_ENSURE_SUCCESS(rv, -1);
00214 
00215     return NS_STATIC_CAST(gint, index);
00216 }
00217 
00218 gint
00219 getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
00220 {
00221     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00222     NS_ENSURE_TRUE(accWrap, -1);
00223 
00224     nsCOMPtr<nsIAccessibleTable> accTable;
00225     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00226                             getter_AddRefs(accTable));
00227     NS_ENSURE_TRUE(accTable, -1);
00228 
00229     PRInt32 col;
00230     nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
00231     NS_ENSURE_SUCCESS(rv, -1);
00232 
00233     return NS_STATIC_CAST(gint, col);
00234 }
00235 
00236 gint
00237 getRowAtIndexCB(AtkTable *aTable, gint aIndex)
00238 {
00239     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00240     NS_ENSURE_TRUE(accWrap, -1);
00241 
00242     nsCOMPtr<nsIAccessibleTable> accTable;
00243     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00244                             getter_AddRefs(accTable));
00245     NS_ENSURE_TRUE(accTable, -1);
00246 
00247     PRInt32 row;
00248     nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
00249     NS_ENSURE_SUCCESS(rv, -1);
00250 
00251     return NS_STATIC_CAST(gint, row);
00252 }
00253 
00254 gint
00255 getColumnCountCB(AtkTable *aTable)
00256 {
00257     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00258     NS_ENSURE_TRUE(accWrap, -1);
00259 
00260     nsCOMPtr<nsIAccessibleTable> accTable;
00261     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00262                             getter_AddRefs(accTable));
00263     NS_ENSURE_TRUE(accTable, -1);
00264 
00265     PRInt32 count;
00266     nsresult rv = accTable->GetColumns(&count);
00267     NS_ENSURE_SUCCESS(rv, -1);
00268 
00269     return NS_STATIC_CAST(gint, count);
00270 }
00271 
00272 gint
00273 getRowCountCB(AtkTable *aTable)
00274 {
00275     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00276     NS_ENSURE_TRUE(accWrap, -1);
00277 
00278     nsCOMPtr<nsIAccessibleTable> accTable;
00279     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00280                             getter_AddRefs(accTable));
00281     NS_ENSURE_TRUE(accTable, -1);
00282 
00283     PRInt32 count;
00284     nsresult rv = accTable->GetRows(&count);
00285     NS_ENSURE_SUCCESS(rv, -1);
00286 
00287     return NS_STATIC_CAST(gint, count);
00288 }
00289 
00290 gint
00291 getColumnExtentAtCB(AtkTable *aTable,
00292                     gint aRow, gint aColumn)
00293 {
00294     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00295     NS_ENSURE_TRUE(accWrap, -1);
00296 
00297     nsCOMPtr<nsIAccessibleTable> accTable;
00298     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00299                             getter_AddRefs(accTable));
00300     NS_ENSURE_TRUE(accTable, -1);
00301 
00302     PRInt32 extent;
00303     nsresult rv = accTable->GetColumnExtentAt(aRow, aColumn, &extent);
00304     NS_ENSURE_SUCCESS(rv, -1);
00305 
00306     return NS_STATIC_CAST(gint, extent);
00307 }
00308 
00309 gint
00310 getRowExtentAtCB(AtkTable *aTable,
00311                  gint aRow, gint aColumn)
00312 {
00313     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00314     NS_ENSURE_TRUE(accWrap, -1);
00315 
00316     nsCOMPtr<nsIAccessibleTable> accTable;
00317     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00318                             getter_AddRefs(accTable));
00319     NS_ENSURE_TRUE(accTable, -1);
00320 
00321     PRInt32 extent;
00322     nsresult rv = accTable->GetRowExtentAt(aRow, aColumn, &extent);
00323     NS_ENSURE_SUCCESS(rv, -1);
00324 
00325     return NS_STATIC_CAST(gint, extent);
00326 }
00327 
00328 AtkObject*
00329 getCaptionCB(AtkTable *aTable)
00330 {
00331     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00332     NS_ENSURE_TRUE(accWrap, nsnull);
00333 
00334     nsCOMPtr<nsIAccessibleTable> accTable;
00335     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00336                             getter_AddRefs(accTable));
00337     NS_ENSURE_TRUE(accTable, nsnull);
00338 
00339     nsCOMPtr<nsIAccessible> caption;
00340     nsresult rv = accTable->GetCaption(getter_AddRefs(caption));
00341     if (NS_FAILED(rv) || !caption)
00342         return nsnull;
00343 
00344     nsIAccessible *tmpAcc = caption;
00345     nsAccessibleWrap *captionAccWrap =
00346         NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
00347 
00348     return captionAccWrap->GetAtkObject();
00349 }
00350 
00351 const gchar*
00352 getColumnDescriptionCB(AtkTable *aTable, gint aColumn)
00353 {
00354     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00355     NS_ENSURE_TRUE(accWrap, nsnull);
00356 
00357     nsCOMPtr<nsIAccessibleTable> accTable;
00358     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00359                             getter_AddRefs(accTable));
00360     NS_ENSURE_TRUE(accTable, nsnull);
00361 
00362     MaiInterfaceTable *maiTable =
00363         NS_STATIC_CAST(MaiInterfaceTable *,
00364                        accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
00365     NS_ENSURE_TRUE(maiTable, nsnull);
00366 
00367     const char *description = maiTable->GetColumnDescription();
00368     if (!description) {
00369         nsAutoString autoStr;
00370         nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
00371         NS_ENSURE_SUCCESS(rv, nsnull);
00372 
00373         maiTable->SetColumnDescription(autoStr);
00374         description = maiTable->GetColumnDescription();
00375     }
00376     return description;
00377 }
00378 
00379 AtkObject*
00380 getColumnHeaderCB(AtkTable *aTable, gint aColumn)
00381 {
00382     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00383     NS_ENSURE_TRUE(accWrap, nsnull);
00384 
00385     nsCOMPtr<nsIAccessibleTable> accTable;
00386     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00387                             getter_AddRefs(accTable));
00388     NS_ENSURE_TRUE(accTable, nsnull);
00389 
00390     nsCOMPtr<nsIAccessibleTable> header;
00391     nsresult rv = accTable->GetColumnHeader(getter_AddRefs(header));
00392     NS_ENSURE_SUCCESS(rv, nsnull);
00393     NS_ENSURE_TRUE(header, nsnull);
00394 
00395     // Note: "table column header" has different definition between atk and mai
00396     //
00397     // 1. "getColumnHeaderCB" defined in AtkTableIface should return object
00398     // whose role is "ATK_ROLE_TABLE_COLUMN_HEADER", which is implemented
00399     // by nsXULTreeColumnitemAccessible.
00400     //
00401     // 2. "GetColumnHeader" defined in nsIAccessibleTable returns
00402     // nsXULTreeColumnsAccessibleWrap, which exports nsIAccessibleTable and is
00403     // "ROLE_LIST".
00404     nsCOMPtr<nsIAccessible> accHeader;
00405     header->CellRefAt(0, aColumn, getter_AddRefs(accHeader));
00406     NS_ENSURE_TRUE(accHeader, nsnull);
00407 
00408     nsIAccessible *tmpAcc = accHeader;
00409     nsAccessibleWrap *headerAccWrap =
00410         NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
00411 
00412     return headerAccWrap->GetAtkObject();
00413 }
00414 
00415 const gchar*
00416 getRowDescriptionCB(AtkTable *aTable, gint aRow)
00417 {
00418     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00419     NS_ENSURE_TRUE(accWrap, nsnull);
00420 
00421     nsCOMPtr<nsIAccessibleTable> accTable;
00422     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00423                             getter_AddRefs(accTable));
00424     NS_ENSURE_TRUE(accTable, nsnull);
00425 
00426     MaiInterfaceTable *maiTable =
00427         NS_STATIC_CAST(MaiInterfaceTable *,
00428                        accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
00429     NS_ENSURE_TRUE(maiTable, nsnull);
00430 
00431     nsAutoString autoStr;
00432     nsresult rv = accTable->GetRowDescription(aRow, autoStr);
00433     NS_ENSURE_SUCCESS(rv, nsnull);
00434 
00435     maiTable->SetRowDescription(autoStr);
00436     return maiTable->GetRowDescription();
00437 }
00438 
00439 AtkObject*
00440 getRowHeaderCB(AtkTable *aTable, gint aRow)
00441 {
00442     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00443     NS_ENSURE_TRUE(accWrap, nsnull);
00444 
00445     nsCOMPtr<nsIAccessibleTable> accTable;
00446     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00447                             getter_AddRefs(accTable));
00448     NS_ENSURE_TRUE(accTable, nsnull);
00449 
00450     nsCOMPtr<nsIAccessibleTable> header;
00451     nsresult rv = accTable->GetRowHeader(getter_AddRefs(header));
00452     NS_ENSURE_SUCCESS(rv, nsnull);
00453 
00454     nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header));
00455     NS_ENSURE_TRUE(accTable, nsnull);
00456 
00457     nsIAccessible *tmpAcc = accHeader;
00458     nsAccessibleWrap *headerAccWrap =
00459         NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);
00460 
00461     return headerAccWrap->GetAtkObject();
00462 }
00463 
00464 AtkObject*
00465 getSummaryCB(AtkTable *aTable)
00466 {
00467     /* ??? in nsIAccessibleTable, it returns a nsAString */
00468     return nsnull;
00469 }
00470 
00471 gint
00472 getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
00473 {
00474     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00475     NS_ENSURE_TRUE(accWrap, 0);
00476 
00477     nsCOMPtr<nsIAccessibleTable> accTable;
00478     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00479                             getter_AddRefs(accTable));
00480     NS_ENSURE_TRUE(accTable, 0);
00481 
00482     PRUint32 size = 0;
00483     PRInt32 *columns = NULL;
00484     nsresult rv = accTable->GetSelectedColumns(&size, &columns);
00485     if (NS_FAILED(rv) || (size == 0) || !columns) {
00486         *aSelected = nsnull;
00487         return 0;
00488     }
00489 
00490     gint *atkColumns = g_new(gint, size);
00491     if (!atkColumns) {
00492         NS_WARNING("OUT OF MEMORY");
00493         return nsnull;
00494     }
00495 
00496     //copy
00497     for (PRUint32 index = 0; index < size; ++index)
00498         atkColumns[index] = NS_STATIC_CAST(gint, columns[index]);
00499     nsMemory::Free(columns);
00500 
00501     *aSelected = atkColumns;
00502     return size;
00503 }
00504 
00505 gint
00506 getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
00507 {
00508     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00509     NS_ENSURE_TRUE(accWrap, 0);
00510 
00511     nsCOMPtr<nsIAccessibleTable> accTable;
00512     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00513                             getter_AddRefs(accTable));
00514     NS_ENSURE_TRUE(accTable, 0);
00515 
00516     PRUint32 size = 0;
00517     PRInt32 *rows = NULL;
00518     nsresult rv = accTable->GetSelectedRows(&size, &rows);
00519     if (NS_FAILED(rv) || (size == 0) || !rows) {
00520         *aSelected = nsnull;
00521         return 0;
00522     }
00523 
00524     gint *atkRows = g_new(gint, size);
00525     if (!atkRows) {
00526         NS_WARNING("OUT OF MEMORY");
00527         return nsnull;
00528     }
00529 
00530     //copy
00531     for (PRUint32 index = 0; index < size; ++index)
00532         atkRows[index] = NS_STATIC_CAST(gint, rows[index]);
00533     nsMemory::Free(rows);
00534 
00535     *aSelected = atkRows;
00536     return size;
00537 }
00538 
00539 gboolean
00540 isColumnSelectedCB(AtkTable *aTable, gint aColumn)
00541 {
00542     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00543     NS_ENSURE_TRUE(accWrap, FALSE);
00544 
00545     nsCOMPtr<nsIAccessibleTable> accTable;
00546     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00547                             getter_AddRefs(accTable));
00548     NS_ENSURE_TRUE(accTable, FALSE);
00549 
00550     PRBool outValue;
00551     nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
00552     return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
00553 }
00554 
00555 gboolean
00556 isRowSelectedCB(AtkTable *aTable, gint aRow)
00557 {
00558     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00559     NS_ENSURE_TRUE(accWrap, FALSE);
00560 
00561     nsCOMPtr<nsIAccessibleTable> accTable;
00562     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00563                             getter_AddRefs(accTable));
00564     NS_ENSURE_TRUE(accTable, FALSE);
00565 
00566     PRBool outValue;
00567     nsresult rv = accTable->IsRowSelected(aRow, &outValue);
00568     return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
00569 }
00570 
00571 gboolean
00572 isCellSelectedCB(AtkTable *aTable, gint aRow, gint aColumn)
00573 {
00574     nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
00575     NS_ENSURE_TRUE(accWrap, FALSE);
00576 
00577     nsCOMPtr<nsIAccessibleTable> accTable;
00578     accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
00579                             getter_AddRefs(accTable));
00580     NS_ENSURE_TRUE(accTable, FALSE);
00581 
00582     PRBool outValue;
00583     nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
00584     return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
00585 }