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.
141 * Returns: An AtkAttributeSet containing the explicitly
142 * set name-value-pair attributes associated with this document
146 atk_document_get_attributes (AtkDocument *document)
148 AtkDocumentIface *iface;
150 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
152 iface = ATK_DOCUMENT_GET_IFACE (document);
154 if (iface->get_document_attributes)
156 return (iface->get_document_attributes) (document);
165 * atk_document_get_attribute_value:
166 * @document: a #GObject instance that implements AtkDocumentIface
167 * @attribute_name: a character string representing the name of the attribute
168 * whose value is being queried.
172 * Returns: a string value associated with the named attribute for this
173 * document, or NULL if a value for #attribute_name has not been specified
176 G_CONST_RETURN gchar *
177 atk_document_get_attribute_value (AtkDocument *document,
178 const gchar *attribute_name)
180 AtkDocumentIface *iface;
182 g_return_val_if_fail (ATK_IS_DOCUMENT (document), NULL);
184 iface = ATK_DOCUMENT_GET_IFACE (document);
186 if (iface->get_document_attribute_value)
188 return (iface->get_document_attribute_value) (document, attribute_name);
197 * atk_document_set_attribute_value:
198 * @document: a #GObject instance that implements AtkDocumentIface
199 * @attribute_name: a character string representing the name of the attribute
200 * whose value is being set.
201 * @attribute_value: a string value to be associated with #attribute_name.
205 * Returns: TRUE if #value is successfully associated with #attribute_name
206 * for this document, FALSE otherwise (e.g. if the document does not
207 * allow the attribute to be modified).
210 atk_document_set_attribute_value (AtkDocument *document,
211 const gchar *attribute_name,
212 const gchar *attribute_value)
214 AtkDocumentIface *iface;
216 g_return_val_if_fail (ATK_IS_DOCUMENT (document), FALSE);
218 iface = ATK_DOCUMENT_GET_IFACE (document);
220 if (iface->set_document_attribute)
222 return (iface->set_document_attribute) (document, attribute_name, attribute_value);