summaryrefslogtreecommitdiff
path: root/idl/text.didl
blob: 07ce85e1f89402804af5322128069f2d43eba9d4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311

namespace org.freestandards.atspi {
	/* 
	   The text interface should be implemented by objects which place textual information onscreen
	   as character strings or glyphs. The text interface allows access to textual content including
	   display attributes and semantic hints associated with runs of text, and to bounding boc information
	   for glyphs and substrings. It also alows portions of text to be selected, if the objects StateSet
	   includes STATE_SELECTABLE_TEXT.
         */
	interface Text {
		/*
		  Specified the boundary conditions determining a run of text
		  as returned from:
		  	GetTextAtOffset
			GetTextAfterOffset
			GetTextBeforeOffset
		 */ 
		enum <uint32> TextBoundaryType {
			TEXT_BOUNDARY_CHAR,
			TEXT_BOUNDARY_WORD_START,
			TEXT_BOUNDARY_WORD_END,
			TEXT_BOUNDARY_SENTENCE_START,
			TEXT_BOUNDARY_SENTENCE_END,
			TEXT_BOUNDARY_LINE_START,
			TEXT_BOUNDARY_LINE_END
		}			

		enum <uint32> TextClipType {
			TEXT_CLIP_NONE,
			TEXT_CLIP_MIN,
			TEXT_CLIP_MAX,
			TEXT_CLIP_BOTH
		}

		/*
		  A structure used to define a contiguous range of text, including
		  its (unattributed) textual content.
		 */
		struct Range {
			int32   start_offset;
			int32   end_offset;
			int32   content;
			variant data;				
		}
		
		/* The total number of character in the text object including whitespace. */
		read property int32 CharacterCount;

		/* The current offset of the text caret in the Text object. */
		read property int32 CaretOffset;

		/* Move the text caret to a given position. */
		method SetCaretOffset {
			int32 offset;		
		} reply {
			boolean success;
		}	
		
		/* 
		  Obtain the subset of text content that entirely precedes the given offset,
		  delimited by character word, line or sentente boundaries.
		 */
		method GetTextBeforeOffset {
			int32 offset;
			TextBoundaryType type;
		} reply {
			string s;
			int32  start_offset;
			int32  end_offset;
		}

		/* 
		  Obtain the subset of text content that includes the given offset,
		  delimited by character word, line or sentente boundaries.
		 */
		method GetTextAtOffset {
			int32 offset;
			TextBoundaryType type;
		} reply {
			string s;
			int32  start_offset;
			int32  end_offset;
		}

		/* 
		  Obtain the subset of text content that entirely follows the given offset,
		  delimited by character word, line or sentente boundaries.
		 */
		method GetTextAfterOffset {
			int32 offset;
			TextBoundaryType type;
		} reply {
			string s;
			int32  start_offset;
			int32  end_offset;
		}

		method GetCharacterAtOffset {
			int32 offset;
		} reply {
			/* UCS-4 representation of the character or 0 if offset out-of-range. */
			int32 c;
		}

		/*
		  Get the value of a named attribute at a given offset.
		 */
		method GetAttributeValue {
			int32   offset;
			string  attribute_key;
		} reply {
			string  attribute_value;
		}	

		/* Deprecated in favor of GetAttributeRun. */
		method GetAttributes {
			int32 offset;
		} reply {
			Attributes attributes;
			int32 start_offset;
			int32 end_offset;
		}

		/* Deprecated in facor of GetDefaultAttributeSet. */
		method GetDefaultAttributes reply {
			Attributes attributes;
		}

		/*
		  Obtain a bounding box of the character glyph at a particular character offset,
		  in the given coordinate system.
		 */
		method GetCharacterExtents {
			int32     offset;
			CoordType coord;
		} reply {
			int32 x;
			int32 y;
			int32 width;
			int32 height;
		}

		/*
		  Get the offset of the character at a given on-screen coordinate. The coordinate
		  system used is determined by the give coordinate type.
		 */
		method GetOffsetAtPoint {
			int32 x;
			int32 y;
			CoordType coord;
		} reply {
			/* -1 if the point is outside the bounds of any glyph. */
			int32 offset;
		}	

		/*
		  Obtain the number of separate, contiguous selections in the current Text object. 
		 */
		method GetNSelections reply {
			int32 n_selections;
		}

		method GetSelection {
			int32 selection_index;
		} reply {
			int32 start_offset;
			int32 end_offset;
		}

		method AddSelection {
			int32 start_offset;
			int32 end_offset;
		} reply {
			boolean success;
		}

		method RemoveSelection {
			int32 selection_index;
		} reply {
			boolean success;
		}

		method SetSelection {
			int32 selection_index;
			int32 start_offset;
			int32 end_offset;
		} reply {
			boolean success;
		}	

		/*
		  Obtain the bounding box which entirely contains the given text range.
		  Negative values may be obtained in the event that part of the text range is
		  off-screen.
		 */
		method GetRangeExtents {
			int32 start_offset;
			int32 end_offset;
			CoordType coord;
		} reply {
			int32 x;
			int32 y;
			int32 width;
			int32 height;
		}

		/*
		  Return the text content within a bounding box.

		  Depending on the clip type glyphs which are clipped by the bounding box
		  may, or may not be inclide in the ranges returned.
		 */
		method GetBoundedRanges {
			int32 x;
			int32 y;
			int32 width;
			int32 height;
			CoordType coord;
			ClipType  x_clip;
			ClipType  y_clip;
		} reply {
			RangeType ranges [];
		}

		/*
		  Gets the attributes of a particular text objects defined at a given offset.
		  The attributes are invariant over the offsets returned.
		 */
		method GetAttributeRun {
			int32   offset;
			boolean include_defaults;
		} reply {
			Attributes attributes;
			int32 start_offset;
			int32 end_offset;
		}
		
		/*
		  Gets the default attributes that apply to the entire text.
		 */
		method GetAttributeSet reply {
			Attributes attributes'
		}
	}

	/*
	  All objects supporting EditableText should also support the
	  Text interface.
	
	  Provides methods for modifying textual content of components which support editing.
	  EditableText also interacts with the system clipboard.
	 */
	interface EditableText {
		/*
		  Replace the text contents with a new string, discarding the old contents.
		 */
		method SetTextContents {
			string new_contents;
		} reply {
			boolean success;
		}

		/*
		  Insert new text contents into a given location.
		 */
		method InsertText {
			int32  position;
			string text;
			int32  length;
		} reply {
			boolean success;
		}

		/*
		  Copy a range of text in to the system clipboard.
		 */
		method CopyText {
			int32 start_pos;
			int32 end_pos;
		}

		/*
		  Excise a range of text, copying it to the system clipboard.
		 */
		method CutText {
			int32 start_pos;
			int32 end_pos;
		} reply {
			boolean success;
		} 

		/* 
		  Excise a range of text from the object without copying to the system clipboard.
		 */
		method DeleteText {
			int32 start_pos;
			int32 end_pos;
		} reply {
			boolean success;
		}

		/*
		  Copy the contents of the system clip-board in to the text object.
		 */
		method PasteText {
			int32 position;
		} reply {
			boolean success;
		}	
	}
}