2 * AT-SPI - Assistive Technology Service Provider Interface
3 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
5 * Copyright 2001, 2002 Sun Microsystems Inc.,
6 * Copyright 2001, 2002 Ximian, Inc.
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #include <cspi/spi-private.h>
26 static Accessibility_TEXT_BOUNDARY_TYPE
27 get_accessible_text_boundary_type (AccessibleTextBoundaryType type)
31 case SPI_TEXT_BOUNDARY_CHAR:
32 return Accessibility_TEXT_BOUNDARY_CHAR;
34 case SPI_TEXT_BOUNDARY_CURSOR_POS:
36 return Accessibility_TEXT_BOUNDARY_CHAR;
38 case SPI_TEXT_BOUNDARY_WORD_START:
39 return Accessibility_TEXT_BOUNDARY_WORD_START;
41 case SPI_TEXT_BOUNDARY_WORD_END:
42 return Accessibility_TEXT_BOUNDARY_WORD_END;
44 case SPI_TEXT_BOUNDARY_SENTENCE_START:
45 return Accessibility_TEXT_BOUNDARY_SENTENCE_START;
47 case SPI_TEXT_BOUNDARY_SENTENCE_END:
48 return Accessibility_TEXT_BOUNDARY_SENTENCE_END;
50 case SPI_TEXT_BOUNDARY_LINE_START:
51 return Accessibility_TEXT_BOUNDARY_LINE_START;
53 case SPI_TEXT_BOUNDARY_LINE_END:
54 return Accessibility_TEXT_BOUNDARY_LINE_END;
56 case SPI_TEXT_BOUNDARY_ATTRIBUTE_RANGE:
58 return Accessibility_TEXT_BOUNDARY_CHAR;
62 return Accessibility_TEXT_BOUNDARY_CHAR;
66 static Accessibility_TEXT_CLIP_TYPE
67 get_accessible_text_clip_type (AccessibleTextClipType type)
71 case SPI_TEXT_CLIP_NONE:
72 return Accessibility_TEXT_CLIP_NONE;
74 case SPI_TEXT_CLIP_MIN:
75 return Accessibility_TEXT_CLIP_MIN;
77 case SPI_TEXT_CLIP_MAX:
78 return Accessibility_TEXT_CLIP_MAX;
81 return Accessibility_TEXT_CLIP_BOTH;
87 dbus_int32_t startOffset;
88 dbus_int32_t endOffset;
90 } Accessibility_Range;
92 static AccessibleTextRange **
93 get_accessible_text_ranges_from_range_seq (GArray *range_seq)
95 AccessibleTextRange **ranges = NULL;
96 AccessibleTextRange *array = NULL;
98 if (range_seq && range_seq->len > 0)
100 ranges = g_new0 (AccessibleTextRange *, range_seq->len + 1);
102 array = g_new0 (AccessibleTextRange, range_seq->len);
103 for (i = 0; i < range_seq->len; i++)
105 Accessibility_Range *r = g_array_index (range_seq, Accessibility_Range *, i);
106 AccessibleTextRange *range;
108 range->start = r->startOffset;
109 range->end = r->endOffset;
110 range->contents = g_strdup (r->content);
113 ranges[i] = NULL; /* null-terminated list! */
114 // TODO: Figure out whether we're leaking strings
115 g_array_free (range_seq, TRUE);
122 * AccessibleText_ref:
123 * @obj: a pointer to the #AccessibleText object on which to operate.
125 * Increment the reference count for an #AccessibleText object.
128 AccessibleText_ref (AccessibleText *obj)
130 cspi_object_ref (obj);
134 * AccessibleText_unref:
135 * @obj: a pointer to the #Accessible object on which to operate.
137 * Decrement the reference count for an #AccessibleText object.
140 AccessibleText_unref (AccessibleText *obj)
142 cspi_object_unref (obj);
146 * AccessibleText_getCharacterCount:
147 * @obj: a pointer to the #AccessibleText object to query.
149 * Get the character count of an #AccessibleText object.
151 * Returns: a long integer indicating the total number of
152 * characters in the #AccessibleText object.
155 AccessibleText_getCharacterCount (AccessibleText *obj)
159 cspi_return_val_if_fail (obj != NULL, -1);
161 cspi_dbus_get_property (obj, spi_interface_text, "characterCount", NULL, "i", &retval);
163 cspi_return_val_if_ev ("getCharacterCount", -1);
169 * AccessibleText_getText:
170 * @obj: a pointer to the #AccessibleText object to query.
171 * @startOffset: a #long indicating the start of the desired text range.
172 * @endOffset: a #long indicating the first character past the desired range.
174 * Get a range of text from an #AccessibleText object. The number of bytes
175 * in the returned string may exceed endOffset-startOffset, since
176 * UTF-8 is a variable-width encoding.
178 * Returns: a text string containing characters from @startOffset
179 * to @endOffset-1, inclusive, encoded as UTF-8.
182 AccessibleText_getText (AccessibleText *obj,
183 long int startOffset,
187 dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
189 cspi_return_val_if_fail (obj != NULL, NULL);
191 cspi_dbus_call (obj, spi_interface_text, "getText", NULL, "ii=>s", startOffset, endOffset, &retval);
193 cspi_return_val_if_ev ("getText", NULL);
199 * AccessibleText_getCaretOffset:
200 * @obj: a pointer to the #AccessibleText object to query.
202 * Get the current offset of the text caret in an #AccessibleText object.
204 * Returns: a long integer indicating the current position of the text caret.
207 AccessibleText_getCaretOffset (AccessibleText *obj)
211 cspi_return_val_if_fail (obj != NULL, -1);
213 cspi_dbus_get_property (obj, spi_interface_text, "caretOffset", NULL, "i", &retval);
215 cspi_return_val_if_ev ("getCaretOffset", -1);
221 * AccessibleText_getAttributes:
222 * @obj: a pointer to the #AccessibleText object to query.
223 * @offset: a long integer indicating the offset from which the attribute
225 * @startOffset: a #long indicating the start of the desired text range.
226 * @endOffset: a #long indicating the first character past the desired range.
228 * Get the attributes applied to a range of text from an #AccessibleText
229 * object, and the bounds of the range.
230 * The text attributes correspond to CSS attributes where possible,
231 * keys and values are delimited from one another via ":", and
232 * the delimiter between key/value pairs is ";". Thus
233 * "font-size:10;foreground-color:0,0,0" would be a valid
236 * Returns: a text string describing the attributes occurring within the
237 * attribute run containing @offset, encoded as UTF-8.
240 AccessibleText_getAttributes (AccessibleText *obj,
242 long int *startOffset,
245 dbus_int32_t d_offset = offset;
246 dbus_int32_t retStartOffset, retEndOffset;
251 *startOffset = *endOffset = -1;
255 cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "i=>sii", d_offset, &retval, &retStartOffset, &retEndOffset);
257 if (!cspi_check_ev ("getAttributes"))
259 *startOffset = *endOffset = -1;
264 *startOffset = retStartOffset;
265 *endOffset = retEndOffset;
272 * AccessibleText_getDefaultAttributes:
273 * @obj: a pointer to the #AccessibleText object to query.
275 * Get the default attributes applied to an #AccessibleText
277 * The text attributes correspond to CSS attributes where possible,
278 * keys and values are delimited from one another via ":", and
279 * the delimiter between key/value pairs is ";". Thus
280 * "font-size:10;foreground-color:0,0,0" would be a valid
281 * return string. The combination of this attribute set and
282 * the attributes reported by #AccessibleText_getAttributes
283 * describes the entire set of text attributes over a range.
287 * Returns: a text string describing the default attributes
288 * applied to a text object, (exclusive of explicitly-set
289 * attributes), encoded as UTF-8.
292 AccessibleText_getDefaultAttributes (AccessibleText *obj)
301 cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "=>s", &retval);
303 if (!cspi_check_ev ("getAttributes"))
312 * AccessibleText_setCaretOffset:
313 * @obj: a pointer to the #AccessibleText object on which to operate.
314 * @newOffset: the offset to which the text caret is to be moved.
316 * Set the text caret position for an #AccessibleText object.
318 * Returns: #TRUE if successful, #FALSE otherwise.
321 AccessibleText_setCaretOffset (AccessibleText *obj,
324 dbus_int32_t d_newOffset = newOffset;
327 cspi_return_val_if_fail (obj != NULL, FALSE);
329 cspi_dbus_call (obj, spi_interface_text, "setCaretOffset", NULL, "i=>b", d_newOffset, &retval);
331 cspi_return_val_if_ev ("setCaretOffset", FALSE);
337 * AccessibleText_getTextBeforeOffset:
338 * @obj: a pointer to the #AccessibleText object on which to operate.
339 * @offset: a long integer indicating the offset from which the delimiter
341 * @type: an #AccessibleTextBoundaryType indicating whether the desired
342 * text string is a word, sentence, line, or attribute run.
343 * @startOffset: a pointer to a long integer which is assigned the
344 * starting offset of the returned string, relative to the
345 * original #AccessibleText.
346 * @endOffset: a pointer to a long integer which is assigned the
347 * ending offset of the returned string, relative to the original
350 * Get delimited text from an #AccessibleText object which precedes a given
353 * Returns: a UTF-8 string representing the delimited text, both of whose
354 * delimiting boundaries are before the current offset, or
355 * an empty string if no such text exists.
358 AccessibleText_getTextBeforeOffset (AccessibleText *obj,
360 AccessibleTextBoundaryType type,
361 long int *startOffset,
364 dbus_int32_t d_offset = offset;
365 dbus_uint32_t d_type = type;
366 dbus_int32_t retStartOffset, retEndOffset;
371 *startOffset = *endOffset = -1;
375 cspi_dbus_call (obj, spi_interface_text, "getTextBeforeOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
376 if (!cspi_check_ev ("getTextBeforeOffset"))
378 *startOffset = *endOffset = -1;
383 *startOffset = retStartOffset;
384 *endOffset = retEndOffset;
390 * AccessibleText_getTextAtOffset:
391 * @obj: a pointer to the #AccessibleText object on which to operate.
392 * @offset: a long integer indicating the offset from which the delimiter
394 * @type: an #AccessibleTextBoundaryType indicating whether the desired
395 * text string is a word, sentence, line, or attribute run.
396 * @startOffset: a pointer to a long integer which is assigned the
397 * starting offset of the returned string, relative to the
398 * original #AccessibleText.
399 * @endOffset: a pointer to a long integer which is assigned the
400 * ending offset of the returned string, relative to the original
403 * Get delimited text from an #AccessibleText object which includes a given
406 * Returns: a UTF-8 string representing the delimited text, whose
407 * delimiting boundaries bracket the current offset, or
408 * an empty string if no such text exists.
411 AccessibleText_getTextAtOffset (AccessibleText *obj,
413 AccessibleTextBoundaryType type,
414 long int *startOffset, long int *endOffset)
416 dbus_int32_t d_offset = offset;
417 dbus_uint32_t d_type = type;
418 dbus_int32_t retStartOffset, retEndOffset;
423 *startOffset = *endOffset = -1;
427 cspi_dbus_call (obj, spi_interface_text, "getTextAtOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
429 if (!cspi_check_ev ("getTextAtOffset"))
431 *startOffset = *endOffset = -1;
436 *startOffset = retStartOffset;
437 *endOffset = retEndOffset;
443 * AccessibleText_getTextAfterOffset:
444 * @obj: a pointer to the #AccessibleText object on which to operate.
445 * @offset: a long integer indicating the offset from which the delimiter
447 * @type: an #AccessibleTextBoundaryType indicating whether the desired
448 * text string is a word, sentence, line, or attribute run.
449 * @startOffset: a pointer to a long integer which is assigned the
450 * starting offset of the returned string, relative to the
451 * original #AccessibleText.
452 * @endOffset: a pointer to a long integer which is assigned the
453 * ending offset of the returned string, relative to the original
456 * Get delimited text from an #AccessibleText object which follows a given
459 * Returns: a UTF-8 string representing the delimited text, both of whose
460 * delimiting boundaries are after or inclusive of the current
461 * offset, or an empty string if no such text exists.
464 AccessibleText_getTextAfterOffset (AccessibleText *obj,
466 AccessibleTextBoundaryType type,
467 long int *startOffset, long int *endOffset)
469 dbus_int32_t d_offset = offset;
470 dbus_uint32_t d_type = type;
471 dbus_int32_t retStartOffset, retEndOffset;
476 *startOffset = *endOffset = -1;
480 cspi_dbus_call (obj, spi_interface_text, "getTextAfterOffset", NULL, "iu=>sii", d_offset, d_type, &retval, &retStartOffset, &retEndOffset);
482 if (!cspi_check_ev ("getTextAfterOffset"))
484 *startOffset = *endOffset = -1;
489 *startOffset = retStartOffset;
490 *endOffset = retEndOffset;
496 * AccessibleText_getCharacterAtOffset:
497 * @obj: a pointer to the #AccessibleText object on which to operate.
498 * @offset: a long integer indicating the text offset where the desired
499 * character is located.
501 * Get the character at a given offset for an #AccessibleText object.
503 * Returns: an #unsigned long integer which represents the
504 * UCS-4 unicode code point of the given character, or
505 * 0xFFFFFFFF if the character in question cannot be represented
506 * in the UCS-4 encoding.
509 AccessibleText_getCharacterAtOffset (AccessibleText *obj,
512 dbus_int32_t d_offset = offset;
515 cspi_return_val_if_fail (obj != NULL, -1);
517 cspi_dbus_call (obj, spi_interface_text, "getCharacterAtOffset", NULL, "i=>i", d_offset, &retval);
519 cspi_return_val_if_ev ("getCharacterAtOffset", -1);
525 * AccessibleText_getCharacterExtents:
526 * @obj: a pointer to the #AccessibleText object on which to operate.
527 * @offset: an integer indicating the offset of the text character for
528 * whom boundary information is requested.
529 * @x: a pointer to a long integer into which the nominal x coordinate
530 * of the corresponding glyph will be returned.
531 * @y:a pointer to a long integer into which the nominal y coordinate
532 * of the corresponding glyph will be returned.
533 * @width:a pointer to a long integer into which the width
534 * of the corresponding glyph will be returned.
535 * @height: a pointer to a long integer into which the height
536 * of the corresponding glyph will be returned.
537 * @type: an #AccessibleCoordType indicating the coordinate system to use
538 * for the returned values.
540 * Get the bounding box containing the glyph representing
541 * the character at a particular text offset.
544 AccessibleText_getCharacterExtents (AccessibleText *obj,
550 AccessibleCoordType type)
552 dbus_int32_t d_offset = offset;
553 dbus_uint16_t d_type = type;
554 dbus_int32_t retX, retY, retWidth, retHeight;
559 *width = *height = -1;
563 cspi_dbus_call (obj, spi_interface_text, "getCharacterExtents", NULL, "in=>iiii", d_offset, d_type, &retX, &retY, &retWidth, &retHeight);
565 if (!cspi_check_ev ("getCharacterExtents"))
568 *width = *height = -1;
580 * AccessibleText_getOffsetAtPoint:
581 * @obj: a pointer to the #AccessibleText object on which to operate.
582 * @x: the x coordinate of the point to be queried.
583 * @y: the y coordinate of the point to be queried.
584 * @type: an #AccessibleCoordType indicating the coordinate system in which
585 * the values should be returned.
587 * Get the bounding box for a glyph at a certain #AccessibleText offset.
589 * Returns: the offset (as a long integer) at the point (@x, @y)
590 * in the specified coordinate system.
594 AccessibleText_getOffsetAtPoint (AccessibleText *obj,
597 AccessibleCoordType type)
599 dbus_int32_t d_x = x, d_y = y;
600 dbus_uint16_t d_type = type;
603 cspi_return_val_if_fail (obj != NULL, -1);
605 cspi_dbus_call (obj, spi_interface_text, "getOffsetAtPoint", NULL, "iin=>i", d_x, d_y, d_type, &retval);
607 cspi_return_val_if_ev ("getOffsetAtPoint", -1);
613 * AccessibleText_getRangeExtents:
614 * @obj: a pointer to the #AccessibleText object on which to operate.
615 * @startOffset: an integer indicating the offset of the first text character for
616 * whom boundary information is requested.
617 * @endOffset: an integer indicating the offset of the text character
618 * after the last character for whom boundary information is requested.
619 * @x: a pointer to a long integer into which the nominal x coordinate
620 * of the corresponding bounding box will be returned.
621 * @y:a pointer to a long integer into which the nominal y coordinate
622 * of the corresponding bounding box will be returned.
623 * @width:a pointer to a long integer into which the width
624 * of the corresponding bounding box will be returned.
625 * @height: a pointer to a long integer into which the height
626 * of the corresponding bounding box will be returned.
627 * @type: an #AccessibleCoordType indicating the coordinate system to use
628 * for the returned values.
630 * Get the bounding box for text within a range in an #AccessibleText object.
635 AccessibleText_getRangeExtents (AccessibleText *obj,
636 long int startOffset,
642 AccessibleCoordType type)
644 dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
645 dbus_int16_t d_type = type;
646 dbus_int32_t retX, retY, retWidth, retHeight;
651 *width = *height = -1;
655 cspi_dbus_call (obj, spi_interface_text, "getRangeExtents", NULL, "iin=>iiii", d_startOffset, d_endOffset, d_type, &retX, &retY, &retWidth, &retHeight);
657 if (!cspi_check_ev ("getRangeExtents"))
660 *width = *height = -1;
672 * AccessibleText_getBoundedRanges:
673 * @obj: a pointer to the #AccessibleText object on which to operate.
674 * @x: the 'starting' x coordinate of the bounding box.
675 * @y: the 'starting' y coordinate of the bounding box.
676 * @width: the x extent of the bounding box.
677 * @height: the y extent of the bounding box.
678 * @type: an #AccessibleCoordType indicating the coordinate system to use
679 * for the returned values.
680 * @clipTypeX: an #AccessibleTextClipType indicating how to treat characters that
681 * intersect the bounding box's x extents.
682 * @clipTypeY: an #AccessibleTextClipType indicating how to treat characters that
683 * intersect the bounding box's y extents.
685 * Get the ranges of text from an #AccessibleText object which lie within the
686 * bounds defined by (@x, @y) and (@x+@width, @y+@height).
690 * Returns: a null-terminated list of pointers to AccessibleTextRange structs
691 * detailing the bounded text.
693 AccessibleTextRange **
694 AccessibleText_getBoundedRanges (AccessibleText *obj,
699 AccessibleCoordType type,
700 AccessibleTextClipType clipTypeX,
701 AccessibleTextClipType clipTypeY)
703 dbus_int32_t d_x = x, d_y = y, d_width = width, d_height = height;
704 dbus_uint16_t d_type = type;
705 dbus_uint32_t d_clipTypeX = clipTypeX, d_clipTypeY = clipTypeY;
708 cspi_return_val_if_fail (obj != NULL, NULL);
710 cspi_dbus_call (obj, spi_interface_text, "getBoundedRanges", NULL, "iiiinuu=>a(iisv)", d_x, d_y, d_width, d_height, d_type, d_clipTypeX, d_clipTypeY, &range_seq);
712 cspi_return_val_if_ev ("getBoundedRanges", NULL);
714 return get_accessible_text_ranges_from_range_seq (range_seq);
718 * AccessibleTextRange_freeRanges:
719 * @ranges: a pointer to an array of AccessibleTextRange structs.
721 * Free the memory used by a list of AccessibleTextRange structs.
722 * The argument passed in should be an array of pointers
723 * AccessibleTextRange structs.
728 AccessibleTextRange_freeRanges (AccessibleTextRange **ranges)
730 /* this was a contiguously allocated block, only free the first element */
736 * AccessibleText_getNSelections:
737 * @obj: a pointer to the #AccessibleText object on which to operate.
739 * Get the number of active non-contiguous selections for an
740 * #AccessibleText object.
742 * Returns: a long integer indicating the current
743 * number of non-contiguous text selections active
744 * within an #AccessibleText object.
747 AccessibleText_getNSelections (AccessibleText *obj)
751 cspi_return_val_if_fail (obj != NULL, -1);
753 cspi_dbus_call (obj, spi_interface_text, "getNSelections", NULL, "i", &retval);
755 cspi_return_val_if_ev ("getNSelections", -1);
761 * AccessibleText_getSelection:
762 * @obj: a pointer to the #AccessibleText object on which to operate.
763 * @selectionNum: an integer indicating which selection to query.
764 * @startOffset: a pointer to a long integer into which the start offset
765 * of the selection will be returned.
766 * @endOffset: a pointer to a long integer into which the start offset
767 * of the selection will be returned.
769 * Get the bounds of the @selectionNum-th active text selection for an
770 * #AccessibleText object.
773 AccessibleText_getSelection (AccessibleText *obj,
774 long int selectionNum,
775 long int *startOffset,
778 dbus_int32_t d_selectionNum = selectionNum;
779 dbus_int32_t retStartOffset, retEndOffset;
783 *endOffset = *startOffset = -1;
787 cspi_dbus_call (obj, spi_interface_text, "getSelection", NULL, "i=>ii", d_selectionNum, &retStartOffset, &retEndOffset);
789 if (!cspi_check_ev ("getSelection"))
791 *startOffset = *endOffset = -1;
795 *startOffset = retStartOffset;
796 *endOffset = retEndOffset;
801 * AccessibleText_addSelection:
802 * @obj: a pointer to the #AccessibleText object on which to operate.
803 * @startOffset: the starting offset of the desired new selection.
804 * @endOffset: the offset of the first character after the new selection.
806 * Select some text (add a text selection) in an #AccessibleText object.
808 * Returns: #TRUE if successful, #FALSE otherwise.
811 AccessibleText_addSelection (AccessibleText *obj,
812 long int startOffset, long int endOffset)
814 dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
817 cspi_return_val_if_fail (obj != NULL, FALSE);
819 cspi_dbus_call (obj, spi_interface_text, "addSelection", NULL, "ii=>b", d_startOffset, d_endOffset, &retval);
821 cspi_return_val_if_ev ("addSelection", FALSE);
827 * AccessibleText_removeSelection:
828 * @obj: a pointer to the #AccessibleText object on which to operate.
829 * @selectionNum: an integer indicating which (possibly of several)
830 * text selection to remove.
832 * De-select a text selection.
834 * Returns: #TRUE if successful, #FALSE otherwise.
837 AccessibleText_removeSelection (AccessibleText *obj,
838 long int selectionNum)
840 dbus_int32_t d_selectionNum = selectionNum;
843 cspi_return_val_if_fail (obj != NULL, FALSE);
845 cspi_dbus_call (obj, spi_interface_text, "removeSelection", NULL, "i=>b", d_selectionNum, &retval);
847 cspi_return_val_if_ev ("removeSelection", FALSE);
853 * AccessibleText_setSelection:
854 * @obj: a pointer to the #AccessibleText object on which to operate.
855 * @selectionNum: a zero-offset index indicating which text selection to modify.
856 * @startOffset: a long int, the new starting offset for the selection.
857 * @endOffset: a long int, the desired new offset of the first character
858 * after the selection.
860 * Change the bounds of an existing #AccessibleText text selection.
862 * Returns: #TRUE if successful, #FALSE otherwise.
865 AccessibleText_setSelection (AccessibleText *obj,
866 long int selectionNum,
867 long int startOffset,
870 dbus_int32_t d_selectionNum = selectionNum, d_startOffset = startOffset, d_endOffset = endOffset;
873 cspi_return_val_if_fail (obj != NULL, FALSE);
875 cspi_dbus_call (obj, spi_interface_text, "setSelection", NULL, "iii=>b", d_selectionNum, d_startOffset, d_endOffset, &retval);
877 cspi_return_val_if_ev ("setSelection", FALSE);
884 * AccessibleText_getAttributeRun:
885 * @obj: a pointer to the #AccessibleText object to query.
886 * @offset: a long integer indicating the offset from which the attribute
888 * @startOffset: a #long indicating the start of the desired text range.
889 * @endOffset: a #long indicating the first character past the desired range.
890 * @includeDefaults: a #bool if False, the call should only return those
891 * attributes which are explicitly set on the current attribute
892 * run, omitting any attributes which are inherited from the
897 * Returns: the AttributeSet defined at offset, optionally including the 'default' attributes.
900 AccessibleAttributeSet *
901 AccessibleText_getAttributeRun (AccessibleText *obj,
903 long int *startOffset,
905 long int includeDefaults){
907 dbus_int32_t d_offset = offset;
908 dbus_bool_t d_includeDefaults = includeDefaults;
909 dbus_int32_t retStartOffset, retEndOffset;
910 AccessibleAttributeSet *retval;
915 *startOffset = *endOffset = -1;
919 cspi_dbus_call (obj, spi_interface_text, "getAttributeRun", NULL, "ib=>asii", d_offset, d_includeDefaults, &attributes, &retStartOffset, &retEndOffset);
921 if (!cspi_check_ev ("getAttributeRun"))
923 *startOffset = *endOffset = -1;
928 *startOffset = retStartOffset;
929 *endOffset = retEndOffset;
930 retval = _cspi_attribute_set_from_sequence (attributes);
938 * AccessibleText_getDefaultAttributeSet:
939 * @obj: a pointer to the #AccessibleText object to query.
944 * Returns: an AttributeSet containing the text attributes
945 * which apply to all text in the object by virtue of the
946 * default settings of the document, view, or user agent; e.g.
947 * those attributes which are implied rather than explicitly
948 * applied to the text object. For instance, an object whose
949 * entire text content has been explicitly marked as 'bold'
950 * will report the 'bold' attribute via getAttributeRun(),
951 * whereas an object whose text weight is inspecified may
952 * report the default or implied text weight in the default AttributeSet.
956 AccessibleAttributeSet *
957 AccessibleText_getDefaultAttributeSet (AccessibleText *obj){
958 AccessibleAttributeSet *retval;
961 cspi_return_val_if_fail (obj != NULL, NULL);
963 cspi_dbus_call (obj, spi_interface_text, "getDefaultAttributes", NULL, "as", &attributes);
965 retval = _cspi_attribute_set_from_sequence (attributes);