Remove dependency on libxkbcommon
[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                 }       
114
115                 /* Deprecated in favor of GetAttributeRun. */
116                 method GetAttributes {
117                         int32 offset;
118                 } reply {
119                         Attributes attributes;
120                         int32 start_offset;
121                         int32 end_offset;
122                 }
123
124                 /* Deprecated in facor of GetDefaultAttributeSet. */
125                 method GetDefaultAttributes reply {
126                         Attributes attributes;
127                 }
128
129                 /*
130                   Obtain a bounding box of the character glyph at a particular character offset,
131                   in the given coordinate system.
132                  */
133                 method GetCharacterExtents {
134                         int32     offset;
135                         CoordType coord;
136                 } reply {
137                         int32 x;
138                         int32 y;
139                         int32 width;
140                         int32 height;
141                 }
142
143                 /*
144                   Get the offset of the character at a given on-screen coordinate. The coordinate
145                   system used is determined by the give coordinate type.
146                  */
147                 method GetOffsetAtPoint {
148                         int32 x;
149                         int32 y;
150                         CoordType coord;
151                 } reply {
152                         /* -1 if the point is outside the bounds of any glyph. */
153                         int32 offset;
154                 }       
155
156                 /*
157                   Obtain the number of separate, contiguous selections in the current Text object. 
158                  */
159                 method GetNSelections reply {
160                         int32 n_selections;
161                 }
162
163                 method GetSelection {
164                         int32 selection_index;
165                 } reply {
166                         int32 start_offset;
167                         int32 end_offset;
168                 }
169
170                 method AddSelection {
171                         int32 start_offset;
172                         int32 end_offset;
173                 } reply {
174                         boolean success;
175                 }
176
177                 method RemoveSelection {
178                         int32 selection_index;
179                 } reply {
180                         boolean success;
181                 }
182
183                 method SetSelection {
184                         int32 selection_index;
185                         int32 start_offset;
186                         int32 end_offset;
187                 } reply {
188                         boolean success;
189                 }       
190
191                 /*
192                   Obtain the bounding box which entirely contains the given text range.
193                   Negative values may be obtained in the event that part of the text range is
194                   off-screen.
195                  */
196                 method GetRangeExtents {
197                         int32 start_offset;
198                         int32 end_offset;
199                         CoordType coord;
200                 } reply {
201                         int32 x;
202                         int32 y;
203                         int32 width;
204                         int32 height;
205                 }
206
207                 /*
208                   Return the text content within a bounding box.
209
210                   Depending on the clip type glyphs which are clipped by the bounding box
211                   may, or may not be inclide in the ranges returned.
212                  */
213                 method GetBoundedRanges {
214                         int32 x;
215                         int32 y;
216                         int32 width;
217                         int32 height;
218                         CoordType coord;
219                         ClipType  x_clip;
220                         ClipType  y_clip;
221                 } reply {
222                         RangeType ranges [];
223                 }
224
225                 /*
226                   Gets the attributes of a particular text objects defined at a given offset.
227                   The attributes are invariant over the offsets returned.
228                  */
229                 method GetAttributeRun {
230                         int32   offset;
231                         boolean include_defaults;
232                 } reply {
233                         Attributes attributes;
234                         int32 start_offset;
235                         int32 end_offset;
236                 }
237                 
238                 /*
239                   Gets the default attributes that apply to the entire text.
240                  */
241                 method GetAttributeSet reply {
242                         Attributes attributes'
243                 }
244         }
245
246         /*
247           All objects supporting EditableText should also support the
248           Text interface.
249         
250           Provides methods for modifying textual content of components which support editing.
251           EditableText also interacts with the system clipboard.
252          */
253         interface EditableText {
254                 /*
255                   Replace the text contents with a new string, discarding the old contents.
256                  */
257                 method SetTextContents {
258                         string new_contents;
259                 } reply {
260                         boolean success;
261                 }
262
263                 /*
264                   Insert new text contents into a given location.
265                  */
266                 method InsertText {
267                         int32  position;
268                         string text;
269                         int32  length;
270                 } reply {
271                         boolean success;
272                 }
273
274                 /*
275                   Copy a range of text in to the system clipboard.
276                  */
277                 method CopyText {
278                         int32 start_pos;
279                         int32 end_pos;
280                 }
281
282                 /*
283                   Excise a range of text, copying it to the system clipboard.
284                  */
285                 method CutText {
286                         int32 start_pos;
287                         int32 end_pos;
288                 } reply {
289                         boolean success;
290                 } 
291
292                 /* 
293                   Excise a range of text from the object without copying to the system clipboard.
294                  */
295                 method DeleteText {
296                         int32 start_pos;
297                         int32 end_pos;
298                 } reply {
299                         boolean success;
300                 }
301
302                 /*
303                   Copy the contents of the system clip-board in to the text object.
304                  */
305                 method PasteText {
306                         int32 position;
307                 } reply {
308                         boolean success;
309                 }       
310         }
311 }