2006-06-29 Bill Haneman <bill.haneman@sun.com>
+ Added Document interface (see bug #326520),
+ with work from Ariel Rios <arios@us.ibm.com>.
+
+ * configure.in: Bump to 1.7.7.
+
+ * libspi/Makefile.am: Added document.[ch] to sources
+
+ * libspi/document.h:
+ (SpiDocument, SpiDocumentClass):
+ New interface implementation.
+ (spi_document_get_type, spi_document_construct)
+ (spi_document_interface_new): New methods added.
+ (SPI_DOCUMENT_TYPE, SPI_DOCUMENT)
+ (SPI_DOCUMENT_CLASS, IS_DOCUMENT, IS_DOCUMENT_CLASS):
+ Added macros for SpiDocument
+ for new object.
+
+ * libspi/document.c:
+ (spi_document_interface_new): Get a
+ new document interface. New.
+ (get_document_from_servant): Get an AtkDocument from servant New.
+ (impl_getLocale, impl_getAttributeValue, impl_getAttributes):
+ Implementation of methods defined on idl.
+ (spi_document_class_init, spi_document_init)
+ Init methods for SpiDocument. new
+
+ * idl/Accessibility.idl: Added Accessibility_Document.idl.
+
+ * cspi/Makefile.am: Added spi_document.c to sources.
+
+ * cspi/spi_document.c:
+ (AccessibleDocument_ref, AccessibleDocument_unref): Added.
+ (AccessibleDocument_getLocale, AccesibleDocument_getAttributeValue)
+ (AccessibleDocument_getAttributes): Bindings for methods defined
+ on libspi
+
+ * cspi/spi_accessible.c:
+ (Accessible_isDocument, Accessible_getDocument) New.
+ * cspi/spi.h:
+ (Accessible_isDocument, Accessible_getDocument)
+ (AccessibleDocument_ref, AccessibleDocument_unref)
+ (AccessibleDocument_getLocale, AccessibleDocument_getAttributeValue)
+ (AccessibleDocument_getAttributes): Bindings added.
+
+2006-06-29 Bill Haneman <bill.haneman@sun.com>
+
* idl/Accessibility_Document.idl: New interface
for complex documents. First stage of fix for RFE
#326520.
AT_SPI_MAJOR_VERSION=1
AT_SPI_MINOR_VERSION=7
-AT_SPI_MICRO_VERSION=6
+AT_SPI_MICRO_VERSION=7
AT_SPI_INTERFACE_AGE=0
AT_SPI_BINARY_AGE=0
AT_SPI_VERSION="$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION.$AT_SPI_MICRO_VERSION"
# libtool versioning
LT_RELEASE=$AT_SPI_MAJOR_VERSION.$AT_SPI_MINOR_VERSION
LT_CURRENT=10
-LT_REVISION=7
+LT_REVISION=8
LT_AGE=10
LT_VERSION_INFO='-version-info ${LT_CURRENT}:${LT_REVISION}:${LT_AGE}'
AC_SUBST(LT_VERSION_INFO)
spi_action.c \
spi_application.c \
spi_component.c \
+ spi_document.c \
spi_editabletext.c \
spi_event.c \
spi_hyperlink.c \
typedef Accessible AccessibleAction;
typedef Accessible AccessibleApplication;
typedef Accessible AccessibleComponent;
+typedef Accessible AccessibleDocument;
typedef Accessible AccessibleEditableText;
typedef Accessible AccessibleHyperlink;
typedef Accessible AccessibleHypertext;
SPIBoolean Accessible_isAction (Accessible *obj);
SPIBoolean Accessible_isApplication (Accessible *obj);
SPIBoolean Accessible_isComponent (Accessible *obj);
+SPIBoolean Accessible_isDocument (Accessible *obj);
SPIBoolean Accessible_isEditableText (Accessible *obj);
SPIBoolean Accessible_isHypertext (Accessible *obj);
SPIBoolean Accessible_isImage (Accessible *obj);
AccessibleAction * Accessible_getAction (Accessible *obj);
AccessibleApplication * Accessible_getApplication (Accessible *obj);
AccessibleComponent * Accessible_getComponent (Accessible *obj);
+AccessibleDocument * Accessible_getDocument (Accessible *obj);
AccessibleEditableText * Accessible_getEditableText (Accessible *obj);
AccessibleHypertext * Accessible_getHypertext (Accessible *obj);
AccessibleImage * Accessible_getImage (Accessible *obj);
short AccessibleComponent_getMDIZOrder(AccessibleComponent *obj);
double AccessibleComponent_getAlpha (AccessibleComponent *obj);
+/* AccessibleDocument function prototypes */
+
+void AccessibleDocument_ref (AccessibleDocument *obj);
+void AccessibleDocument_unref (AccessibleDocument *obj);
+char *AccessibleDocument_getLocale (AccessibleDocument *obj);
+char *AccessibleDocument_getAttributeValue (AccessibleDocument *obj,
+ char *attribute);
+AccessibleAttributeSet *AccessibleDocument_getAttributes (AccessibleDocument *obj);
+
/* AccessibleEditableText function prototypes */
void
return cspi_role;
}
-static AccessibleAttributeSet *
+AccessibleAttributeSet *
cspi_attribute_set_from_sequence (const Accessibility_AttributeSet *seq)
{
AccessibleAttributeSet *set = g_new0 (AccessibleAttributeSet, 1);
retval = cspi_attribute_set_from_sequence (corba_seq);
CORBA_free (corba_seq);
- return NULL;
+ return retval;
}
/**
}
/**
+ * Accessible_isDocument:
+ * @obj: a pointer to the #Accessible instance to query.
+ *
+ * Query whether the specified #Accessible implements #AccessibleDocument.
+ *
+ * Returns: #TRUE if @obj implements the #AccessibleDocument interface,
+ * #FALSE otherwise.
+ **/
+SPIBoolean
+Accessible_isDocument (Accessible *obj)
+{
+ return cspi_accessible_is_a (obj,
+ "IDL:Accessibility/Document:1.0");
+}
+
+/**
* Accessible_isEditableText:
* @obj: a pointer to the #Accessible instance to query.
*
return (AccessibleComponent *) Accessible_queryInterface (
obj, "IDL:Accessibility/Component:1.0");
}
+/**
+ * Accessible_getDocument:
+ * @obj: a pointer to the #Accessible instance to query.
+ *
+ * Get the #AccessibleDocument interface for an #Accessible.
+ *
+ * Returns: a pointer to an #AccessibleDocument interface instance, or
+ * NULL if @obj does not implement #AccessibleDocument.
+ **/
+AccessibleDocument *
+Accessible_getDocument (Accessible *obj)
+{
+ return (AccessibleDocument *) Accessible_queryInterface (
+ obj, "IDL:Accessibility/Document:1.0");
+}
/**
* Accessible_getEditableText:
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#include <cspi/spi.h>
+#include <cspi/spi-private.h>
+
+
+/**
+ * AccessibleDocument_ref:
+ * @obj: a pointer to the #AccessibleDocument object on which to operate.
+ *
+ * Increment the reference count for an #AccessibleDocument object.
+ **/
+void
+AccessibleDocument_ref (AccessibleDocument *obj)
+{
+ cspi_object_ref (obj);
+}
+
+/**
+ * AccessibleDocument_unref:
+ * @obj: a pointer to the #Accessible object on which to operate.
+ *
+ * Decrement the reference count for an #AccessibleDocument object.
+ **/
+
+void
+AccessibleDocument_unref (AccessibleDocument *obj)
+{
+ cspi_object_unref (obj);
+}
+
+
+char *
+AccessibleDocument_getLocale (AccessibleDocument *obj)
+{
+ char *retval = "C";
+
+ cspi_return_val_if_fail (obj != NULL, "C");
+
+ retval = Accessibility_Document_getLocale (CSPI_OBJREF (obj),
+ cspi_ev ());
+
+ cspi_return_val_if_ev ("getLocale", NULL);
+
+ return retval;
+
+}
+
+char *
+AccessibleDocument_getAttributeValue (AccessibleDocument *obj,
+ char *attribute)
+{
+
+ char *retval;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ retval = Accessibility_Document_getAttributeValue (CSPI_OBJREF (obj),
+ attribute,
+ cspi_ev ());
+
+ cspi_return_val_if_ev ("getAttributeValue", NULL);
+
+ return retval;
+
+}
+
+
+AccessibleAttributeSet *
+AccessibleDocument_getAttributes (AccessibleDocument *obj){
+
+ AccessibleAttributeSet *retval;
+
+ cspi_return_val_if_fail (obj != NULL, NULL);
+
+ retval = Accessibility_Document_getAttributes (CSPI_OBJREF (obj),
+ cspi_ev ());
+ cspi_return_val_if_ev ("getAttributes", NULL);
+
+ return retval;
+
+}
application.h \
base.h \
component.h \
+ document.h \
editabletext.h \
hyperlink.h \
hypertext.h \
application.c \
base.c \
component.c \
+ document.c \
editabletext.c \
hyperlink.c \
hypertext.c \
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/* document.c: implements the Document interface */
+
+
+#include <config.h>
+#include <stdio.h>
+#include <bonobo/bonobo-exception.h>
+#include <libspi/document.h>
+#include <libspi/spi-private.h>
+
+SpiDocument *
+spi_document_interface_new (AtkObject *obj)
+{
+ SpiDocument *new_document = g_object_new (SPI_DOCUMENT_TYPE, NULL);
+
+ spi_base_construct (SPI_BASE (new_document), G_OBJECT(obj));
+
+ return new_document;
+
+}
+
+static AtkDocument *
+get_document_from_servant (PortableServer_Servant servant)
+{
+
+ SpiBase *object = SPI_BASE (bonobo_object_from_servant (servant));
+
+ g_return_val_if_fail (object, NULL);
+ g_return_val_if_fail (ATK_IS_OBJECT (object->gobj), NULL);
+
+ return ATK_DOCUMENT (object->gobj);
+
+}
+
+static CORBA_string
+impl_getLocale (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ const gchar *lc;
+ AtkDocument *document = get_document_from_servant (servant);
+
+ g_return_val_if_fail (document != NULL, "");
+
+ lc = atk_document_get_locale (document);
+
+ if (lc)
+ return CORBA_string_dup (lc);
+ else
+ return CORBA_string_dup (""); /* Should we return 'C' by default? */
+}
+
+static CORBA_string
+impl_getAttributeValue (PortableServer_Servant servant,
+ const CORBA_char *attributename,
+ CORBA_Environment *ev){
+
+ const gchar *atr;
+
+ AtkDocument *document = get_document_from_servant (servant);
+
+ g_return_val_if_fail (document != NULL, "");
+
+ atr = atk_document_get_attribute_value (document, attributename);
+
+ if (atr)
+ return CORBA_string_dup (atr);
+ else
+ return CORBA_string_dup ("");
+}
+
+
+static CORBA_string
+impl_getAttributes (PortableServer_Servant servant,
+ CORBA_Environment *ev){
+
+ AtkDocument *document = get_document_from_servant (servant);
+ AtkAttributeSet *attributes = NULL;
+ Accessibility_AttributeSet *retval;
+ gint n_attributes = 0;
+ gint i;
+
+ g_return_val_if_fail (document != NULL, CORBA_string_dup (""));
+
+ attributes = atk_document_get_attributes (document);
+
+ bonobo_return_val_if_fail (attributes != NULL, NULL, ev);
+
+ bonobo_return_val_if_fail (attributes != NULL, NULL, ev);
+
+ /* according to atkobject.h, AtkAttributeSet is a GSList */
+ n_attributes = g_slist_length (attributes);
+
+ retval = CORBA_sequence_CORBA_string__alloc ();
+ retval->_length = retval->_maximum = n_attributes;
+ retval->_buffer = CORBA_sequence_CORBA_string_allocbuf (n_attributes);
+ CORBA_sequence_set_release (retval, CORBA_TRUE);
+
+ for (i = 0; i < n_attributes; ++i)
+ {
+ retval->_buffer[i] = CORBA_string_dup (g_slist_nth_data (attributes, i));
+ }
+
+ atk_attribute_set_free (attributes);
+
+ return retval;
+
+}
+
+
+static void
+spi_document_class_init (SpiDocumentClass *klass)
+{
+
+
+ POA_Accessibility_Document__epv *epv = &klass->epv;
+
+ epv->getLocale = impl_getLocale;
+ epv->getAttributeValue = impl_getAttributeValue;
+ epv->getAttributes = impl_getAttributes;
+
+}
+
+static void
+spi_document_init (SpiDocument *document)
+{
+}
+BONOBO_TYPE_FUNC_FULL (SpiDocument,
+ Accessibility_Document,
+ SPI_TYPE_BASE,
+ spi_document)
--- /dev/null
+/*
+ * AT-SPI - Assistive Technology Service Provider Interface
+ * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
+ *
+ * Copyright 2001, 2002 Sun Microsystems Inc.,
+ * Copyright 2001, 2002 Ximian, Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef SPI_DOCUMENT_H_
+#define SPI_DOCUMENT_H_
+
+#include <libspi/base.h>
+#include <atk/atkdocument.h>
+
+G_BEGIN_DECLS
+
+#define SPI_DOCUMENT_TYPE (spi_document_get_type ())
+#define SPI_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SPI_DOCUMENT_TYPE, SpiDocument))
+#define SPI_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SPI_DOCUMENT_TYPE, SpiDocumentClass))
+#define IS_DOCUMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj, SPI_DOCUMENT_TYPE))
+#define IS_DOCUMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SPI_DOCUMENT_TYPE))
+
+typedef struct _SpiDocument SpiDocument;
+typedef struct _SpiDocumentClass SpiDocumentClass;
+
+struct _SpiDocument {
+ SpiBase parent;
+};
+
+struct _SpiDocumentClass {
+ SpiBaseClass parent_class;
+ POA_Accessibility_Document__epv epv;
+};
+
+GType spi_document_get_type (void);
+void spi_document_construct (SpiDocument *document,
+ AtkObject *obj);
+SpiDocument *spi_document_interface_new (AtkObject *obj);
+
+G_END_DECLS
+
+#endif /* SPI_DOCUMENT_H_ */
#include <libspi/action.h>
#include <libspi/application.h>
#include <libspi/component.h>
+#include <libspi/document.h>
#include <libspi/editabletext.h>
#include <libspi/hyperlink.h>
#include <libspi/hypertext.h>