1 import com.sun.star.uno.UnoRuntime;
2 import com.sun.star.accessibility.XAccessibleContext;
3 import com.sun.star.accessibility.XAccessibleExtendedComponent;
4 
5 
6 class AccessibleExtendedComponentHandler
7     extends NodeHandler
8 {
9     public NodeHandler createHandler (XAccessibleContext xContext)
10     {
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;
18     }
19 
20     public AccessibleExtendedComponentHandler ()
21     {
22     }
23 
24     public AccessibleExtendedComponentHandler (XAccessibleExtendedComponent xEComponent)
25     {
26         if (xEComponent != null)
27             maChildList.setSize (0);
28     }
29 
30     private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode)
31     {
32         return (XAccessibleExtendedComponent) UnoRuntime.queryInterface (
33             XAccessibleExtendedComponent.class,
34             aNode.getContext());
35     }
36 
37 
38     public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex)
39     {
40         AccessibleTreeNode aChild = null;
41         if (aParent instanceof AccTreeNode)
42         {
43             XAccessibleExtendedComponent xEComponent = getComponent ((AccTreeNode)aParent);
44 
45             if (xEComponent != null)
46             {
47                 int nColor;
48                 switch( nIndex )
49                 {
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;
68                 }
69             }
70         }
71         return aChild;
72     }
73 }
74