0490b22307d1589b38b54ac7abd9857669bcdd50
[platform/core/uifw/at-spi2-atk.git] / cspi / spi_hypertext.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001 Sun Microsystems Inc.
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 #include <cspi/spi-private.h>
24
25 /**
26  * AccessibleHypertext_ref:
27  * @obj: a pointer to the #AccessibleHypertext object on which to operate.
28  *
29  * Increment the reference count for an #AccessibleHypertext object.
30  *       Since AccessibleHypertext is derived from AccessibleText,
31  *       this is the same as AccessibleText_unref().
32  **/
33 void
34 AccessibleHypertext_ref (AccessibleHypertext *obj)
35 {
36   cspi_object_ref (obj);
37 }
38
39 /**
40  * AccessibleHypertext_unref:
41  * @obj: a pointer to the #AccessibleHypertext object on which to operate.
42  *
43  * Decrement the reference count for an #AccessibleHypertext object.
44  *       Since AccessibleHypertext is derived from AccessibleText,
45  *       this is the same as AccessibleText_unref().
46  **/
47 void
48 AccessibleHypertext_unref (AccessibleHypertext *obj)
49 {
50   cspi_object_unref (obj);
51 }
52
53 /**
54  * AccessibleHypertext_getNLinks:
55  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
56  *
57  * Get the total number of #AccessibleHyperlinks which an
58  *        #AccessibleHypertext implementor has.
59  *
60  * Returns: a #long indicating the number of #AccessibleHyperlinks
61  *        of the #AccessibleHypertext implementor, or -1 if
62  *        the number cannot be determined (for example, if the
63  *        #AccessibleHypertext object is so large that it is not
64  *        all currently in the memory cache).
65  **/
66 long
67 AccessibleHypertext_getNLinks (AccessibleHypertext *obj)
68 {
69   long retval;
70
71   cspi_return_val_if_fail (obj != NULL, FALSE);
72
73   retval =
74     Accessibility_Hypertext_getNLinks (CSPI_OBJREF (obj), cspi_ev ());
75
76   cspi_return_val_if_ev ("getNLinks", -1);
77
78   return retval;
79 }
80
81 /**
82  * AccessibleHypertext_getLink:
83  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
84  * @linkIndex: a (zero-index) long integer indicating which hyperlink to query.
85  *
86  * Get the #AccessibleHyperlink object at a specified index.
87  *
88  * Returns: the #AccessibleHyperlink object specified by #linkIndex.
89  **/
90 AccessibleHyperlink *
91 AccessibleHypertext_getLink (AccessibleHypertext *obj,
92                              long int             linkIndex)
93 {
94   AccessibleHyperlink *retval;
95         
96   cspi_return_val_if_fail (obj != NULL, FALSE);
97
98   retval = cspi_object_add (
99     Accessibility_Hypertext_getLink (CSPI_OBJREF (obj),
100                                      (CORBA_long) linkIndex,
101                                      cspi_ev ()));
102   
103   cspi_return_val_if_ev ("getLink", NULL); 
104
105   return retval;
106 }
107
108 /**
109  * AccessibleHypertext_getLinkIndex:
110  * @obj: a pointer to the #AccessibleHypertext implementor on which to operate.
111  * @characterOffset: an integer specifying the character offset to query.
112  *
113  * Get the index of the #AccessibleHyperlink object at a specified
114  *        character offset.
115  *
116  * Returns: the linkIndex of the #AccessibleHyperlink active at
117  *        character offset @characterOffset, or -1 if there is
118  *        no hyperlink at the specified character offset.
119  **/
120 long
121 AccessibleHypertext_getLinkIndex (AccessibleHypertext *obj,
122                                   long int             characterOffset)
123 {
124   long retval;
125
126   cspi_return_val_if_fail (obj != NULL, -1);
127
128   retval = 
129     Accessibility_Hypertext_getLinkIndex (CSPI_OBJREF (obj),
130                                           (CORBA_long) characterOffset,
131                                           cspi_ev ());
132
133   cspi_return_val_if_ev ("getLinkIndex", -1);
134
135   return retval;
136 }
137
138