Back to index

lightning-sunbird  0.9+nobinonly
Functions
nsMaiInterfaceTable.cpp File Reference
#include "nsMaiInterfaceTable.h"

Go to the source code of this file.

Functions

static G_BEGIN_DECLS void interfaceInitCB (AtkTableIface *aIface)
static AtkObject * refAtCB (AtkTable *aTable, gint aRow, gint aColumn)
static gint getIndexAtCB (AtkTable *aTable, gint aRow, gint aColumn)
static gint getColumnAtIndexCB (AtkTable *aTable, gint aIndex)
static gint getRowAtIndexCB (AtkTable *aTable, gint aIndex)
static gint getColumnCountCB (AtkTable *aTable)
static gint getRowCountCB (AtkTable *aTable)
static gint getColumnExtentAtCB (AtkTable *aTable, gint aRow, gint aColumn)
static gint getRowExtentAtCB (AtkTable *aTable, gint aRow, gint aColumn)
static AtkObject * getCaptionCB (AtkTable *aTable)
static const gchar * getColumnDescriptionCB (AtkTable *aTable, gint aColumn)
static AtkObject * getColumnHeaderCB (AtkTable *aTable, gint aColumn)
static const gchar * getRowDescriptionCB (AtkTable *aTable, gint aRow)
static AtkObject * getRowHeaderCB (AtkTable *aTable, gint aRow)
static AtkObject * getSummaryCB (AtkTable *aTable)
static gint getSelectedColumnsCB (AtkTable *aTable, gint **aSelected)
static gint getSelectedRowsCB (AtkTable *aTable, gint **aSelected)
static gboolean isColumnSelectedCB (AtkTable *aTable, gint aColumn)
static gboolean isRowSelectedCB (AtkTable *aTable, gint aRow)
static gboolean isCellSelectedCB (AtkTable *aTable, gint aRow, gint aColumn)

Function Documentation

AtkObject * getCaptionCB ( AtkTable *  aTable) [static]

Definition at line 329 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    nsCOMPtr<nsIAccessible> caption;
    nsresult rv = accTable->GetCaption(getter_AddRefs(caption));
    if (NS_FAILED(rv) || !caption)
        return nsnull;

    nsIAccessible *tmpAcc = caption;
    nsAccessibleWrap *captionAccWrap =
        NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);

    return captionAccWrap->GetAtkObject();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getColumnAtIndexCB ( AtkTable *  aTable,
gint  aIndex 
) [static]

Definition at line 219 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 col;
    nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, col);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getColumnCountCB ( AtkTable *  aTable) [static]

Definition at line 255 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 count;
    nsresult rv = accTable->GetColumns(&count);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar * getColumnDescriptionCB ( AtkTable *  aTable,
gint  aColumn 
) [static]

Definition at line 352 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    MaiInterfaceTable *maiTable =
        NS_STATIC_CAST(MaiInterfaceTable *,
                       accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
    NS_ENSURE_TRUE(maiTable, nsnull);

    const char *description = maiTable->GetColumnDescription();
    if (!description) {
        nsAutoString autoStr;
        nsresult rv = accTable->GetColumnDescription(aColumn, autoStr);
        NS_ENSURE_SUCCESS(rv, nsnull);

        maiTable->SetColumnDescription(autoStr);
        description = maiTable->GetColumnDescription();
    }
    return description;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getColumnExtentAtCB ( AtkTable *  aTable,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 291 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 extent;
    nsresult rv = accTable->GetColumnExtentAt(aRow, aColumn, &extent);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, extent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject * getColumnHeaderCB ( AtkTable *  aTable,
gint  aColumn 
) [static]

Definition at line 380 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    nsCOMPtr<nsIAccessibleTable> header;
    nsresult rv = accTable->GetColumnHeader(getter_AddRefs(header));
    NS_ENSURE_SUCCESS(rv, nsnull);
    NS_ENSURE_TRUE(header, nsnull);

    // Note: "table column header" has different definition between atk and mai
    //
    // 1. "getColumnHeaderCB" defined in AtkTableIface should return object
    // whose role is "ATK_ROLE_TABLE_COLUMN_HEADER", which is implemented
    // by nsXULTreeColumnitemAccessible.
    //
    // 2. "GetColumnHeader" defined in nsIAccessibleTable returns
    // nsXULTreeColumnsAccessibleWrap, which exports nsIAccessibleTable and is
    // "ROLE_LIST".
    nsCOMPtr<nsIAccessible> accHeader;
    header->CellRefAt(0, aColumn, getter_AddRefs(accHeader));
    NS_ENSURE_TRUE(accHeader, nsnull);

    nsIAccessible *tmpAcc = accHeader;
    nsAccessibleWrap *headerAccWrap =
        NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);

    return headerAccWrap->GetAtkObject();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getIndexAtCB ( AtkTable *  aTable,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 201 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 index;
    nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, index);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getRowAtIndexCB ( AtkTable *  aTable,
gint  aIndex 
) [static]

Definition at line 237 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 row;
    nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, row);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getRowCountCB ( AtkTable *  aTable) [static]

