/* Fixme */
return Accessibility_TEXT_BOUNDARY_CHAR;
break;
+ default:
+ /* FIXME */
+ return Accessibility_TEXT_BOUNDARY_CHAR;
}
- /* FIXME */
- return Accessibility_TEXT_BOUNDARY_CHAR;
}
static Accessibility_TEXT_CLIP_TYPE
case SPI_TEXT_CLIP_MIN:
return Accessibility_TEXT_CLIP_MIN;
break;
- case SPI_TEXT_CLIP_MAX:
+ case SPI_TEXT_CLIP_MAX:
return Accessibility_TEXT_CLIP_MAX;
break;
+ default:
+ return Accessibility_TEXT_CLIP_BOTH;
}
- return Accessibility_TEXT_CLIP_BOTH;
}
+typedef struct
+{
+ dbus_int32_t startOffset;
+ dbus_int32_t endOffset;
+ char *content;
+} Accessibility_Range;
+
static AccessibleTextRange **
-get_accessible_text_ranges_from_range_seq (Accessibility_Text_RangeList *range_seq)
+get_accessible_text_ranges_from_range_seq (GArray *range_seq)
{
AccessibleTextRange **ranges = NULL;
AccessibleTextRange *array = NULL;
int i;
- if (range_seq && range_seq->_length > 0)
+ if (range_seq && range_seq->len > 0)
{
- ranges = g_new0 (AccessibleTextRange *, range_seq->_length + 1);
+ ranges = g_new0 (AccessibleTextRange *, range_seq->len + 1);
}
- array = g_new0 (AccessibleTextRange, range_seq->_length);
- for (i = 0; i < range_seq->_length; i++)
+ array = g_new0 (AccessibleTextRange, range_seq->len);
+ for (i = 0; i < range_seq->len; i++)
{
+ Accessibility_Range *r = g_array_index (range_seq, Accessibility_Range *, i);
AccessibleTextRange *range;
range = &array[i];
- range->start = range_seq->_buffer[i].startOffset;
- range->end = range_seq->_buffer[i].endOffset;
- range->contents = CORBA_string_dup (range_seq->_buffer[i].content);
+ range->start = r->startOffset;
+ range->end = r->endOffset;
+ range->contents = g_strdup (r->content);
ranges[i] = range;
}
ranges[i] = NULL; /* null-terminated list! */
- CORBA_free (range_seq);
+ // TODO: Figure out whether we're leaking strings
+ g_array_free (range_seq, TRUE);
return ranges;
}
long
AccessibleText_getCharacterCount (AccessibleText *obj)
{
- long retval;
+ dbus_int32_t retval;
cspi_return_val_if_fail (obj != NULL, -1);
- retval = Accessibility_Text__get_characterCount (CSPI_OBJREF (obj), cspi_ev ());
+ cspi_dbus_get_property (obj, spi_interface_text, "characterCount", NULL, "i", &retval);
cspi_return_val_if_ev ("getCharacterCount", -1);
long int endOffset)
{
char *retval;
+ dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
cspi_return_val_if_fail (obj != NULL, NULL);
- retval =
- Accessibility_Text_getText (CSPI_OBJREF (obj),
- startOffset,
- endOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getText", NULL, "ii=>s", startOffset, endOffset, &retval);
cspi_return_val_if_ev ("getText", NULL);
long
AccessibleText_getCaretOffset (AccessibleText *obj)
{
- long retval;
+ dbus_int32_t retval;
cspi_return_val_if_fail (obj != NULL, -1);
- retval =
- Accessibility_Text__get_caretOffset (CSPI_OBJREF (obj), cspi_ev ());
+ cspi_dbus_get_property (obj, spi_interface_text, "caretOffset", NULL, "i", &retval);
cspi_return_val_if_ev ("getCaretOffset", -1);
long int *startOffset,
long int *endOffset)
{
- CORBA_long retStartOffset, retEndOffset;
+ dbus_int32_t d_offset = offset;
+ dbus_int32_t retStartOffset, retEndOffset;
char *retval;
if (obj == NULL)
return NULL;
}
- retval = Accessibility_Text_getAttributes (CSPI_OBJREF (obj),
- offset,
- &retStartOffset,
- &retEndOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "i=>iis", d_offset, &retStartOffset, &retEndOffset, &retval);
if (!cspi_check_ev ("getAttributes"))
{
}
/**
+ * AccessibleText_getDefaultAttributes:
+ * @obj: a pointer to the #AccessibleText object to query.
+ *
+ * Get the default attributes applied to an #AccessibleText
+ * object.
+ * The text attributes correspond to CSS attributes where possible,
+ * keys and values are delimited from one another via ":", and
+ * the delimiter between key/value pairs is ";". Thus
+ * "font-size:10;foreground-color:0,0,0" would be a valid
+ * return string. The combination of this attribute set and
+ * the attributes reported by #AccessibleText_getAttributes
+ * describes the entire set of text attributes over a range.
+ *
+ * @Since: AT-SPI 1.4
+ *
+ * Returns: a text string describing the default attributes
+ * applied to a text object, (exclusive of explicitly-set
+ * attributes), encoded as UTF-8.
+ **/
+char *
+AccessibleText_getDefaultAttributes (AccessibleText *obj)
+{
+ char *retval;
+
+ if (obj == NULL)
+ {
+ return NULL;
+ }
+
+ cspi_dbus_call (obj, spi_interface_text, "getAttributes", NULL, "=>s", &retval);
+
+ if (!cspi_check_ev ("getAttributes"))
+ {
+ retval = NULL;
+ }
+
+ return retval;
+}
+
+/**
* AccessibleText_setCaretOffset:
* @obj: a pointer to the #AccessibleText object on which to operate.
* @newOffset: the offset to which the text caret is to be moved.
AccessibleText_setCaretOffset (AccessibleText *obj,
long int newOffset)
{
- SPIBoolean retval;
+ dbus_int32_t d_newOffset = newOffset;
+ dbus_bool_t retval;
cspi_return_val_if_fail (obj != NULL, FALSE);
- retval =
- Accessibility_Text_setCaretOffset (CSPI_OBJREF (obj),
- newOffset, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "setCaretOffset", NULL, "i=>b", d_newOffset, &retval);
cspi_return_val_if_ev ("setCaretOffset", FALSE);
long int *startOffset,
long int *endOffset)
{
+ dbus_int32_t d_offset = offset;
+ dbus_uint32_t d_type = type;
+ dbus_int32_t retStartOffset, retEndOffset;
char *retval;
- CORBA_long retStartOffset, retEndOffset;
if (obj == NULL)
{
return NULL;
}
- retval = Accessibility_Text_getTextBeforeOffset (CSPI_OBJREF (obj),
- offset,
- get_accessible_text_boundary_type (type),
- &retStartOffset, &retEndOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getTextBeforeOffset", NULL, "iu=>iis", d_offset, d_type, &retStartOffset, &retEndOffset, &retval);
if (!cspi_check_ev ("getTextBeforeOffset"))
{
*startOffset = *endOffset = -1;
AccessibleTextBoundaryType type,
long int *startOffset, long int *endOffset)
{
- CORBA_long corbaStartOffset;
- CORBA_long corbaEndOffset;
- char *retval;
+ dbus_int32_t d_offset = offset;
+ dbus_uint32_t d_type = type;
+ dbus_int32_t retStartOffset, retEndOffset;
+ char *retval;
if (obj == NULL)
{
return NULL;
}
- retval = Accessibility_Text_getTextAtOffset (CSPI_OBJREF (obj),
- offset,
- get_accessible_text_boundary_type (type),
- &corbaStartOffset,
- &corbaEndOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getTextAtOffset", NULL, "iu=>iis", d_offset, d_type, &retStartOffset, &retEndOffset, &retval);
if (!cspi_check_ev ("getTextAtOffset"))
{
}
else
{
- *startOffset = corbaStartOffset;
- *endOffset = corbaEndOffset;
+ *startOffset = retStartOffset;
+ *endOffset = retEndOffset;
}
return retval;
}
AccessibleTextBoundaryType type,
long int *startOffset, long int *endOffset)
{
+ dbus_int32_t d_offset = offset;
+ dbus_uint32_t d_type = type;
+ dbus_int32_t retStartOffset, retEndOffset;
char *retval;
- CORBA_long retStartOffset, retEndOffset;
if (obj == NULL)
{
return NULL;
}
- retval = Accessibility_Text_getTextAfterOffset (CSPI_OBJREF (obj),
- offset,
- get_accessible_text_boundary_type (type),
- &retStartOffset, &retEndOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getTextAfterOffset", NULL, "iu=>iis", d_offset, d_type, &retStartOffset, &retEndOffset, &retval);
if (!cspi_check_ev ("getTextAfterOffset"))
{
AccessibleText_getCharacterAtOffset (AccessibleText *obj,
long int offset)
{
- long retval;
+ dbus_int32_t d_offset = offset;
+ dbus_int32_t retval;
cspi_return_val_if_fail (obj != NULL, -1);
- retval =
- Accessibility_Text_getCharacterAtOffset (CSPI_OBJREF (obj),
- offset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getCharacterAtOffset", NULL, "i=>i", d_offset, &retval);
cspi_return_val_if_ev ("getCharacterAtOffset", -1);
long int *height,
AccessibleCoordType type)
{
- CORBA_long retX, retY, retWidth, retHeight;
+ dbus_int32_t d_offset = offset;
+ dbus_uint16_t d_type = type;
+ dbus_int32_t retX, retY, retWidth, retHeight;
if (obj == NULL)
{
return;
}
- Accessibility_Text_getCharacterExtents (CSPI_OBJREF (obj),
- offset,
- &retX,
- &retY,
- &retWidth,
- &retHeight,
- type, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getCharacterExtents", NULL, "in=>iiii", d_offset, d_type, &retX, &retY, &retWidth, &retHeight);
if (!cspi_check_ev ("getCharacterExtents"))
{
long int y,
AccessibleCoordType type)
{
- long retval;
+ dbus_int32_t d_x = x, d_y = y;
+ dbus_uint16_t d_type = type;
+ dbus_int32_t retval;
cspi_return_val_if_fail (obj != NULL, -1);
- retval =
- Accessibility_Text_getOffsetAtPoint (CSPI_OBJREF (obj),
- x,
- y,
- type, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getOffsetAtPoint", NULL, "iin=>i", d_x, d_y, d_type, &retval);
cspi_return_val_if_ev ("getOffsetAtPoint", -1);
*
* Get the bounding box for text within a range in an #AccessibleText object.
*
- * Returns: the bounding-box extents of the specified text range,
- * in the specified coordinate system.
- *
+ * @Since: AT-SPI 1.2
**/
void
AccessibleText_getRangeExtents (AccessibleText *obj,
long int *height,
AccessibleCoordType type)
{
- CORBA_long retX, retY, retWidth, retHeight;
+ dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
+ dbus_int16_t d_type = type;
+ dbus_int32_t retX, retY, retWidth, retHeight;
if (obj == NULL)
{
return;
}
- Accessibility_Text_getRangeExtents (CSPI_OBJREF (obj),
- startOffset,
- endOffset,
- &retX,
- &retY,
- &retWidth,
- &retHeight,
- type, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getRangeExtents", NULL, "iin=>iiii", d_startOffset, d_endOffset, d_type, &retX, &retY, &retWidth, &retHeight);
if (!cspi_check_ev ("getRangeExtents"))
{
* Get the ranges of text from an #AccessibleText object which lie within the
* bounds defined by (@x, @y) and (@x+@width, @y+@height).
*
+ * @Since: AT-SPI 1.2
+ *
* Returns: a null-terminated list of pointers to AccessibleTextRange structs
* detailing the bounded text.
**/
AccessibleTextClipType clipTypeX,
AccessibleTextClipType clipTypeY)
{
- Accessibility_Text_RangeList *range_seq;
+ dbus_int32_t d_x = x, d_y = y, d_width = width, d_height = height;
+ dbus_uint16_t d_type = type;
+ dbus_uint32_t d_clipTypeX = clipTypeX, d_clipTypeY = clipTypeY;
+ GArray *range_seq;
cspi_return_val_if_fail (obj != NULL, NULL);
- range_seq =
- Accessibility_Text_getBoundedRanges (CSPI_OBJREF (obj),
- x, y, width, height,
- type,
- get_accessible_text_clip_type (clipTypeX),
- get_accessible_text_clip_type (clipTypeY),
- cspi_ev ());
+ 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);
cspi_return_val_if_ev ("getBoundedRanges", NULL);
* Free the memory used by a list of AccessibleTextRange structs.
* The argument passed in should be an array of pointers
* AccessibleTextRange structs.
+ *
+ * @Since: AT-SPI 1.2
**/
void
AccessibleTextRange_freeRanges (AccessibleTextRange **ranges)
long
AccessibleText_getNSelections (AccessibleText *obj)
{
- long retval;
+ dbus_int32_t retval;
cspi_return_val_if_fail (obj != NULL, -1);
- retval =
- Accessibility_Text_getNSelections (CSPI_OBJREF (obj), cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getNSelections", NULL, "i", &retval);
cspi_return_val_if_ev ("getNSelections", -1);
long int *startOffset,
long int *endOffset)
{
- CORBA_long retStartOffset, retEndOffset;
+ dbus_int32_t d_selectionNum = selectionNum;
+ dbus_int32_t retStartOffset, retEndOffset;
if (obj == NULL)
{
return;
}
- Accessibility_Text_getSelection (CSPI_OBJREF (obj),
- selectionNum,
- &retStartOffset, &retEndOffset,
- cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "getSelection", NULL, "i=>ii", d_selectionNum, &retStartOffset, &retEndOffset);
if (!cspi_check_ev ("getSelection"))
{
AccessibleText_addSelection (AccessibleText *obj,
long int startOffset, long int endOffset)
{
- SPIBoolean retval;
+ dbus_int32_t d_startOffset = startOffset, d_endOffset = endOffset;
+ dbus_bool_t retval;
cspi_return_val_if_fail (obj != NULL, FALSE);
- retval =
- Accessibility_Text_addSelection (
- CSPI_OBJREF (obj), startOffset,
- endOffset, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "addSelection", NULL, "ii=>b", d_startOffset, d_endOffset, &retval);
cspi_return_val_if_ev ("addSelection", FALSE);
AccessibleText_removeSelection (AccessibleText *obj,
long int selectionNum)
{
- SPIBoolean retval;
+ dbus_int32_t d_selectionNum = selectionNum;
+ dbus_bool_t retval;
cspi_return_val_if_fail (obj != NULL, FALSE);
- retval =
- Accessibility_Text_removeSelection (
- CSPI_OBJREF (obj), selectionNum, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "removeSelection", NULL, "i=>b", d_selectionNum, &retval);
cspi_return_val_if_ev ("removeSelection", FALSE);
long int startOffset,
long int endOffset)
{
- SPIBoolean retval;
+ dbus_int32_t d_selectionNum = selectionNum, d_startOffset = startOffset, d_endOffset = endOffset;
+ dbus_bool_t retval;
cspi_return_val_if_fail (obj != NULL, FALSE);
- retval = Accessibility_Text_setSelection (CSPI_OBJREF (obj),
- selectionNum,
- startOffset,
- endOffset, cspi_ev ());
+ cspi_dbus_call (obj, spi_interface_text, "setSelection", NULL, "iii=>b", d_selectionNum, d_startOffset, d_endOffset, &retval);
cspi_return_val_if_ev ("setSelection", FALSE);
}
+/**
+ * AccessibleText_getAttributeRun:
+ * @obj: a pointer to the #AccessibleText object to query.
+ * @offset: a long integer indicating the offset from which the attribute
+ * search is based.
+ * @startOffset: a #long indicating the start of the desired text range.
+ * @endOffset: a #long indicating the first character past the desired range.
+ * @includeDefaults: a #bool if False, the call should only return those
+ * attributes which are explicitly set on the current attribute
+ * run, omitting any attributes which are inherited from the
+ * default values.
+ *
+ * @Since: AT-SPI 1.7
+ *
+ * Returns: the AttributeSet defined at offset, optionally including the 'default' attributes.
+ **/
+AccessibleAttributeSet *
+AccessibleText_getAttributeRun (AccessibleText *obj,
+ long int offset,
+ long int *startOffset,
+ long int *endOffset,
+ long int includeDefaults){
+
+ dbus_int32_t d_offset = offset;
+ dbus_bool_t d_includeDefaults = includeDefaults;
+ dbus_int32_t retStartOffset, retEndOffset;
+ AccessibleAttributeSet *retval;
+ GArray *attributes;
+
+ if (obj == NULL)
+ {
+ *startOffset = *endOffset = -1;
+ return NULL;
+ }
+
+ cspi_dbus_call (obj, spi_interface_text, "getAttributeRun", NULL, "ib=>iias", d_offset, d_includeDefaults, &retStartOffset, &retEndOffset, &attributes);
+
+ if (!cspi_check_ev ("getAttributeRun"))
+ {
+ *startOffset = *endOffset = -1;
+ retval = NULL;
+ }
+ else
+ {
+ *startOffset = retStartOffset;
+ *endOffset = retEndOffset;
+ retval = _cspi_attribute_set_from_sequence (attributes);
+ }
+
+ return retval;
+
+}
+
+/**
+ * AccessibleText_getDefaultAttributeSet:
+ * @obj: a pointer to the #AccessibleText object to query.
+ *
+ *
+ * @Since: AT-SPI 1.7
+ *
+ * Returns: an AttributeSet containing the text attributes
+ * which apply to all text in the object by virtue of the
+ * default settings of the document, view, or user agent; e.g.
+ * those attributes which are implied rather than explicitly
+ * applied to the text object. For instance, an object whose
+ * entire text content has been explicitly marked as 'bold'
+ * will report the 'bold' attribute via getAttributeRun(),
+ * whereas an object whose text weight is inspecified may
+ * report the default or implied text weight in the default AttributeSet.
+ *
+ **/
+
+AccessibleAttributeSet *
+AccessibleText_getDefaultAttributeSet (AccessibleText *obj){
+ AccessibleAttributeSet *retval;
+ GArray *attributes;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ cspi_dbus_call (obj, spi_interface_text, "getDefaultAttributes", NULL, "as", &attributes);
+
+ retval = _cspi_attribute_set_from_sequence (attributes);
+ return retval;
+}