Replaced deprecated "Rename to" GTK-Doc tag
[platform/upstream/at-spi2-core.git] / atspi / atspi-document.c
1 /*
2  * AT-SPI - Assistive Technology Service Provider Interface
3  * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
4  *
5  * Copyright 2001, 2002 Sun Microsystems Inc.,
6  * Copyright 2001, 2002 Ximian, Inc.
7  *
8  * This library is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU Library General Public
10  * License as published by the Free Software Foundation; either
11  * version 2 of the License, or (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Library General Public License for more details.
17  *
18  * You should have received a copy of the GNU Library General Public
19  * License along with this library; if not, write to the
20  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21  * Boston, MA 02111-1307, USA.
22  */
23
24 #include "atspi-private.h"
25
26 /**
27  * atspi_document_get_locale:
28  * @obj: a pointer to the #AtspiDocument object on which to operate.
29  *
30  * Gets the locale associated with the document's content, 
31  * e.g. the locale for LOCALE_TYPE_MESSAGES.
32  *
33  * Returns: a string compliant with the POSIX standard for locale description.
34  **/
35 gchar *
36 atspi_document_get_locale (AtspiDocument *obj, GError **error)
37 {
38   gchar *retval = NULL;
39
40   g_return_val_if_fail (obj != NULL, g_strdup ("C"));
41
42   _atspi_dbus_call (obj, atspi_interface_document, "GetLocale", error, "=>s", &retval);
43
44   return retval;
45 }
46
47 /**
48  * atspi_document_get_attribute_value: (rename-to atspi_document_get_document_attribute_value)
49  * @obj: a pointer to the #AtspiDocument object on which to operate.
50  * @attribute: a string indicating the name of a specific attribute.
51  *
52  * Gets the value of a single attribute, if specified for the document as a whole.
53  *
54  * Returns: a string corresponding to the value of the specified attribute, or
55  * an empty string if the attribute is unspecified for the object.
56  *
57  * Deprecated: 2.10: Use atspi_document_get_document_attribute_value instead.
58  **/
59 gchar *
60 atspi_document_get_attribute_value (AtspiDocument *obj,
61                                       gchar *attribute,
62                                       GError **error)
63 {
64   return atspi_document_get_document_attribute_value (obj, attribute, error);
65 }
66                                       
67 /**
68  * atspi_document_get_document_attribute_value:
69  * @obj: a pointer to the #AtspiDocument object on which to operate.
70  * @attribute: a string indicating the name of a specific attribute.
71  *
72  * Gets the value of a single attribute, if specified for the document as a whole.
73  *
74  * Returns: a string corresponding to the value of the specified attribute, or
75  * an empty string if the attribute is unspecified for the object.
76  **/
77 gchar *
78 atspi_document_get_document_attribute_value (AtspiDocument *obj,
79                                              gchar *attribute,
80                                              GError **error)
81 {
82   gchar *retval = NULL;
83
84   g_return_val_if_fail (obj != NULL, NULL);
85
86   _atspi_dbus_call (obj, atspi_interface_document, "GetAttributeValue", error, "s=>s", attribute, &retval);
87
88   if (!retval)
89     retval = g_strdup ("");
90
91   return retval;
92 }
93                                       
94
95 /**
96  * atspi_document_get_attributes: (rename-to atspi_document_get_document_attributes)
97  * @obj: a pointer to the #AtspiDocument object on which to operate.
98  * 
99  * Gets all constant attributes for the document as a whole. For attributes
100  * that change within the document content, see @atspi_text_get_attribute_run instead.
101  * 
102  * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
103  *          containing the constant attributes of the document, as name-value pairs.
104  *
105  * Deprecated: 2.10: Use atspi_document_get_document_attributes instead.
106  **/
107 GHashTable *
108 atspi_document_get_attributes (AtspiDocument *obj, GError **error)
109 {
110   return atspi_document_get_document_attributes (obj, error);
111 }
112
113 /**
114  * atspi_document_get_document_attributes:
115  * @obj: a pointer to the #AtspiDocument object on which to operate.
116  * 
117  * Gets all constant attributes for the document as a whole. For attributes
118  * that change within the document content, see @atspi_text_get_attribute_run instead.
119  * 
120  * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
121  *          containing the constant attributes of the document, as name-value pairs.
122  **/
123 GHashTable *
124 atspi_document_get_document_attributes (AtspiDocument *obj, GError **error)
125 {
126   DBusMessage *message;
127
128     g_return_val_if_fail (obj != NULL, NULL);
129
130   message = _atspi_dbus_call_partial (obj, atspi_interface_document, "GetAttributes", error, "");
131   return _atspi_dbus_return_hash_from_message (message);
132 }
133
134 /**
135  * atspi_document_get_page_count:
136  * @obj: a pointer to the #AtspiDocument object to query.
137  *
138  * Gets the page count of an #AccessibleDocument object.
139  *
140  * Returns: a #gint indicating the page count of an
141  * #AccessibleDocument object.
142  **/
143 gint
144 atspi_document_get_page_count (AtspiDocument *obj, GError **error)
145 {
146   dbus_int32_t retval = 0;
147
148   g_return_val_if_fail (obj != NULL, -1);
149
150   _atspi_dbus_get_property (obj, atspi_interface_document, "PageCount", error, "i", &retval);
151
152   return retval;
153 }
154
155 /**
156  * atspi_document_get_current_page_number:
157  * @obj: a pointer to the #AtspiDocument object to query.
158  *
159  * Gets the current page number of an #AccessibleDocument object.
160  *
161  * Returns: a #gint indicating the current page number in the
162  * #AccessibleDocument object.
163  **/
164 gint
165 atspi_document_get_current_page_number (AtspiDocument *obj, GError **error)
166 {
167   dbus_int32_t retval = 0;
168
169   g_return_val_if_fail (obj != NULL, -1);
170
171   _atspi_dbus_get_property (obj, atspi_interface_document, "CurrentPageNumber", error, "i", &retval);
172
173   return retval;
174 }
175
176 static void
177 atspi_document_base_init (AtspiDocument *klass)
178 {
179 }
180
181 GType
182 atspi_document_get_type (void)
183 {
184   static GType type = 0;
185
186   if (!type) {
187     static const GTypeInfo tinfo =
188     {
189       sizeof (AtspiDocument),
190       (GBaseInitFunc) atspi_document_base_init,
191       (GBaseFinalizeFunc) NULL,
192     };
193
194     type = g_type_register_static (G_TYPE_INTERFACE, "AtspiDocument", &tinfo, 0);
195
196   }
197   return type;
198 }