Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions | Variables
nsMaiHyperlink.cpp File Reference
#include "nsIURI.h"
#include "nsMaiHyperlink.h"

Go to the source code of this file.

Classes

Defines

#define MAI_TYPE_ATK_HYPERLINK   (mai_atk_hyperlink_get_type ())
#define MAI_ATK_HYPERLINK(obj)
#define MAI_ATK_HYPERLINK_CLASS(klass)
#define MAI_IS_ATK_HYPERLINK(obj)
#define MAI_IS_ATK_HYPERLINK_CLASS(klass)
#define MAI_ATK_HYPERLINK_GET_CLASS(obj)

Functions

GType mai_atk_hyperlink_get_type (void)
static G_BEGIN_DECLS void classInitCB (AtkHyperlinkClass *aClass)
static void finalizeCB (GObject *aObj)
static gchar * getUriCB (AtkHyperlink *aLink, gint aLinkIndex)
static AtkObject * getObjectCB (AtkHyperlink *aLink, gint aLinkIndex)
static gint getEndIndexCB (AtkHyperlink *aLink)
static gint getStartIndexCB (AtkHyperlink *aLink)
static gboolean isValidCB (AtkHyperlink *aLink)
static gint getAnchorCountCB (AtkHyperlink *aLink)
static nsIAccessibleHyperLinkget_accessible_hyperlink (AtkHyperlink *aHyperlink)

Variables

static G_END_DECLS gpointer parent_class = NULL

Class Documentation

struct MaiAtkHyperlink

This MaiAtkHyperlink is a thin wrapper, in the MAI namespace, for AtkHyperlink.

Definition at line 64 of file nsMaiHyperlink.cpp.

Collaboration diagram for MaiAtkHyperlink:
Class Members
MaiHyperlink * maiHyperlink
AtkHyperlink parent
gchar * uri
struct MaiAtkHyperlinkClass

Definition at line 76 of file nsMaiHyperlink.cpp.

Class Members
AtkHyperlinkClass parent_class

Define Documentation

Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj),\
                                     MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlink))

Definition at line 48 of file nsMaiHyperlink.cpp.

Value:
(G_TYPE_CHECK_CLASS_CAST ((klass),\
                                 MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlinkClass))

Definition at line 50 of file nsMaiHyperlink.cpp.

Value:
(G_TYPE_INSTANCE_GET_CLASS ((obj),\
                                 MAI_TYPE_ATK_HYPERLINK, MaiAtkHyperlinkClass))

Definition at line 56 of file nsMaiHyperlink.cpp.

Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj),\
                                        MAI_TYPE_ATK_HYPERLINK))

Definition at line 52 of file nsMaiHyperlink.cpp.

Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass),\
                                        MAI_TYPE_ATK_HYPERLINK))

Definition at line 54 of file nsMaiHyperlink.cpp.

Definition at line 47 of file nsMaiHyperlink.cpp.


Function Documentation

void classInitCB ( AtkHyperlinkClass *  aClass) [static]

Definition at line 195 of file nsMaiHyperlink.cpp.

{
    GObjectClass *gobject_class = G_OBJECT_CLASS(aClass);

    parent_class = g_type_class_peek_parent(aClass);

    aClass->get_uri = getUriCB;
    aClass->get_object = getObjectCB;
    aClass->get_end_index = getEndIndexCB;
    aClass->get_start_index = getStartIndexCB;
    aClass->is_valid = isValidCB;
    aClass->get_n_anchors = getAnchorCountCB;

    gobject_class->finalize = finalizeCB;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void finalizeCB ( GObject *  aObj) [static]

Definition at line 212 of file nsMaiHyperlink.cpp.

{
    NS_ASSERTION(MAI_IS_ATK_HYPERLINK(aObj), "Invalid MaiAtkHyperlink");
    if (!MAI_IS_ATK_HYPERLINK(aObj))
        return;

    MaiAtkHyperlink *maiHyperlink = MAI_ATK_HYPERLINK(aObj);
    if (maiHyperlink->uri)
        g_free(maiHyperlink->uri);
    maiHyperlink->maiHyperlink = nsnull;

    /* call parent finalize function */
    if (G_OBJECT_CLASS (parent_class)->finalize)
        G_OBJECT_CLASS (parent_class)->finalize(aObj);
}

Here is the caller graph for this function:

nsIAccessibleHyperLink * get_accessible_hyperlink ( AtkHyperlink *  aHyperlink) [static]

Definition at line 317 of file nsMaiHyperlink.cpp.

{
    NS_ENSURE_TRUE(MAI_IS_ATK_HYPERLINK(aHyperlink), nsnull);
    MaiHyperlink * maiHyperlink =
        MAI_ATK_HYPERLINK(aHyperlink)->maiHyperlink;
    NS_ENSURE_TRUE(maiHyperlink != nsnull, nsnull);
    NS_ENSURE_TRUE(maiHyperlink->GetAtkHyperlink() == aHyperlink, nsnull);
    return maiHyperlink->GetAccHyperlink();
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getAnchorCountCB ( AtkHyperlink *  aLink) [static]

Definition at line 304 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, -1);

    PRInt32 count = -1;
    nsresult rv = accHyperlink->GetAnchors(&count);
    return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, count);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getEndIndexCB ( AtkHyperlink *  aLink) [static]

