Add API for getting default text attributes from Accessibility_Text
authorbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 1 Dec 2003 17:10:51 +0000 (17:10 +0000)
committerbillh <billh@e2bd861d-eb25-0410-b326-f6ed22b6b98c>
Mon, 1 Dec 2003 17:10:51 +0000 (17:10 +0000)
implementors.  Fix for bug #118581.

git-svn-id: http://svn.gnome.org/svn/at-spi/trunk@562 e2bd861d-eb25-0410-b326-f6ed22b6b98c

ChangeLog
cspi/spi.h
cspi/spi_text.c
docs/reference/cspi/tmpl/spi_event.sgml
docs/reference/cspi/tmpl/spi_registry.sgml
idl/Accessibility_Text.idl
libspi/text.c

index 46a7522..c6d6b76 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2003-12-01  Bill Haneman <billh@gnome.org>
+
+       Fix for bug #118581.
+       * idl/Accessibility_Text.idl:
+       (getDefaultAttributes): New.
+       (unimplemented4): Removed (replaced by above method).
+
+       * libspi/text.c:
+       (impl_getDefaultAttributes): New method.
+       (spi_text_class_init):
+       initialize the get_default_attributes slot in the epv.
+
+       * cspi/spi.h:
+       (AccessibleText_getDefaultAttributes): New prototype.
+
+       * cspi/spi_text.c:
+       (AccessibleText_getDefaultAttributes): New method.
+
 2003-11-06  Padraig O'Briain <padraig.obriain@sun.com>
 
        * cspi/spi_accessible.c (cspi_init_relation_type_table): Do not
index d386a1e..f9e4b0c 100644 (file)
@@ -842,6 +842,8 @@ AccessibleText_getAttributes (AccessibleText *obj,
                                 long int *startOffset,
                                 long int *endOffset);
 
+char *
+AccessibleText_getDefaultAttributes (AccessibleText *obj);
 
 SPIBoolean
 AccessibleText_setCaretOffset (AccessibleText *obj,
index c63c116..0e804bc 100644 (file)
@@ -267,6 +267,45 @@ AccessibleText_getAttributes (AccessibleText *obj,
 }
 
 /**
+ * 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.
+ *
+ * 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;
+    }
+
+  retval = Accessibility_Text_getDefaultAttributes (CSPI_OBJREF (obj),
+                                                   cspi_ev ());
+
+  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.
index 6d2b879..5e81c3a 100644 (file)
@@ -14,11 +14,15 @@ Event Listener Support
 
 </para>
 
-<!-- ##### TYPEDEF AccessibleEvent ##### -->
+<!-- ##### STRUCT AccessibleEvent ##### -->
 <para>
 AccessibleEvent is a struct used to encapsulate event information.
 </para>
 
+@type: 
+@source: 
+@detail1: 
+@detail2: 
 
 <!-- ##### USER_FUNCTION AccessibleEventListenerCB ##### -->
 <para>
index 5fcd339..2504096 100644 (file)
@@ -251,11 +251,18 @@ This is a synonym for AccessibleDeviceEvent.
 @Returns: 
 
 
-<!-- ##### TYPEDEF AccessibleDeviceEvent ##### -->
+<!-- ##### STRUCT AccessibleDeviceEvent ##### -->
 <para>
 AccessibleDeviceEvent is a struct which encapsulates a device event.
 </para>
 
+@keyID: 
+@keycode: 
+@keystring: 
+@timestamp: 
+@type: 
+@modifiers: 
+@is_text: 
 
 <!-- ##### TYPEDEF AccessibleDeviceEventMask ##### -->
 <para>
index 49fe577..d0ea1f3 100644 (file)
@@ -72,6 +72,7 @@ module Accessibility {
                                                           */
     string getAttributes (in long offset,
                          out long startOffset, out long endOffset);
+    string getDefaultAttributes ();
     void getCharacterExtents (in long offset, out long x, out long y, out long width, out long height, in short coordType);
     long getOffsetAtPoint (in long x, in long y, in short coordType);
     long getNSelections ();
@@ -87,6 +88,7 @@ module Accessibility {
                                in short coordType, 
                                in TEXT_CLIP_TYPE xClipType, 
                                in TEXT_CLIP_TYPE yClipType);
+
     /**
      * unImplemented:
      *
@@ -95,6 +97,5 @@ module Accessibility {
     void unImplemented ();
     void unImplemented2 ();
     void unImplemented3 ();
-    void unImplemented4 ();
   };
 };
index 1ed2e7b..bfe1ed4 100644 (file)
@@ -308,6 +308,23 @@ impl_getAttributes (PortableServer_Servant servant,
   return rv;  
 }
 
+static CORBA_string
+impl_getDefaultAttributes (PortableServer_Servant servant,
+                          CORBA_Environment *ev)
+{
+  AtkAttributeSet *set;
+  gint intstart_offset, intend_offset;
+  CORBA_char *rv;
+  AtkText *text = get_text_from_servant (servant);
+
+  g_return_val_if_fail (text != NULL, CORBA_string_dup (""));
+
+  set = atk_text_get_default_attributes (text);
+
+  rv = _string_from_attribute_set (set);
+  atk_attribute_set_free (set);
+  return rv;  
+}
 
 static void 
 impl_getCharacterExtents (PortableServer_Servant servant,
@@ -628,6 +645,7 @@ spi_text_class_init (SpiTextClass *klass)
   epv->getTextBeforeOffset = impl_getTextBeforeOffset;
   epv->_get_caretOffset = impl__get_caretOffset;
   epv->getAttributes = impl_getAttributes;
+  epv->getDefaultAttributes = impl_getDefaultAttributes;
   epv->getCharacterExtents = impl_getCharacterExtents;
   epv->_get_characterCount = impl__get_characterCount;
   epv->getOffsetAtPoint = impl_getOffsetAtPoint;