| 1 | /* ATK - Accessibility Toolkit |
| 2 | * Copyright 2001 Sun Microsystems Inc. |
| 3 | * |
| 4 | * This library is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU Library 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. |
| 8 | * |
| 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 | * Library General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU Library 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. |
| 18 | */ |
| 19 | |
| 20 | #ifndef __ATK_DOCUMENT_H__ |
| 21 | #define __ATK_DOCUMENT_H__ |
| 22 | |
| 23 | #if defined(ATK_DISABLE_SINGLE_INCLUDES) && !defined(__ATK_H_INSIDE__) && !defined(ATK_COMPILATION) |
| 24 | #error "Only <atk/atk.h> can be included directly." |
| 25 | #endif |
| 26 | |
| 27 | #include <atk/atkobject.h> |
| 28 | #include <atk/atkutil.h> |
| 29 | |
| 30 | G_BEGIN_DECLS |
| 31 | |
| 32 | /* |
| 33 | * The AtkDocument interface should be supported by any object that is a container |
| 34 | * for 'document content' as opposed to a collection of user interface elements. |
| 35 | * |
| 36 | */ |
| 37 | |
| 38 | #define ATK_TYPE_DOCUMENT (atk_document_get_type ()) |
| 39 | #define ATK_IS_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_TYPE ((obj), ATK_TYPE_DOCUMENT) |
| 40 | #define ATK_DOCUMENT(obj) G_TYPE_CHECK_INSTANCE_CAST ((obj), ATK_TYPE_DOCUMENT, AtkDocument) |
| 41 | #define ATK_DOCUMENT_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), ATK_TYPE_DOCUMENT, AtkDocumentIface)) |
| 42 | |
| 43 | /** |
| 44 | * AtkTextSelection: |
| 45 | * @start_object: the AtkText containing the start of the selection. |
| 46 | * @start_offset: the text offset of the beginning of the selection within |
| 47 | * @start_object. |
| 48 | * @end_object: the AtkText containing the end of the selection. |
| 49 | * @end_offset: the text offset of the end of the selection within @end_object. |
| 50 | * @start_is_active: a gboolean indicating whether the start of the selection |
| 51 | * is the active point. |
| 52 | * |
| 53 | * This structure represents a single text selection within a document. This |
| 54 | * selection is defined by two points in the content, where each one is defined |
| 55 | * by an AtkObject supporting the AtkText interface and a character offset |
| 56 | * relative to it. |
| 57 | * |
| 58 | * The end object must appear after the start object in the accessibility tree, |
| 59 | * i.e. the end object must be reachable from the start object by navigating |
| 60 | * forward (next, first child etc). |
| 61 | * |
| 62 | * This struct also contains a @start_is_active boolean, to communicate if the |
| 63 | * start of the selection is the active point or not. |
| 64 | * |
| 65 | * The active point corresponds to the user's focus or point of interest. The |
| 66 | * user moves the active point to expand or collapse the range. The anchor |
| 67 | * point is the other point of the range and typically remains constant. In |
| 68 | * most cases, anchor is the start of the range and active is the end. However, |
| 69 | * when selecting backwards (e.g. pressing shift+left arrow in a text field), |
| 70 | * the start of the range is the active point, as the user moves this to |
| 71 | * manipulate the selection. |
| 72 | * |
| 73 | * Since: 2.52 |
| 74 | */ |
| 75 | typedef struct _AtkTextSelection AtkTextSelection; |
| 76 | struct _AtkTextSelection |
| 77 | { |
| 78 | AtkObject *start_object; |
| 79 | gint start_offset; |
| 80 | AtkObject *end_object; |
| 81 | gint end_offset; |
| 82 | gboolean start_is_active; |
| 83 | }; |
| 84 | |
| 85 | #ifndef _TYPEDEF_ATK_DOCUMENT_ |
| 86 | #define _TYPEDEF_ATK_DOCUMENT_ |
| 87 | typedef struct _AtkDocument AtkDocument; |
| 88 | #endif |
| 89 | typedef struct _AtkDocumentIface AtkDocumentIface; |
| 90 | |
| 91 | /** |
| 92 | * AtkDocumentIface: |
| 93 | * @get_document_type: gets a string indicating the document |
| 94 | * type. This virtual function is deprecated since 2.12 and it |
| 95 | * should not be overriden. |
| 96 | * @get_document: a #GObject instance that implements |
| 97 | * AtkDocumentIface. This virtual method is deprecated since 2.12 |
| 98 | * and it should not be overriden. |
| 99 | * @get_document_locale: gets locale. This virtual function is |
| 100 | * deprecated since 2.7.90 and it should not be overriden. |
| 101 | * @get_document_attributes: gets an AtkAttributeSet which describes |
| 102 | * document-wide attributes as name-value pairs. |
| 103 | * @get_document_attribute_value: returns a string value assocciated |
| 104 | * with the named attribute for this document, or NULL |
| 105 | * @set_document_attribute: sets the value of an attribute. Returns |
| 106 | * TRUE on success, FALSE otherwise |
| 107 | * @get_current_page_number: gets the current page number. Since 2.12 |
| 108 | * @get_page_count: gets the page count of the document. Since 2.12 |
| 109 | */ |
| 110 | struct _AtkDocumentIface |
| 111 | { |
| 112 | GTypeInterface parent; |
| 113 | const gchar *(*get_document_type) (AtkDocument *document); |
| 114 | gpointer (*get_document) (AtkDocument *document); |
| 115 | |
| 116 | const gchar *(*get_document_locale) (AtkDocument *document); |
| 117 | AtkAttributeSet *(*get_document_attributes) (AtkDocument *document); |
| 118 | const gchar *(*get_document_attribute_value) (AtkDocument *document, |
| 119 | const gchar *attribute_name); |
| 120 | gboolean (*set_document_attribute) (AtkDocument *document, |
| 121 | const gchar *attribute_name, |
| 122 | const gchar *attribute_value); |
| 123 | gint (*get_current_page_number) (AtkDocument *document); |
| 124 | gint (*get_page_count) (AtkDocument *document); |
| 125 | GArray *(*get_text_selections) (AtkDocument *document); |
| 126 | gboolean (*set_text_selections) (AtkDocument *document, GArray *selections); |
| 127 | }; |
| 128 | |
| 129 | ATK_AVAILABLE_IN_ALL |
| 130 | GType atk_document_get_type (void); |
| 131 | |
| 132 | ATK_DEPRECATED_IN_2_12 |
| 133 | const gchar *atk_document_get_document_type (AtkDocument *document); |
| 134 | |
| 135 | ATK_DEPRECATED_IN_2_12 |
| 136 | gpointer atk_document_get_document (AtkDocument *document); |
| 137 | |
| 138 | ATK_DEPRECATED_IN_2_8_FOR (atk_object_get_object_locale) |
| 139 | const gchar *atk_document_get_locale (AtkDocument *document); |
| 140 | |
| 141 | ATK_AVAILABLE_IN_ALL |
| 142 | AtkAttributeSet *atk_document_get_attributes (AtkDocument *document); |
| 143 | ATK_AVAILABLE_IN_ALL |
| 144 | const gchar *atk_document_get_attribute_value (AtkDocument *document, |
| 145 | const gchar *attribute_name); |
| 146 | ATK_AVAILABLE_IN_ALL |
| 147 | gboolean atk_document_set_attribute_value (AtkDocument *document, |
| 148 | const gchar *attribute_name, |
| 149 | const gchar *attribute_value); |
| 150 | ATK_AVAILABLE_IN_2_12 |
| 151 | gint atk_document_get_current_page_number (AtkDocument *document); |
| 152 | ATK_AVAILABLE_IN_2_12 |
| 153 | gint atk_document_get_page_count (AtkDocument *document); |
| 154 | |
| 155 | G_END_DECLS |
| 156 | |
| 157 | ATK_AVAILABLE_IN_2_52 |
| 158 | GArray *atk_document_get_text_selections (AtkDocument *document); |
| 159 | |
| 160 | ATK_AVAILABLE_IN_2_52 |
| 161 | gboolean atk_document_set_text_selections (AtkDocument *document, GArray *selections); |
| 162 | #endif /* __ATK_DOCUMENT_H__ */ |
| 163 | |