1 import com
.sun
.star
.uno
.UnoRuntime
;
2 import com
.sun
.star
.accessibility
.XAccessible
;
3 import com
.sun
.star
.accessibility
.XAccessibleContext
;
4 import com
.sun
.star
.accessibility
.AccessibleRelation
;
5 import com
.sun
.star
.accessibility
.XAccessibleRelationSet
;
6 import com
.sun
.star
.accessibility
.AccessibleRelationType
;
7 import com
.sun
.star
.lang
.XServiceInfo
;
8 import com
.sun
.star
.lang
.XTypeProvider
;
9 import com
.sun
.star
.uno
.Type
;
12 /** This handler displays lower level UNO information. These are the
13 supported services, interfaces, and the implementation name.
15 class AccessibleUNOHandler
18 public NodeHandler
createHandler (XAccessibleContext xContext
)
23 return new AccessibleUNOHandler (xContext
);
26 public AccessibleUNOHandler()
30 public AccessibleUNOHandler (XAccessibleContext xContext
)
32 maChildList
.setSize (3);
35 private XServiceInfo
GetServiceInfo (AccessibleTreeNode aNode
)
37 XServiceInfo xServiceInfo
= null;
38 if (aNode
instanceof AccTreeNode
)
39 xServiceInfo
= (XServiceInfo
)UnoRuntime
.queryInterface(
40 XServiceInfo
.class, ((AccTreeNode
)aNode
).getContext());
43 private XTypeProvider
GetTypeProvider (AccessibleTreeNode aNode
)
45 XTypeProvider xTypeProvider
= null;
46 if (aNode
instanceof AccTreeNode
)
47 xTypeProvider
= (XTypeProvider
)UnoRuntime
.queryInterface(
48 XTypeProvider
.class, ((AccTreeNode
)aNode
).getContext());
52 public AccessibleTreeNode
createChild (AccessibleTreeNode aParent
,
55 AccessibleTreeNode aChild
= null;
56 XServiceInfo xServiceInfo
;
59 case 0 : // Implemenation name.
60 xServiceInfo
= GetServiceInfo (aParent
);
61 aChild
= new StringNode ("Implementation name: " +
62 (xServiceInfo
!=null ? xServiceInfo
.getImplementationName()
63 : "<XServiceInfo not supported>"),
67 xServiceInfo
= GetServiceInfo (aParent
);
68 if (xServiceInfo
== null)
69 aChild
= new StringNode (
70 "Supported services: <XServiceInfo not supported>",
73 aChild
= CreateServiceTree (aParent
, xServiceInfo
);
76 XTypeProvider xTypeProvider
= GetTypeProvider (aParent
);
77 if (xTypeProvider
== null)
78 aChild
= new StringNode (
79 "Supported interfaces: <XTypeProvider not supported>",
82 aChild
= CreateInterfaceTree (aParent
, xTypeProvider
);
90 private AccessibleTreeNode
CreateServiceTree (AccessibleTreeNode aParent
,
91 XServiceInfo xServiceInfo
)
93 String
[] aServiceNames
= xServiceInfo
.getSupportedServiceNames();
94 VectorNode aNode
= new VectorNode ("Supported Services", aParent
);
96 int nCount
= aServiceNames
.length
;
97 for (int i
=0; i
<nCount
; i
++)
98 aNode
.addChild (new StringNode (aServiceNames
[i
], aParent
));
103 private AccessibleTreeNode
CreateInterfaceTree (AccessibleTreeNode aParent
,
104 XTypeProvider xTypeProvider
)
106 Type
[] aTypes
= xTypeProvider
.getTypes();
107 VectorNode aNode
= new VectorNode ("Supported Interfaces", aParent
);
109 int nCount
= aTypes
.length
;
110 for (int i
=0; i
<nCount
; i
++)
111 aNode
.addChild (new StringNode (aTypes
[i
].getTypeName(), aParent
));