xref: /AOO41X/main/toolkit/test/accessibility/AccessibleEditableTextHandler.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.XAccessibleEditableText;
5*cdf0e10cSrcweir 
6*cdf0e10cSrcweir 
7*cdf0e10cSrcweir class AccessibleEditableTextHandler extends NodeHandler
8*cdf0e10cSrcweir {
9*cdf0e10cSrcweir     public NodeHandler createHandler (XAccessibleContext xContext)
10*cdf0e10cSrcweir     {
11*cdf0e10cSrcweir         XAccessibleEditableText xText =
12*cdf0e10cSrcweir             (XAccessibleEditableText) UnoRuntime.queryInterface (
13*cdf0e10cSrcweir                 XAccessibleEditableText.class, xContext);
14*cdf0e10cSrcweir         if (xText != null)
15*cdf0e10cSrcweir             return new AccessibleEditableTextHandler (xText);
16*cdf0e10cSrcweir         else
17*cdf0e10cSrcweir             return null;
18*cdf0e10cSrcweir     }
19*cdf0e10cSrcweir 
20*cdf0e10cSrcweir     public AccessibleEditableTextHandler ()
21*cdf0e10cSrcweir     {
22*cdf0e10cSrcweir     }
23*cdf0e10cSrcweir 
24*cdf0e10cSrcweir     public AccessibleEditableTextHandler (XAccessibleEditableText xText)
25*cdf0e10cSrcweir     {
26*cdf0e10cSrcweir         if (xText != null)
27*cdf0e10cSrcweir             maChildList.setSize (1);
28*cdf0e10cSrcweir     }
29*cdf0e10cSrcweir 
30*cdf0e10cSrcweir     protected static XAccessibleEditableText getEText (AccTreeNode aNode)
31*cdf0e10cSrcweir     {
32*cdf0e10cSrcweir         return (XAccessibleEditableText) UnoRuntime.queryInterface (
33*cdf0e10cSrcweir             XAccessibleEditableText.class, aNode.getContext());
34*cdf0e10cSrcweir     }
35*cdf0e10cSrcweir 
36*cdf0e10cSrcweir     public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
37*cdf0e10cSrcweir     {
38*cdf0e10cSrcweir         return new StringNode ("XAccessibleEditableText is supported", aParent);
39*cdf0e10cSrcweir     }
40*cdf0e10cSrcweir }
41