1 /* ATK - Accessibility Toolkit
2 * Copyright 2001 Sun Microsystems Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "atkdocument.h"
23 atk_document_get_type (void)
25 static GType type = 0;
28 static const GTypeInfo tinfo =
30 sizeof (AtkDocumentIface),
32 (GBaseFinalizeFunc) NULL,
36 type = g_type_register_static (G_TYPE_INTERFACE, "AtkDocument", &tinfo, 0);
43 * atk_document_get_document_type:
44 * @document: a #GObject instance that implements AtkDocumentIface
46 * Gets a string indicating the document type.
48 * Returns: a string indicating the document type
51 atk_document_get_document_type (AtkDocument *document)
53 AtkDocumentIface *iface;
55 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
57 iface = ATK_DOCUMENT_GET_IFACE (document);
59 if (iface->get_document_type)
61 return (iface->get_document_type) (document);
70 * atk_document_get_document:
71 * @document: a #GObject instance that implements AtkDocumentIface
73 * Gets a %gpointer that points to an instance of the DOM. It is
74 * up to the caller to check atk_document_get_type to determine
75 * how to cast this pointer.
77 * Returns: a %gpointer that points to an instance of the DOM.
80 atk_document_get_document (AtkDocument *document)
82 AtkDocumentIface *iface;
84 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
86 iface = ATK_DOCUMENT_GET_IFACE (document);
88 if (iface->get_document)
90 return (iface->get_document) (document);
99 * atk_document_get_locale:
100 * @document: a #GObject instance that implements AtkDocumentIface
102 * Gets a UTF-8 string indicating the POSIX-style LC_MESSAGES locale
103 * of the content of this document instance. Individual
104 * text substrings or images within this document may have
105 * a different locale, see atk_text_get_attributes and
106 * atk_image_get_image_locale.
108 * Returns: a UTF-8 string indicating the POSIX-style LC_MESSAGES
109 * locale of the document content as a whole, or NULL if
110 * the document content does not specify a locale.
112 G_CONST_RETURN gchar *
113 atk_document_get_locale (AtkDocument *document)
115 AtkDocumentIface *iface;
117 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
119 iface = ATK_DOCUMENT_GET_IFACE (document);
121 if (iface->get_document_locale)
123 return (iface->get_document_locale) (document);
133 * atk_document_get_attributes:
134 * @document: a #GObject instance that implements AtkDocumentIface
136 * Gets an AtkAttributeSet which describes document-wide
137 * attributes as name-value pairs.
139 * Returns: An AtkAttributeSet containing the explicitly
140 * set name-value-pair attributes associated with this document
145 atk_document_get_attributes (AtkDocument *document)
147 AtkDocumentIface *iface;
149 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
151 iface = ATK_DOCUMENT_GET_IFACE (document);
153 if (iface->get_document_attributes)
155 return (iface->get_document_attributes) (document);
164 * atk_document_get_attribute_value:
165 * @document: a #GObject instance that implements AtkDocumentIface
166 * @attribute_name: a character string representing the name of the attribute
167 * whose value is being queried.
169 * Returns: a string value associated with the named attribute for this
170 * document, or NULL if a value for #attribute_name has not been specified
174 G_CONST_RETURN gchar *
175 atk_document_get_attribute_value (AtkDocument *document,
176 const gchar *attribute_name)
178 AtkDocumentIface *iface;
180 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
182 iface = ATK_DOCUMENT_GET_IFACE (document);
184 if (iface->get_document_attribute_value)
186 return (iface->get_document_attribute_value) (document, attribute_name);
195 * atk_document_set_attribute_value:
196 * @document: a #GObject instance that implements AtkDocumentIface
197 * @attribute_name: a character string representing the name of the attribute
198 * whose value is being set.
199 * @value: a string value to be associated with #attribute_name.
201 * Returns: TRUE if #value is successfully associated with #attribute_name
202 * for this document, FALSE otherwise (e.g. if the document does not
203 * allow the attribute to be modified).
207 atk_document_set_attribute_value (AtkDocument *document,
208 const gchar *attribute_name,
211 AtkDocumentIface *iface;
213 g_return_val_if_fail (ATK_IS_DOCUMENT (document), FALSE);
215 iface = ATK_DOCUMENT_GET_IFACE (document);
217 if (iface->set_document_attribute)
219 return (iface->set_document_attribute) (document, attribute_name, value);