xref: /AOO41X/main/toolkit/test/accessibility/AccessibleHypertextHandler.java (revision cdf0e10c4e3984b49a9502b011690b615761d4a3)
1*cdf0e10cSrcweir 
2*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime;
3*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext;
4*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleHypertext;
5*cdf0e10cSrcweir 
6*cdf0e10cSrcweir 
7*cdf0e10cSrcweir class AccessibleHypertextHandler extends AccessibleTreeHandler
8*cdf0e10cSrcweir {
9*cdf0e10cSrcweir     public NodeHandler createHandler (XAccessibleContext xContext)
10*cdf0e10cSrcweir     {
11*cdf0e10cSrcweir         XAccessibleHypertext xText =
12*cdf0e10cSrcweir             (XAccessibleHypertext) UnoRuntime.queryInterface (
13*cdf0e10cSrcweir                 XAccessibleHypertext.class, xContext);
14*cdf0e10cSrcweir         if (xText != null)
15*cdf0e10cSrcweir             return new AccessibleHypertextHandler (xText);
16*cdf0e10cSrcweir         else
17*cdf0e10cSrcweir             return null;
18*cdf0e10cSrcweir     }
19*cdf0e10cSrcweir 
20*cdf0e10cSrcweir     public AccessibleHypertextHandler ()
21*cdf0e10cSrcweir     {
22*cdf0e10cSrcweir     }
23*cdf0e10cSrcweir 
24*cdf0e10cSrcweir     public AccessibleHypertextHandler (XAccessibleHypertext xText)
25*cdf0e10cSrcweir     {
26*cdf0e10cSrcweir         if (xText != null)
27*cdf0e10cSrcweir             maChildList.setSize (1);
28*cdf0e10cSrcweir     }
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir     protected static XAccessibleHypertext getHypertext (AccTreeNode aNode)
31*cdf0e10cSrcweir     {
32*cdf0e10cSrcweir         XAccessibleHypertext xHypertext =
33*cdf0e10cSrcweir             (XAccessibleHypertext) UnoRuntime.queryInterface (
34*cdf0e10cSrcweir                  XAccessibleHypertext.class, aNode.getContext());
35*cdf0e10cSrcweir         return xHypertext;
36*cdf0e10cSrcweir     }
37*cdf0e10cSrcweir 
38*cdf0e10cSrcweir     public AccessibleTreeNode getChild (AccessibleTreeNode aParent, int nIndex)
39*cdf0e10cSrcweir     {
40*cdf0e10cSrcweir         return new StringNode ("interface XAccessibleHypertext is supported", aParent);
41*cdf0e10cSrcweir     }
42*cdf0e10cSrcweir }
43