Definition at line 273 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 count;
    nsresult rv = accTable->GetRows(&count);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

const gchar * getRowDescriptionCB ( AtkTable *  aTable,
gint  aRow 
) [static]

Definition at line 416 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    MaiInterfaceTable *maiTable =
        NS_STATIC_CAST(MaiInterfaceTable *,
                       accWrap->GetMaiInterface(MAI_INTERFACE_TABLE));
    NS_ENSURE_TRUE(maiTable, nsnull);

    nsAutoString autoStr;
    nsresult rv = accTable->GetRowDescription(aRow, autoStr);
    NS_ENSURE_SUCCESS(rv, nsnull);

    maiTable->SetRowDescription(autoStr);
    return maiTable->GetRowDescription();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getRowExtentAtCB ( AtkTable *  aTable,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 310 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, -1);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, -1);

    PRInt32 extent;
    nsresult rv = accTable->GetRowExtentAt(aRow, aColumn, &extent);
    NS_ENSURE_SUCCESS(rv, -1);

    return NS_STATIC_CAST(gint, extent);
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject * getRowHeaderCB ( AtkTable *  aTable,
gint  aRow 
) [static]

Definition at line 440 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    nsCOMPtr<nsIAccessibleTable> header;
    nsresult rv = accTable->GetRowHeader(getter_AddRefs(header));
    NS_ENSURE_SUCCESS(rv, nsnull);

    nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header));
    NS_ENSURE_TRUE(accTable, nsnull);

    nsIAccessible *tmpAcc = accHeader;
    nsAccessibleWrap *headerAccWrap =
        NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);

    return headerAccWrap->GetAtkObject();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getSelectedColumnsCB ( AtkTable *  aTable,
gint **  aSelected 
) [static]

Definition at line 472 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, 0);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, 0);

    PRUint32 size = 0;
    PRInt32 *columns = NULL;
    nsresult rv = accTable->GetSelectedColumns(&size, &columns);
    if (NS_FAILED(rv) || (size == 0) || !columns) {
        *aSelected = nsnull;
        return 0;
    }

    gint *atkColumns = g_new(gint, size);
    if (!atkColumns) {
        NS_WARNING("OUT OF MEMORY");
        return nsnull;
    }

    //copy
    for (PRUint32 index = 0; index < size; ++index)
        atkColumns[index] = NS_STATIC_CAST(gint, columns[index]);
    nsMemory::Free(columns);

    *aSelected = atkColumns;
    return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getSelectedRowsCB ( AtkTable *  aTable,
gint **  aSelected 
) [static]

