Esempio n. 1
0
JNIEXPORT jlong JNICALL
Java_org_gnome_atk_AtkHyperlinkImpl_atk_1hyperlink_1impl_1get_1hyperlink
(
	JNIEnv* env,
	jclass cls,
	jlong _self
)
{
	AtkHyperlink* result;
	jlong _result;
	AtkHyperlinkImpl* self;

	// convert parameter self
	self = (AtkHyperlinkImpl*) _self;

	// call function
	result = atk_hyperlink_impl_get_hyperlink(self);

	// cleanup parameter self

	// translate return value to JNI type
	_result = (jlong) result;

	// cleanup return value
	if (result != NULL) {
		bindings_java_memory_cleanup((GObject*)result, FALSE);
	}

	// and finally
	return _result;
}
Esempio n. 2
0
static AtkHyperlink *
ev_page_accessible_get_link (AtkHypertext *hypertext,
			     gint          link_index)
{
	GHashTable       *links;
	EvMappingList    *link_mapping;
	gint              n_links;
	EvMapping        *mapping;
	EvLinkAccessible *atk_link;
	EvPageAccessible *self = EV_PAGE_ACCESSIBLE (hypertext);
	EvView *view = ev_page_accessible_get_view (self);

	if (link_index < 0)
		return NULL;

	if (!EV_IS_DOCUMENT_LINKS (view->document))
		return NULL;

	links = ev_page_accessible_get_links (EV_PAGE_ACCESSIBLE (hypertext));

	atk_link = g_hash_table_lookup (links, GINT_TO_POINTER (link_index));
	if (atk_link)
		return atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (atk_link));

	link_mapping = ev_page_cache_get_link_mapping (view->page_cache, self->priv->page);
	if (!link_mapping)
		return NULL;

	n_links = ev_mapping_list_length (link_mapping);
	if (link_index > n_links - 1)
		return NULL;

	mapping = ev_mapping_list_nth (link_mapping, n_links - link_index - 1);
	atk_link = ev_link_accessible_new (EV_PAGE_ACCESSIBLE (hypertext),
					   EV_LINK (mapping->data),
					   &mapping->area);
	g_hash_table_insert (links, GINT_TO_POINTER (link_index), atk_link);

	return atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (atk_link));
}
Esempio n. 3
0
static void
ev_page_accessible_initialize_children (EvPageAccessible *self)
{
	EvView *view;
	EvMappingList *images;
	EvMappingList *links;
	EvMappingList *fields;
	GList *children = NULL;
	GList *list;

	if (self->priv->children_initialized)
		return;

	view = ev_page_accessible_get_view (self);
	if (!ev_page_cache_is_page_cached (view->page_cache, self->priv->page))
		return;

	self->priv->children_initialized = TRUE;

	links = ev_page_cache_get_link_mapping (view->page_cache, self->priv->page);
	images = ev_page_cache_get_image_mapping (view->page_cache, self->priv->page);
	fields = ev_page_cache_get_form_field_mapping (view->page_cache, self->priv->page);
	if (!links && !images && !fields)
		return;

	children = g_list_copy (ev_mapping_list_get_list (links));
	children = g_list_concat (children, g_list_copy (ev_mapping_list_get_list (images)));
	children = g_list_concat (children, g_list_copy (ev_mapping_list_get_list (fields)));

	children = g_list_sort (children, (GCompareFunc) compare_mappings);
	self->priv->children = g_ptr_array_new_full (g_list_length (children), (GDestroyNotify) g_object_unref);

	for (list = children; list && list->data; list = list->next) {
		EvMapping *mapping = list->data;
		AtkObject *child = NULL;

		if (links && ev_mapping_list_find (links, mapping->data)) {
			EvLinkAccessible *link = ev_link_accessible_new (self, EV_LINK (mapping->data), &mapping->area);
			AtkHyperlink *atk_link = atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (link));

			child = atk_hyperlink_get_object (atk_link, 0);
		} else if (images && ev_mapping_list_find (images, mapping->data))
			child = ATK_OBJECT (ev_image_accessible_new (self, EV_IMAGE (mapping->data), &mapping->area));
		else if (fields && ev_mapping_list_find (fields, mapping->data))
			child = ATK_OBJECT (ev_form_field_accessible_new (self, EV_FORM_FIELD (mapping->data), &mapping->area));

		if (child)
			g_ptr_array_add (self->priv->children, child);
	}

	g_list_free (children);
}
JSRetainPtr<JSStringRef> AccessibilityUIElement::url()
{
    if (!ATK_IS_HYPERLINK_IMPL(m_element.get()))
        return JSStringCreateWithCharacters(0, 0);

    AtkHyperlink* hyperlink = atk_hyperlink_impl_get_hyperlink(ATK_HYPERLINK_IMPL(m_element.get()));
    GOwnPtr<char> hyperlinkURI(atk_hyperlink_get_uri(hyperlink, 0));

    // Build the result string, stripping the absolute URL paths if present.
    char* localURI = g_strstr_len(hyperlinkURI.get(), -1, "LayoutTests");
    String axURL = String::format("AXURL: %s", localURI ? localURI : hyperlinkURI.get());
    return JSStringCreateWithUTF8CString(axURL.utf8().data());
}
Esempio n. 5
0
static AtkHyperlink *
get_hyperlink_from_servant (PortableServer_Servant servant)
{
  SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));

  g_return_val_if_fail (object != NULL, NULL);
  if (ATK_IS_HYPERLINK(object->gobj)) 
  {
      return ATK_HYPERLINK (object->gobj);
  }
  else if (ATK_IS_HYPERLINK_IMPL(object->gobj))
  {
      return atk_hyperlink_impl_get_hyperlink (ATK_HYPERLINK_IMPL (object->gobj));
  }
  else
      return NULL;
}