IAccessibleHyperlink 编辑

other-licenses/ia2/AccessibleHyperlink.idlNot scriptable This interface represents hyperlinks. 1.0 66 Introduced Gecko 1.9 Inherits from: IAccessibleAction Last changed in Gecko 1.9 (Firefox 3)

This interface represents a hyperlink associated with a single substring of text or single non-text object. Non-text objects can have either a single link or a collection of links such as when the non-text object is an image map. Linked objects and anchors are implementation dependent. This interface is derived from IAccessibleAction. IAccessibleAction.nActions() is one greater than the maximum value for the indices used with the methods of this interface. Furthermore, the object that implements this interface has to be connected implicitly or explicitly with an object that implements IAccessibleText. startIndex() and endIndex() are indices with respect to the text exposed by IAccessibleText. This interface provides access to a single object which can have multiple actions. An example is an image map which is an image with multiple links each of which is associated with a separate non-overlapping area of the image. This interface could also be applied to other kinds of objects with multiple actions such as "smart tags" which are objects, typically strings, which have multiple actions such as "Activate URI", "Bookmark URI", end so on. An interesting use case is an image map where each area is associated with multiple actions, for example an image map of smart tags. In this case you would have to implement two levels of accessible hyperlinks. The first level hyperlinks would only implement anchor() and anchorTarget(). The anchors would all reference the image object. The anchorTargets would reference the second level accessible hyperlink objects. None of the IAccessibleAction methods would be implemented on the first level hyperlink objects. The second level hyperlink objects would implement the IAccessibleAction methods. Their anchors would also reference the image object and their anchorTargets would reference URLs or the objects that would be activated. This use case demonstrates that in some cases there is no need for IAccessibleHyperlink to derive from IAccessibleAction. As a result it may be removed in a later version of the IDL and it is suggested that implementations should not rely on the inheritance.

Method overview

[propget] HRESULT anchor([in] long index, [out] VARIANT anchor );
[propget] HRESULT anchorTarget([in] long index, [out] VARIANT anchorTarget );
[propget] HRESULT endIndex([out] long index );
[propget] HRESULT startIndex([out] long index );
[propget] HRESULT valid([out] boolean valid );

Methods

anchor()

Returns an object that represents the link anchor, as appropriate for the link at the specified index.

[propget] HRESULT anchor(
  [in] long index,
  [out] VARIANT anchor
);
Parameters
index
A 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. The valid maximal index is indicated by IAccessibleAction.nActions().
anchor
This is an implementation dependent value. For example, for a text link this method could return the substring of the containing string where the substring is overridden with link behavior, and for an image link this method could return an IUnknown VARIANT for IAccessibleImage. See the section about.
Return value

E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK.

anchorTarget()

Returns an object representing the target of the link, as appropriate for the link at the specified index.

[propget] HRESULT anchorTarget(
  [in] long index,
  [out] VARIANT anchorTarget
);
Parameters
index
A 0 based index identifies the anchor when, as in the case of an image map, there is more than one link represented by this object. The valid maximal index is indicated by IAccessibleAction.nActions().
anchorTarget
This is an implementation dependent value. For example this method could return a BSTR VARIANT of the URI. Alternatively this method could return an IUnknown VARIANT of a COM interface representing a target object to be activated when the link is activated. See the section about.
Return value

E_INVALIDARG if bad [in] passed, [out] value is null. S_FALSE if there is nothing to return, [out] value is null. S_OK.

endIndex()

[propget] HRESULT endIndex(
  [out] long index
);
Parameters
index
The 0 based character offset at which the textual representation of the hyperlink ends. The returned value is related to the IAccessibleText interface of the object that owns this hyperlink. The character at the index is not part of the hypertext.
Return value

S_OK.

startIndex()

[propget] HRESULT startIndex(
  [out] long index
);
Parameters
index
The 0 based character offset at which the textual representation of the hyperlink starts. The returned value is related to the IAccessibleText interface of the object that owns this hyperlink.
Return value

S_OK.

valid()

Returns whether the target object referenced by this link is still valid. This is a volatile state that may change without sending an appropriate event.

[propget] HRESULT valid(
  [out] boolean valid
);
Parameters
valid
true if the referenced target is still valid and false otherwise. This has also been used to indicate whether or not the URI of the anchorTarget is malformed.
Return value

S_FALSE if there is nothing to return, [out] value is false. S_OK.

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:64 次

字数:9950

最后编辑:7 年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文