Revert "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:
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  * Rename to: atspi_document_get_document_attribute_value
59  **/
60 gchar *
61 atspi_document_get_attribute_value (AtspiDocument *obj,
62                                       gchar *attribute,
63                                       GError **error)
64 {
65   return atspi_document_get_document_attribute_value (obj, attribute, error);
66 }
67                                       
68 /**
69  * atspi_document_get_document_attribute_value:
70  * @obj: a pointer to the #AtspiDocument object on which to operate.
71  * @attribute: a string indicating the name of a specific attribute.
72  *
73  * Gets the value of a single attribute, if specified for the document as a whole.
74  *
75  * Returns: a string corresponding to the value of the specified attribute, or
76  * an empty string if the attribute is unspecified for the object.
77  **/
78 gchar *
79 atspi_document_get_document_attribute_value (AtspiDocument *obj,
80                                              gchar *attribute,
81                                              GError **error)
82 {
83   gchar *retval = NULL;
84
85   g_return_val_if_fail (obj != NULL, NULL);
86
87   _atspi_dbus_call (obj, atspi_interface_document, "GetAttributeValue", error, "s=>s", attribute, &retval);
88
89   if (!retval)
90     retval = g_strdup ("");
91
92   return retval;
93 }
94                                       
95
96 /**
97  * atspi_document_get_attributes:
98  * @obj: a pointer to the #AtspiDocument object on which to operate.
99  * 
100  * Gets all constant attributes for the document as a whole. For attributes
101  * that change within the document content, see @atspi_text_get_attribute_run instead.
102  * 
103  * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
104  *          containing the constant attributes of the document, as name-value pairs.
105  *
106  * Deprecated: 2.10: Use atspi_document_get_document_attributes instead.
107  * Rename to: atspi_document_get_document_attributes
108  **/
109 GHashTable *
110 atspi_document_get_attributes (AtspiDocument *obj, GError **error)
111 {
112   return atspi_document_get_document_attributes (obj, error);
113 }
114
115 /**
116  * atspi_document_get_document_attributes:
117  * @obj: a pointer to the #AtspiDocument object on which to operate.
118  * 
119  * Gets all constant attributes for the document as a whole. For attributes
120  * that change within the document content, see @atspi_text_get_attribute_run instead.
121  * 
122  * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
123  *          containing the constant attributes of the document, as name-value pairs.
124  **/
125 GHashTable *
126 atspi_document_get_document_attributes (AtspiDocument *obj, GError **error)
127 {
128   DBusMessage *message;
129
130     g_return_val_if_fail (obj != NULL, NULL);
131
132   message = _atspi_dbus_call_partial (obj, atspi_interface_document, "GetAttributes", error, "");
133   return _atspi_dbus_return_hash_from_message (message);
134 }
135
136 /**
137  * atspi_document_get_page_count:
138  * @obj: a pointer to the #AtspiDocument object to query.
139  *
140  * Gets the page count of an #AccessibleDocument object.
141  *
142  * Returns: a #gint indicating the page count of an
143  * #AccessibleDocument object.
144  **/
145 gint
146 atspi_document_get_page_count (AtspiDocument *obj, GError **error)
147 {
148   dbus_int32_t retval = 0;
149
150   g_return_val_if_fail (obj != NULL, -1);
151
152   _atspi_dbus_get_property (obj, atspi_interface_document, "PageCount", error, "i", &retval);
153
154   return retval;
155 }
156
157 /**
158  * atspi_document_get_current_page_number:
159  * @obj: a pointer to the #AtspiDocument object to query.
160  *
161  * Gets the current page number of an #AccessibleDocument object.
162  *
163  * Returns: a #gint indicating the current page number in the
164  * #AccessibleDocument object.
165  **/
166 gint
167 atspi_document_get_current_page_number (AtspiDocument *obj, GError **error)
168 {
169   dbus_int32_t retval = 0;
170
171   g_return_val_if_fail (obj != NULL, -1);
172
173   _atspi_dbus_get_property (obj, atspi_interface_document, "CurrentPageNumber", error, "i", &retval);
174
175   return retval;
176 }
177
178 static void
179 atspi_document_base_init (AtspiDocument *klass)
180 {
181 }
182
183 GType
184 atspi_document_get_type (void)
185 {
186   static GType type = 0;
187
188   if (!type) {
189     static const GTypeInfo tinfo =
190     {
191       sizeof (AtspiDocument),
192       (GBaseInitFunc) atspi_document_base_init,
193       (GBaseFinalizeFunc) NULL,
194     };
195
196     type = g_type_register_static (G_TYPE_INTERFACE, "AtspiDocument", &tinfo, 0);
197
198   }
199   return type;
200 }