test: enhance accessible tree information
[platform/upstream/at-spi2-core.git] / idl / text.didl
1
2 namespace org.freestandards.atspi {
3         /* 
4            The text interface should be implemented by objects which place textual information onscreen
5            as character strings or glyphs. The text interface allows access to textual content including
6            display attributes and semantic hints associated with runs of text, and to bounding boc information
7            for glyphs and substrings. It also alows portions of text to be selected, if the objects StateSet
8            includes STATE_SELECTABLE_TEXT.
9          */
10         interface Text {
11                 /*
12                   Specified the boundary conditions determining a run of text
13                   as returned from:
14                         GetTextAtOffset
15                         GetTextAfterOffset
16                         GetTextBeforeOffset
17                  */ 
18                 enum <uint32> TextBoundaryType {
19                         TEXT_BOUNDARY_CHAR,
20                         TEXT_BOUNDARY_WORD_START,
21                         TEXT_BOUNDARY_WORD_END,
22                         TEXT_BOUNDARY_SENTENCE_START,
23                         TEXT_BOUNDARY_SENTENCE_END,
24                         TEXT_BOUNDARY_LINE_START,
25                         TEXT_BOUNDARY_LINE_END
26                 }                       
27
28                 enum <uint32> TextClipType {
29                         TEXT_CLIP_NONE,
30                         TEXT_CLIP_MIN,
31                         TEXT_CLIP_MAX,
32                         TEXT_CLIP_BOTH
33                 }
34
35                 /*
36                   A structure used to define a contiguous range of text, including
37                   its (unattributed) textual content.
38                  */
39                 struct Range {
40                         int32   start_offset;
41                         int32   end_offset;
42                         int32   content;
43                         variant data;                           
44                 }
45                 
46                 /* The total number of character in the text object including whitespace. */
47                 read property int32 CharacterCount;
48
49                 /* The current offset of the text caret in the Text object. */
50                 read property int32 CaretOffset;
51
52                 /* Move the text caret to a given position. */
53                 method SetCaretOffset {
54                         int32 offset;           
55                 } reply {
56                         boolean success;
57                 }       
58                 
59                 /* 
60                   Obtain the subset of text content that entirely precedes the given offset,
61                   delimited by character word, line or sentente boundaries.
62                  */
63                 method GetTextBeforeOffset {
64                         int32 offset;
65                         TextBoundaryType type;
66                 } reply {
67                         string s;
68                         int32  start_offset;
69                         int32  end_offset;
70                 }
71
72                 /* 
73                   Obtain the subset of text content that includes the given offset,
74                   delimited by character word, line or sentente boundaries.
75                  */
76                 method GetTextAtOffset {
77                         int32 offset;
78                         TextBoundaryType type;
79                 } reply {
80                         string s;
81                         int32  start_offset;
82                         int32  end_offset;
83                 }
84
85                 /* 
86                   Obtain the subset of text content that entirely follows the given offset,
87                   delimited by character word, line or sentente boundaries.
88                  */
89                 method GetTextAfterOffset {
90                         int32 offset;
91                         TextBoundaryType type;
92                 } reply {
93                         string s;
94                         int32  start_offset;
95                         int32  end_offset;
96                 }
97
98                 method GetCharacterAtOffset {
99                         int32 offset;
100                 } reply {
101                         /* UCS-4 representation of the character or 0 if offset out-of-range. */
102                         int32 c;
103                 }
104
105                 /*
106                   Get the value of a named attribute at a given offset.
107                  */
108                 method GetAttributeValue {
109                         int32   offset;
110                         string  attribute_key;
111                 } reply {
112                         string  attribute_value;
113                         int32   start_offset;
114                         int32   end_offset;
115                         boolean defined;
116                 }       
117
118                 /* Deprecated in favor of GetAttributeRun. */
119                 method GetAttributes {
120                         int32 offset;
121                 } reply {
122                         Attributes attributes;
123                         int32 start_offset;
124                         int32 end_offset;
125                 }
126
127                 /* Deprecated in facor of GetDefaultAttributeSet. */
128                 method GetDefaultAttributes reply {
129                         Attributes attributes;
130                 }
131
132                 /*
133                   Obtain a bounding box of the character glyph at a particular character offset,
134                   in the given coordinate system.
135                  */
136                 method GetCharacterExtents {
137                         int32     offset;
138                         CoordType coord;
139                 } reply {
140                         int32 x;
141                         int32 y;
142                         int32 width;
143                         int32 height;
144                 }
145
146                 /*
147                   Get the offset of the character at a given on-screen coordinate. The coordinate
148                   system used is determined by the give coordinate type.
149                  */
150                 method GetOffsetAtPoint {
151                         int32 x;
152                         int32 y;
153                         CoordType coord;
154                 } reply {
155                         /* -1 if the point is outside the bounds of any glyph. */
156                         int32 offset;
157                 }       
158
159                 /*
160                   Obtain the number of separate, contiguous selections in the current Text object. 
161                  */
162                 method GetNSelections reply {
163                         int32 n_selections;
164                 }
165
166                 method GetSelection {
167                         int32 selection_index;
168                 } reply {
169                         int32 start_offset;
170                         int32 end_offset;
171                 }
172
173                 method AddSelection {
174                         int32 start_offset;
175                         int32 end_offset;
176                 } reply {
177                         boolean success;
178                 }
179
180                 method RemoveSelection {
181                         int32 selection_index;
182                 } reply {
183                         boolean success;
184                 }
185
186                 method SetSelection {
187                         int32 selection_index;
188                         int32 start_offset;
189                         int32 end_offset;
190                 } reply {
191                         boolean success;
192                 }       
193
194                 /*
195                   Obtain the bounding box which entirely contains the given text range.
196                   Negative values may be obtained in the event that part of the text range is
197                   off-screen.
198                  */
199                 method GetRangeExtents {
200                         int32 start_offset;
201                         int32 end_offset;
202                         CoordType coord;
203                 } reply {
204                         int32 x;
205                         int32 y;
206                         int32 width;
207                         int32 height;
208                 }
209
210                 /*
211                   Return the text content within a bounding box.
212
213                   Depending on the clip type glyphs which are clipped by the bounding box
214                   may, or may not be inclide in the ranges returned.
215                  */
216                 method GetBoundedRanges {
217                         int32 x;
218                         int32 y;
219                         int32 width;
220                         int32 height;
221                         CoordType coord;
222                         ClipType  x_clip;
223                         ClipType  y_clip;
224                 } reply {
225                         RangeType ranges [];
226                 }
227
228                 /*
229                   Gets the attributes of a particular text objects defined at a given offset.
230                   The attributes are invariant over the offsets returned.
231                  */
232                 method GetAttributeRun {
233                         int32   offset;
234                         boolean include_defaults;
235                 } reply {
236                         Attributes attributes;
237                         int32 start_offset;
238                         int32 end_offset;
239                 }
240                 
241                 /*
242                   Gets the default attributes that apply to the entire text.
243                  */
244                 method GetAttributeSet reply {
245                         Attributes attributes'
246                 }
247         }
248
249         /*
250           All objects supporting EditableText should also support the
251           Text interface.
252         
253           Provides methods for modifying textual content of components which support editing.
254           EditableText also interacts with the system clipboard.
255          */
256         interface EditableText {
257                 /*
258                   Replace the text contents with a new string, discarding the old contents.
259                  */
260                 method SetTextContents {
261                         string new_contents;
262                 } reply {
263                         boolean success;
264                 }
265
266                 /*
267                   Insert new text contents into a given location.
268                  */
269                 method InsertText {
270                         int32  position;
271                         string text;
272                         int32  length;
273                 } reply {
274                         boolean success;
275                 }
276
277                 /*
278                   Copy a range of text in to the system clipboard.
279                  */
280                 method CopyText {
281                         int32 start_pos;
282                         int32 end_pos;
283                 }
284
285                 /*
286                   Excise a range of text, copying it to the system clipboard.
287                  */
288                 method CutText {
289                         int32 start_pos;
290                         int32 end_pos;
291                 } reply {
292                         boolean success;
293                 } 
294
295                 /* 
296                   Excise a range of text from the object without copying to the system clipboard.
297                  */
298                 method DeleteText {
299                         int32 start_pos;
300                         int32 end_pos;
301                 } reply {
302                         boolean success;
303                 }
304
305                 /*
306                   Copy the contents of the system clip-board in to the text object.
307                  */
308                 method PasteText {
309                         int32 position;
310                 } reply {
311                         boolean success;
312                 }       
313         }
314 }