Definition at line 269 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, -1);

    PRInt32 endIndex = -1;
    nsresult rv = accHyperlink->GetEndIndex(&endIndex);

    return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, endIndex);
}

Here is the call graph for this function:

Here is the caller graph for this function:

AtkObject * getObjectCB ( AtkHyperlink *  aLink,
gint  aLinkIndex 
) [static]

Definition at line 250 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, nsnull);

    nsCOMPtr<nsIAccessible> accObj;
    nsresult rv = accHyperlink->GetObject(aLinkIndex, getter_AddRefs(accObj));
    NS_ENSURE_SUCCESS(rv, nsnull);
    AtkObject *atkObj = nsnull;
    if (accObj) {
        nsIAccessible *tmpObj = accObj;
        nsAccessibleWrap *accWrap = NS_STATIC_CAST(nsAccessibleWrap *, tmpObj);
        atkObj = accWrap->GetAtkObject();
    }
    //no need to add ref it, because it is "get" not "ref" ???
    return atkObj;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gint getStartIndexCB ( AtkHyperlink *  aLink) [static]

Definition at line 281 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, -1);

    PRInt32 startIndex = -1;
    nsresult rv = accHyperlink->GetStartIndex(&startIndex);

    return (NS_FAILED(rv)) ? -1 : NS_STATIC_CAST(gint, startIndex);
}

Here is the call graph for this function:

Here is the caller graph for this function:

gchar * getUriCB ( AtkHyperlink *  aLink,
gint  aLinkIndex 
) [static]

Definition at line 229 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, nsnull);

    MaiAtkHyperlink *maiHyperlink = MAI_ATK_HYPERLINK(accHyperlink);
    if (maiHyperlink->uri)
        return maiHyperlink->uri;

    nsCOMPtr<nsIURI> uri;
    nsresult rv = accHyperlink->GetURI(aLinkIndex,getter_AddRefs(uri));
    if (NS_FAILED(rv) || !uri)
        return nsnull;
    nsCAutoString cautoStr;
    rv = uri->GetSpec(cautoStr);

    maiHyperlink->uri = g_strdup(cautoStr.get());
    return maiHyperlink->uri;
}

Here is the call graph for this function:

Here is the caller graph for this function:

gboolean isValidCB ( AtkHyperlink *  aLink) [static]

Definition at line 293 of file nsMaiHyperlink.cpp.

{
    nsIAccessibleHyperLink *accHyperlink = get_accessible_hyperlink(aLink);
    NS_ENSURE_TRUE(accHyperlink, FALSE);

    PRBool isValid = PR_FALSE;
    nsresult rv = accHyperlink->IsValid(&isValid);
    return (NS_FAILED(rv)) ? FALSE : NS_STATIC_CAST(gboolean, isValid);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 102 of file nsMaiHyperlink.cpp.

{
    static GType type = 0;

    if (!type) {
        static const GTypeInfo tinfo = {
            sizeof(MaiAtkHyperlinkClass),
            (GBaseInitFunc)NULL,
            (GBaseFinalizeFunc)NULL,
            (GClassInitFunc)classInitCB,
            (GClassFinalizeFunc)NULL,
            NULL, /* class data */
            sizeof(MaiAtkHyperlink), /* instance size */
            0, /* nb preallocs */
            (GInstanceInitFunc)NULL,
            NULL /* value table */
        };

        type = g_type_register_static(ATK_TYPE_HYPERLINK,
                                      "MaiAtkHyperlink",
                                      &tinfo, GTypeFlags(0));
    }
    return type;
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

G_END_DECLS gpointer parent_class = NULL [static]

Definition at line 97 of file nsMaiHyperlink.cpp.