Add navigation helper functions for screen-reader and friends
[platform/upstream/at-spi2-core.git] / atspi / atspi-document.c
index ceee576..98dfc4f 100644 (file)
@@ -45,7 +45,7 @@ atspi_document_get_locale (AtspiDocument *obj, GError **error)
 }
 
 /**
- * atspi_document_get_attribute_value:
+ * atspi_document_get_attribute_value: (rename-to atspi_document_get_document_attribute_value)
  * @obj: a pointer to the #AtspiDocument object on which to operate.
  * @attribute: a string indicating the name of a specific attribute.
  *
@@ -53,12 +53,32 @@ atspi_document_get_locale (AtspiDocument *obj, GError **error)
  *
  * Returns: a string corresponding to the value of the specified attribute, or
  * an empty string if the attribute is unspecified for the object.
+ *
+ * Deprecated: 2.10: Use atspi_document_get_document_attribute_value instead.
  **/
 gchar *
 atspi_document_get_attribute_value (AtspiDocument *obj,
                                      gchar *attribute,
                                      GError **error)
 {
+  return atspi_document_get_document_attribute_value (obj, attribute, error);
+}
+                                     
+/**
+ * atspi_document_get_document_attribute_value:
+ * @obj: a pointer to the #AtspiDocument object on which to operate.
+ * @attribute: a string indicating the name of a specific attribute.
+ *
+ * Gets the value of a single attribute, if specified for the document as a whole.
+ *
+ * Returns: a string corresponding to the value of the specified attribute, or
+ * an empty string if the attribute is unspecified for the object.
+ **/
+gchar *
+atspi_document_get_document_attribute_value (AtspiDocument *obj,
+                                            gchar *attribute,
+                                            GError **error)
+{
   gchar *retval = NULL;
 
   g_return_val_if_fail (obj != NULL, NULL);
@@ -73,7 +93,7 @@ atspi_document_get_attribute_value (AtspiDocument *obj,
                                      
 
 /**
- * atspi_document_get_attributes:
+ * atspi_document_get_attributes: (rename-to atspi_document_get_document_attributes)
  * @obj: a pointer to the #AtspiDocument object on which to operate.
  * 
  * Gets all constant attributes for the document as a whole. For attributes
@@ -81,10 +101,28 @@ atspi_document_get_attribute_value (AtspiDocument *obj,
  * 
  * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
  *          containing the constant attributes of the document, as name-value pairs.
+ *
+ * Deprecated: 2.10: Use atspi_document_get_document_attributes instead.
  **/
 GHashTable *
 atspi_document_get_attributes (AtspiDocument *obj, GError **error)
 {
+  return atspi_document_get_document_attributes (obj, error);
+}
+
+/**
+ * atspi_document_get_document_attributes:
+ * @obj: a pointer to the #AtspiDocument object on which to operate.
+ * 
+ * Gets all constant attributes for the document as a whole. For attributes
+ * that change within the document content, see @atspi_text_get_attribute_run instead.
+ * 
+ * Returns: (element-type gchar* gchar*) (transfer full): a #GHashTable
+ *          containing the constant attributes of the document, as name-value pairs.
+ **/
+GHashTable *
+atspi_document_get_document_attributes (AtspiDocument *obj, GError **error)
+{
   DBusMessage *message;
 
     g_return_val_if_fail (obj != NULL, NULL);
@@ -93,6 +131,48 @@ atspi_document_get_attributes (AtspiDocument *obj, GError **error)
   return _atspi_dbus_return_hash_from_message (message);
 }
 
+/**
+ * atspi_document_get_page_count:
+ * @obj: a pointer to the #AtspiDocument object to query.
+ *
+ * Gets the page count of an #AccessibleDocument object.
+ *
+ * Returns: a #gint indicating the page count of an
+ * #AccessibleDocument object.
+ **/
+gint
+atspi_document_get_page_count (AtspiDocument *obj, GError **error)
+{
+  dbus_int32_t retval = 0;
+
+  g_return_val_if_fail (obj != NULL, -1);
+
+  _atspi_dbus_get_property (obj, atspi_interface_document, "PageCount", error, "i", &retval);
+
+  return retval;
+}
+
+/**
+ * atspi_document_get_current_page_number:
+ * @obj: a pointer to the #AtspiDocument object to query.
+ *
+ * Gets the current page number of an #AccessibleDocument object.
+ *
+ * Returns: a #gint indicating the current page number in the
+ * #AccessibleDocument object.
+ **/
+gint
+atspi_document_get_current_page_number (AtspiDocument *obj, GError **error)
+{
+  dbus_int32_t retval = 0;
+
+  g_return_val_if_fail (obj != NULL, -1);
+
+  _atspi_dbus_get_property (obj, atspi_interface_document, "CurrentPageNumber", error, "i", &retval);
+
+  return retval;
+}
+
 static void
 atspi_document_base_init (AtspiDocument *klass)
 {