1*cdf0e10cSrcweir import com.sun.star.uno.UnoRuntime; 2*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleContext; 3*cdf0e10cSrcweir import com.sun.star.accessibility.XAccessibleExtendedComponent; 4*cdf0e10cSrcweir 5*cdf0e10cSrcweir 6*cdf0e10cSrcweir class AccessibleExtendedComponentHandler 7*cdf0e10cSrcweir extends NodeHandler 8*cdf0e10cSrcweir { 9*cdf0e10cSrcweir public NodeHandler createHandler (XAccessibleContext xContext) 10*cdf0e10cSrcweir { 11*cdf0e10cSrcweir XAccessibleExtendedComponent xEComponent = 12*cdf0e10cSrcweir (XAccessibleExtendedComponent) UnoRuntime.queryInterface ( 13*cdf0e10cSrcweir XAccessibleExtendedComponent.class, xContext); 14*cdf0e10cSrcweir if (xEComponent != null) 15*cdf0e10cSrcweir return new AccessibleExtendedComponentHandler (xEComponent); 16*cdf0e10cSrcweir else 17*cdf0e10cSrcweir return null; 18*cdf0e10cSrcweir } 19*cdf0e10cSrcweir 20*cdf0e10cSrcweir public AccessibleExtendedComponentHandler () 21*cdf0e10cSrcweir { 22*cdf0e10cSrcweir } 23*cdf0e10cSrcweir 24*cdf0e10cSrcweir public AccessibleExtendedComponentHandler (XAccessibleExtendedComponent xEComponent) 25*cdf0e10cSrcweir { 26*cdf0e10cSrcweir if (xEComponent != null) 27*cdf0e10cSrcweir maChildList.setSize (0); 28*cdf0e10cSrcweir } 29*cdf0e10cSrcweir 30*cdf0e10cSrcweir private static XAccessibleExtendedComponent getComponent (AccTreeNode aNode) 31*cdf0e10cSrcweir { 32*cdf0e10cSrcweir return (XAccessibleExtendedComponent) UnoRuntime.queryInterface ( 33*cdf0e10cSrcweir XAccessibleExtendedComponent.class, 34*cdf0e10cSrcweir aNode.getContext()); 35*cdf0e10cSrcweir } 36*cdf0e10cSrcweir 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir public AccessibleTreeNode createChild (AccessibleTreeNode aParent, int nIndex) 39*cdf0e10cSrcweir { 40*cdf0e10cSrcweir AccessibleTreeNode aChild = null; 41*cdf0e10cSrcweir if (aParent instanceof AccTreeNode) 42*cdf0e10cSrcweir { 43*cdf0e10cSrcweir XAccessibleExtendedComponent xEComponent = getComponent ((AccTreeNode)aParent); 44*cdf0e10cSrcweir 45*cdf0e10cSrcweir if (xEComponent != null) 46*cdf0e10cSrcweir { 47*cdf0e10cSrcweir int nColor; 48*cdf0e10cSrcweir switch( nIndex ) 49*cdf0e10cSrcweir { 50*cdf0e10cSrcweir case 0: 51*cdf0e10cSrcweir nColor = xEComponent.getForeground(); 52*cdf0e10cSrcweir aChild = new StringNode ("Depricated Foreground color: R" 53*cdf0e10cSrcweir + (nColor>>16&0xff) 54*cdf0e10cSrcweir + "G" + (nColor>>8&0xff) 55*cdf0e10cSrcweir + "B" + (nColor>>0&0xff) 56*cdf0e10cSrcweir + "A" + (nColor>>24&0xff), 57*cdf0e10cSrcweir aParent); 58*cdf0e10cSrcweir break; 59*cdf0e10cSrcweir case 1: 60*cdf0e10cSrcweir nColor = xEComponent.getBackground(); 61*cdf0e10cSrcweir aChild = new StringNode ("Depricated Background color: R" 62*cdf0e10cSrcweir + (nColor>>16&0xff) 63*cdf0e10cSrcweir + "G" + (nColor>>8&0xff) 64*cdf0e10cSrcweir + "B" + (nColor>>0&0xff) 65*cdf0e10cSrcweir + "A" + (nColor>>24&0xff), 66*cdf0e10cSrcweir aParent); 67*cdf0e10cSrcweir break; 68*cdf0e10cSrcweir } 69*cdf0e10cSrcweir } 70*cdf0e10cSrcweir } 71*cdf0e10cSrcweir return aChild; 72*cdf0e10cSrcweir } 73*cdf0e10cSrcweir } 74