merged tag ooo/DEV300_m102
[LibreOffice.git] / toolkit / test / accessibility / AccessibleImageHandler.java
blob92917e1b97404446e475ba3a572c436dbd6cef7c
2 import com.sun.star.uno.UnoRuntime;
3 import com.sun.star.accessibility.XAccessibleContext;
4 import com.sun.star.accessibility.XAccessibleImage;
7 class AccessibleImageHandler extends NodeHandler
9 public NodeHandler createHandler (XAccessibleContext xContext)
11 XAccessibleImage xImage =
12 (XAccessibleImage) UnoRuntime.queryInterface (
13 XAccessibleImage.class, xContext);
14 if (xImage != null)
15 return new AccessibleImageHandler (xImage);
16 else
17 return null;
20 public AccessibleImageHandler ()
24 public AccessibleImageHandler (XAccessibleImage xImage)
26 if (xImage != null)
27 maChildList.setSize (1);
30 protected static XAccessibleImage getImage (AccTreeNode aNode)
32 return (XAccessibleImage) UnoRuntime.queryInterface (
33 XAccessibleImage.class, aNode.getContext());
36 public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
38 if (aParent instanceof AccTreeNode)
40 XAccessibleImage xImage = getImage ((AccTreeNode)aParent);
41 if (xImage != null)
42 return new StringNode (
43 "Image: " +
44 xImage.getAccessibleImageDescription() + " (" +
45 xImage.getAccessibleImageWidth() + "x" +
46 xImage.getAccessibleImageHeight() + ")",
47 aParent);
49 return null;