2 import com
.sun
.star
.uno
.UnoRuntime
;
3 import com
.sun
.star
.accessibility
.XAccessibleContext
;
4 import com
.sun
.star
.accessibility
.XAccessibleTable
;
5 import com
.sun
.star
.accessibility
.XAccessible
;
8 class AccessibleCellHandler
extends NodeHandler
10 public NodeHandler
createHandler (XAccessibleContext xContext
)
12 AccessibleCellHandler aCellHandler
= null;
15 XAccessible xParent
= xContext
.getAccessibleParent();
18 XAccessibleTable xTable
=
19 (XAccessibleTable
) UnoRuntime
.queryInterface (
20 XAccessibleTable
.class, xParent
.getAccessibleContext());
22 aCellHandler
= new AccessibleCellHandler (xTable
);
29 public AccessibleCellHandler ()
33 public AccessibleCellHandler (XAccessibleTable xTable
)
36 maChildList
.setSize (8);
39 protected static XAccessibleTable
getTable(Object aObject
)
41 return (XAccessibleTable
) UnoRuntime
.queryInterface (
42 XAccessibleTable
.class, aObject
);
45 public AccessibleTreeNode
createChild (AccessibleTreeNode aParent
, int nIndex
)
47 AccessibleTreeNode aChild
= null;
48 XAccessibleTable xTable
= null;
49 XAccessibleContext xContext
= null;
50 AccessibleTreeNode aGrandParent
= aParent
.getParent();
51 if (aGrandParent
instanceof AccTreeNode
)
53 xTable
= ((AccTreeNode
)aGrandParent
).getTable();
54 xContext
= ((AccTreeNode
)aGrandParent
).getContext();
56 if (aParent
instanceof AccTreeNode
)
58 xContext
= ((AccTreeNode
)aParent
).getContext();
62 if( xTable
!= null && xContext
!= null )
68 int nChild
= xContext
.getAccessibleIndexInParent();
69 int nRow
= xTable
.getAccessibleRow( nChild
);
71 aChild
= new StringNode ("# table row: " + nRow
, aParent
);
76 int nChild
= xContext
.getAccessibleIndexInParent();
77 int nCol
= xTable
.getAccessibleColumn( nChild
);
79 aChild
= new StringNode ("# table column: " + nCol
, aParent
);
84 int nChild
= xContext
.getAccessibleIndexInParent();
85 int nRow
= xTable
.getAccessibleRow( nChild
);
86 int nCol
= xTable
.getAccessibleColumn( nChild
);
87 int nExt
= xTable
.getAccessibleRowExtentAt( nRow
, nCol
);
89 aChild
= new StringNode ("# table row extend: " + nExt
, aParent
);
94 int nChild
= xContext
.getAccessibleIndexInParent();
95 int nRow
= xTable
.getAccessibleRow( nChild
);
96 int nCol
= xTable
.getAccessibleColumn( nChild
);
97 int nExt
= xTable
.getAccessibleColumnExtentAt( nRow
, nCol
);
99 aChild
= new StringNode ("# table column extend: " + nExt
, aParent
);
104 int nChild
= xContext
.getAccessibleIndexInParent();
105 int nRow
= xTable
.getAccessibleRow( nChild
);
106 int nCol
= xTable
.getAccessibleColumn( nChild
);
108 xTable
.getAccessibleCellAt( nRow
, nCol
);
110 aChild
= new StringNode ("# cell name retrieved from table: " + xChild
.getAccessibleContext().getAccessibleName(), aParent
);
115 int nChild
= xContext
.getAccessibleIndexInParent();
116 int nRow
= xTable
.getAccessibleRow( nChild
);
117 int nCol
= xTable
.getAccessibleColumn( nChild
);
119 xTable
.isAccessibleSelected( nRow
, nCol
);
121 aChild
= new StringNode ("cell is selected: " + bSelected
, aParent
);
126 int nChild
= xContext
.getAccessibleIndexInParent();
127 int nRow
= xTable
.getAccessibleRow( nChild
);
129 xTable
.isAccessibleRowSelected( nRow
);
131 aChild
= new StringNode ("table row is selected: " + bSelected
, aParent
);
136 int nChild
= xContext
.getAccessibleIndexInParent();
137 int nCol
= xTable
.getAccessibleColumn( nChild
);
139 xTable
.isAccessibleColumnSelected( nCol
);
141 aChild
= new StringNode ("table column is selected: " + bSelected
, aParent
);
145 aChild
= new StringNode ("unknown child index " + nIndex
, aParent
);
151 // Return empty child.