2 import com
.sun
.star
.uno
.UnoRuntime
;
3 import com
.sun
.star
.accessibility
.XAccessibleContext
;
4 import com
.sun
.star
.accessibility
.XAccessibleTable
;
7 class AccessibleTableHandler
extends NodeHandler
9 public NodeHandler
createHandler (XAccessibleContext xContext
)
11 XAccessibleTable xTable
=
12 (XAccessibleTable
) UnoRuntime
.queryInterface (
13 XAccessibleTable
.class, xContext
);
15 return new AccessibleTableHandler (xTable
);
20 public AccessibleTableHandler ()
24 public AccessibleTableHandler (XAccessibleTable xTable
)
27 maChildList
.setSize (4);
30 protected static XAccessibleTable
getTable(Object aObject
)
32 return (XAccessibleTable
) UnoRuntime
.queryInterface (
33 XAccessibleTable
.class, aObject
);
36 public AccessibleTreeNode
createChild (AccessibleTreeNode aParent
, int nIndex
)
38 AccessibleTreeNode aChild
= null;
39 XAccessibleTable xTable
= null;
40 if (aParent
instanceof AccTreeNode
)
41 xTable
= ((AccTreeNode
)aParent
).getTable();
49 aChild
= new StringNode ("# table rows: " + xTable
.getAccessibleRowCount(), aParent
);
52 aChild
= new StringNode ("# table columns: " + xTable
.getAccessibleColumnCount(), aParent
);
56 String sText
= "selected rows: ";
57 int[] aSelected
= xTable
.getSelectedAccessibleRows();
58 for( int i
=0; i
< aSelected
.length
; i
++ )
60 sText
+= aSelected
[i
];
63 aChild
= new StringNode (sText
, aParent
);
68 String sText
= "selected columns: ";
69 int[] aSelected
= xTable
.getSelectedAccessibleColumns();
70 for( int i
=0; i
< aSelected
.length
; i
++ )
72 sText
+= aSelected
[i
];
75 aChild
= new StringNode (sText
, aParent
);
79 aChild
= new StringNode ("unknown child index " + nIndex
, aParent
);
85 // Return empty child.