merge the formfield patch from ooo-build
[ooovba.git] / toolkit / test / accessibility / AccessibleExtendedComponentHandler.java
blob3336175d2d22b24d853891725224ddef360d5c1d
1 import com.sun.star.uno.UnoRuntime;
2 import com.sun.star.accessibility.XAccessibleContext;
3 import com.sun.star.accessibility.XAccessibleExtendedComponent;
6 class AccessibleExtendedComponentHandler
7 extends NodeHandler
9 public NodeHandler createHandler (XAccessibleContext xContext)
11 XAccessibleExtendedComponent xEComponent =
12 (XAccessibleExtendedComponent) UnoRuntime.queryInterface (
13 XAccessibleExtendedComponent.class, xContext);
14 if (xEComponent != null)
15 return new AccessibleExtendedComponentHandler (xEComponent);
16 else
17 return null;
20 public AccessibleExtendedComponentHandler ()
24 public AccessibleExtendedComponentHandler (XAccessibleExtendedComponent xEComponent)
26 if (xEComponent != null)
27 maChildList.setSize (0);
30 private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode)
32 return (XAccessibleExtendedComponent) UnoRuntime.queryInterface (
33 XAccessibleExtendedComponent.class,
34 aNode.getContext());
38 public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
40 AccessibleTreeNode aChild = null;
41 if (aParent instanceof AccTreeNode)
43 XAccessibleExtendedComponent xEComponent = getComponent ((AccTreeNode)aParent);
45 if (xEComponent != null)
47 int nColor;
48 switch( nIndex )
50 case 0:
51 nColor = xEComponent.getForeground();
52 aChild = new StringNode ("Depricated Foreground color: R"
53 + (nColor>>16&0xff)
54 + "G" + (nColor>>8&0xff)
55 + "B" + (nColor>>0&0xff)
56 + "A" + (nColor>>24&0xff),
57 aParent);
58 break;
59 case 1:
60 nColor = xEComponent.getBackground();
61 aChild = new StringNode ("Depricated Background color: R"
62 + (nColor>>16&0xff)
63 + "G" + (nColor>>8&0xff)
64 + "B" + (nColor>>0&0xff)
65 + "A" + (nColor>>24&0xff),
66 aParent);
67 break;
71 return aChild;