2 import com
.sun
.star
.uno
.UnoRuntime
;
3 import com
.sun
.star
.accessibility
.XAccessibleContext
;
4 import com
.sun
.star
.accessibility
.XAccessibleComponent
;
7 class AccessibleComponentHandler
11 public NodeHandler
createHandler (XAccessibleContext xContext
)
13 XAccessibleComponent xComponent
=
14 (XAccessibleComponent
) UnoRuntime
.queryInterface (
15 XAccessibleComponent
.class, xContext
);
16 if (xComponent
!= null)
17 return new AccessibleComponentHandler (xComponent
);
23 public AccessibleComponentHandler ()
27 public AccessibleComponentHandler (XAccessibleComponent xComponent
)
29 if (xComponent
!= null)
30 maChildList
.setSize (6);
33 public AccessibleTreeNode
createChild (AccessibleTreeNode aParent
, int nIndex
)
35 AccessibleTreeNode aChild
= null;
36 if (aParent
instanceof AccTreeNode
)
38 XAccessibleComponent xComponent
=
39 ((AccTreeNode
)aParent
).getComponent();
41 if (xComponent
!= null)
47 com
.sun
.star
.awt
.Point aLocation
= xComponent
.getLocation();
48 aChild
= new StringNode (
49 "Location: " + aLocation
.X
+ ", " + aLocation
.Y
,
53 com
.sun
.star
.awt
.Point aScreenLocation
= xComponent
.getLocationOnScreen();
54 aChild
= new StringNode (
55 "Location on Screen: " + aScreenLocation
.X
+ ", " + aScreenLocation
.Y
,
59 com
.sun
.star
.awt
.Size aSize
= xComponent
.getSize();
60 aChild
= new StringNode (
61 "Size: "+ aSize
.Width
+ ", " + aSize
.Height
,
65 com
.sun
.star
.awt
.Rectangle aBBox
= xComponent
.getBounds();
66 aChild
= new StringNode (
67 "Bounding Box: "+ aBBox
.X
+ ", " + aBBox
.Y
+ ","
68 + aBBox
.Width
+ ", " + aBBox
.Height
,
72 nColor
= xComponent
.getForeground();
73 aChild
= new StringNode ("Foreground color: R"
75 + "G" + (nColor
>>8&0xff)
76 + "B" + (nColor
>>0&0xff)
77 + "A" + (nColor
>>24&0xff),
81 nColor
= xComponent
.getBackground();
82 aChild
= new StringNode ("Background color: R"
84 + "G" + (nColor
>>8&0xff)
85 + "B" + (nColor
>>0&0xff)
86 + "A" + (nColor
>>24&0xff),
95 public void update (AccessibleTreeNode aNode
)
98 if (aNode
instanceof AccTreeNode
)
99 if (((AccTreeNode
)aNode
).getComponent() != null)
100 maChildList
.setSize (4);