2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001 Sun Microsystems Inc, Ximian Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
23 /* hypertext.c : implements the HyperText interface */
27 #include <atk/atkhypertext.h>
28 #include <libspi/hyperlink.h>
29 #include <libspi/hypertext.h>
32 spi_hypertext_interface_new (AtkObject *obj)
34 SpiHypertext *new_hypertext = g_object_new (SPI_HYPERTEXT_TYPE, NULL);
36 spi_text_construct (SPI_TEXT (new_hypertext), obj);
43 get_hypertext_from_servant (PortableServer_Servant servant)
45 SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
47 g_return_val_if_fail (object, NULL);
48 g_return_val_if_fail (ATK_IS_OBJECT(object->gobj), NULL);
49 return ATK_HYPERTEXT (object->gobj);
54 impl_getNLinks (PortableServer_Servant servant,
55 CORBA_Environment *ev)
57 AtkHypertext *hypertext = get_hypertext_from_servant (servant);
59 g_return_val_if_fail (hypertext != NULL, 0);
61 return (CORBA_long) atk_hypertext_get_n_links (hypertext);
65 static Accessibility_Hyperlink
66 impl_getLink (PortableServer_Servant servant,
67 const CORBA_long linkIndex,
68 CORBA_Environment *ev)
71 Accessibility_Hyperlink rv;
72 AtkHypertext *hypertext = get_hypertext_from_servant (servant);
74 g_return_val_if_fail (hypertext != NULL, CORBA_OBJECT_NIL);
76 link = atk_hypertext_get_link (hypertext, linkIndex);
77 g_return_val_if_fail (link != NULL, CORBA_OBJECT_NIL);
79 rv = BONOBO_OBJREF (spi_hyperlink_new (ATK_OBJECT (link)));
81 return CORBA_Object_duplicate (rv, ev);
86 impl_getLinkIndex (PortableServer_Servant servant,
87 const CORBA_long characterIndex,
88 CORBA_Environment *ev)
90 AtkHypertext *hypertext = get_hypertext_from_servant (servant);
92 g_return_val_if_fail (hypertext != NULL, 0);
95 atk_hypertext_get_link_index (hypertext,
96 (gint) characterIndex);
101 spi_hypertext_class_init (SpiHypertextClass *klass)
103 POA_Accessibility_Hypertext__epv *epv = &klass->epv;
105 /* Initialize epv table */
107 epv->getNLinks = impl_getNLinks;
108 epv->getLink = impl_getLink;
109 epv->getLinkIndex = impl_getLinkIndex;
114 spi_hypertext_init (SpiHypertext *hypertext)
119 BONOBO_TYPE_FUNC_FULL (SpiHypertext,
120 Accessibility_Hypertext,