/* 
 * AT-SPI - Assistive Technology Service Provider Interface 
 * (Gnome Accessibility Project; http://developer.gnome.org/projects/gap)
 *
 * Copyright 2001 Sun Microsystems, 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 <Accessibility_Accessible.idl>

module Accessibility {

  /**
   * Instances of Hyperlink are returned by Hypertext objects, and are
   * the means by which end users and clients interact with linked, and in
   * some cases embedded, content.  Hyperlinks may have multiple "anchors",
   * where an anchor corresponds to a reference to a particular resource with
   * a corresponding resource identified (URI).  Hyperlinks may be 
   * queried for their URIs, or queried for the objects corresponding to their
   * anchors.  The objects thus obtained are instances of Accessible,
   * and may be queried, and manipulated via the Action interface. 
   *
   * @note A Hyperlink implementor is normally NOT an Accessible; 
   * the preferred usage is for a Hyperlink's associated "objects"
   * (accessed via the ::getObject method) are Accessibles.  This means
   * that Actions such as "open link" are normally invoked on
   * the result of Hyperlink::getObject rather than directly on the 
   * Hyperlink instance. For historical reasons some implementors of Hyperlink
   * implement Action as well.  This usage on the part of implementing
   * applications and toolkits is discouraged, but clients of Hyperlink
   * should be aware of it and prepared to handle such usage.
   */
  interface Hyperlink : Bonobo::Unknown {
    /** the number of separate anchors associated with this Hyperlink */
    readonly attribute short nAnchors;
    /** 
     * the starting offset within the containing Hypertext content 
     * with which this Hyperlink is associated 
     */
    readonly attribute long startIndex;
    /** 
     * the ending offset within the containing Hypertext content 
     * with which this Hyperlink is associated; that is, the offset of the
     * first element past the range within the Hypertext associated with
     * this Hyperlink. 
     */
    readonly attribute long endIndex;
    /** 
     * Gets the i'th object, (where i is an integer between 0 and
     * Hyperlink::numAnchors - 1, inclusive) associated with a Hyperlink.
     * The objects returned are usually actionable (i.e. they should implement
     * Accessibility::Action), and the available actions often include
     * "open", "bookmark", "save link as", etc.  They may also implement
     * Accessibility::StreamableContent, although clients can normally use 
     * ::getURI to obtain a resource locator via which the object's
     * data may be accessed.
     * 
     * @note the most common application for 'multi anchor'
     * hyperlinks in HTML is probably "client side imagemaps".
     * A clickable image which uses the HTML 'usemap' attribute
     * should have one anchor for every &lt;area&gt; element that
     * includes an HREF.  The objects corresponding to these map
     * areas may implement Accessibility::Component, to represent
     * their onscreen bounding box, and may expose their 'shape' as
     * as name-value pair via Accessibility::Accessible::getAttributeSet.
     *
     * @returns an Accessible object instance representing the
     * Hyperlink's ith anchor, or through which the content associated with
     * the \c ith anchor can be
     * accessed.
     */
    Accessible getObject (in long i);
    /** 
     * Obtain a resource locator ('URI') which can be used to 
     * access the content to which this link "points" or is connected.
     * @returns a string corresponding to the URI of the Hyperlink's
     * 'ith' anchor, if one exists, or a NIL string otherwise.
     */
    string getURI (in long i);
    /** 
     * Check the hyperlink to see if a connection to its backing
     * content can be established, or if its URI is valid.
     * @note instances of invalid hyperlinks include links with malformed
     *       URIs, or for which a contact to the service provider
     *       specified in the URI cannot be established.
     * @returns \c True if the object's content is available, or
     *          \c False if the hyperlink's URI is invalid, or 
     *          a connection to the resource can not be established.
     */
    boolean isValid ();
    /** \cond
     * unImplemented:
     *
     * placeholders for future expansion.
     */
    void unImplemented ();
    void unImplemented2 ();
    void unImplemented3 ();
    void unImplemented4 ();
    /** \endcond */
  };
};