Definition at line 506 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, 0);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, 0);

    PRUint32 size = 0;
    PRInt32 *rows = NULL;
    nsresult rv = accTable->GetSelectedRows(&size, &rows);
    if (NS_FAILED(rv) || (size == 0) || !rows) {
        *aSelected = nsnull;
        return 0;
    }

    gint *atkRows = g_new(gint, size);
    if (!atkRows) {
        NS_WARNING("OUT OF MEMORY");
        return nsnull;
    }

    //copy
    for (PRUint32 index = 0; index < size; ++index)
        atkRows[index] = NS_STATIC_CAST(gint, rows[index]);
    nsMemory::Free(rows);

    *aSelected = atkRows;
    return size;
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject * getSummaryCB ( AtkTable *  aTable) [static]

Definition at line 465 of file nsMaiInterfaceTable.cpp.

{
    /* ??? in nsIAccessibleTable, it returns a nsAString */
    return nsnull;
}

Here is the caller graph for this function:

void interfaceInitCB ( AtkTableIface *  aIface) [static]

Definition at line 148 of file nsMaiInterfaceTable.cpp.

{
    g_return_if_fail(aIface != NULL);

    aIface->ref_at = refAtCB;
    aIface->get_index_at = getIndexAtCB;
    aIface->get_column_at_index = getColumnAtIndexCB;
    aIface->get_row_at_index = getRowAtIndexCB;
    aIface->get_n_columns = getColumnCountCB;
    aIface->get_n_rows = getRowCountCB;
    aIface->get_column_extent_at = getColumnExtentAtCB;
    aIface->get_row_extent_at = getRowExtentAtCB;
    aIface->get_caption = getCaptionCB;
    aIface->get_column_description = getColumnDescriptionCB;
    aIface->get_column_header = getColumnHeaderCB;
    aIface->get_row_description = getRowDescriptionCB;
    aIface->get_row_header = getRowHeaderCB;
    aIface->get_summary = getSummaryCB;
    aIface->get_selected_columns = getSelectedColumnsCB;
    aIface->get_selected_rows = getSelectedRowsCB;
    aIface->is_column_selected = isColumnSelectedCB;
    aIface->is_row_selected = isRowSelectedCB;
    aIface->is_selected = isCellSelectedCB;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean isCellSelectedCB ( AtkTable *  aTable,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 572 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, FALSE);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, FALSE);

    PRBool outValue;
    nsresult rv = accTable->IsCellSelected(aRow, aColumn, &outValue);
    return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean isColumnSelectedCB ( AtkTable *  aTable,
gint  aColumn 
) [static]

Definition at line 540 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, FALSE);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, FALSE);

    PRBool outValue;
    nsresult rv = accTable->IsColumnSelected(aColumn, &outValue);
    return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean isRowSelectedCB ( AtkTable *  aTable,
gint  aRow 
) [static]

Definition at line 556 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, FALSE);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, FALSE);

    PRBool outValue;
    nsresult rv = accTable->IsRowSelected(aRow, &outValue);
    return NS_FAILED(rv) ? FALSE : NS_STATIC_CAST(gboolean, outValue);
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject * refAtCB ( AtkTable *  aTable,
gint  aRow,
gint  aColumn 
) [static]

Definition at line 176 of file nsMaiInterfaceTable.cpp.

{
    nsAccessibleWrap *accWrap = GetAccessibleWrap(ATK_OBJECT(aTable));
    NS_ENSURE_TRUE(accWrap, nsnull);

    nsCOMPtr<nsIAccessibleTable> accTable;
    accWrap->QueryInterface(NS_GET_IID(nsIAccessibleTable),
                            getter_AddRefs(accTable));
    NS_ENSURE_TRUE(accTable, nsnull);

    nsCOMPtr<nsIAccessible> cell;
    nsresult rv = accTable->CellRefAt(aRow, aColumn,getter_AddRefs(cell));
    if (NS_FAILED(rv) || !cell)
        return nsnull;

    nsIAccessible *tmpAcc = cell;
    nsAccessibleWrap *cellAccWrap = NS_STATIC_CAST(nsAccessibleWrap *, tmpAcc);

    AtkObject *atkObj = cellAccWrap->GetAtkObject();
    if (atkObj)
        g_object_ref(atkObj);
    return atkObj;
}

Here is the call graph for this function:

Here is the caller graph for this function: