Kaydet (Commit) 347fc35a authored tarafından Ivo Hinkelmann's avatar Ivo Hinkelmann

INTEGRATION: CWS qadev29 (1.10.36); FILE MERGED

2007/04/24 10:08:42 cn 1.10.36.2: #i74690#:new method "getSheetCell()"
2007/04/23 13:23:24 cn 1.10.36.1: #i74190# new method getSheetCell()
üst 42c656fa
......@@ -4,9 +4,9 @@
*
* $RCSfile: AccessibilityTools.java,v $
*
* $Revision: 1.10 $
* $Revision: 1.11 $
*
* last change: $Author: rt $ $Date: 2005-09-08 17:31:05 $
* last change: $Author: ihi $ $Date: 2007-06-04 13:31:30 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
......@@ -37,11 +37,8 @@ package util;
import com.sun.star.accessibility.XAccessible;
import com.sun.star.accessibility.XAccessibleComponent;
import com.sun.star.accessibility.XAccessibleContext;
import com.sun.star.accessibility.XAccessibleRelationSet;
import com.sun.star.accessibility.XAccessibleStateSet;
import com.sun.star.awt.XWindow;
import com.sun.star.frame.XController;
import com.sun.star.frame.XDesktop;
import com.sun.star.frame.XFrame;
import com.sun.star.frame.XModel;
import com.sun.star.lang.XMultiServiceFactory;
......@@ -300,6 +297,55 @@ public class AccessibilityTools {
return null;
}
/**
* This methods retunrs the <CODE>XAccessibleContext</CODE> of a named Sheet-Cell like "G5".<p>
* @param xSheetAcc The <CODE>XAccessibleContext</CODE> of a Sheet
* @param cellName The name of a cell like "A5"
* @return the <CODE>XAccessiblecontext</CODE> of the named cell
*/
public static XAccessibleContext getSheetCell(XAccessibleContext xSheetAcc, String cellName){
int cellIndex = 0;
int column =0;
int charMem = 0;
for (int n=0; n<cellName.length(); n++){
String cha = cellName.substring(n,n+1);
System.out.println("char: " + cha + " ");
byte[] bytes = cha.getBytes();
if ((bytes[0] >= 'A') && (bytes[0] <= 'Z')){
charMem = bytes[0]-64;
column++;
if ( column == 2 ){
cellIndex += charMem * 26;
}
cellIndex= cellIndex+ (bytes[0]-65);
} else {
String sNumb = cellName.substring(n, cellName.length());
int iNumb = new Integer(0).valueOf(sNumb).intValue();
cellIndex += (iNumb-1) * 256;
System.out.println("numb:" + (iNumb-1) * 256);
}
}
//System.out.println("cellName: " + cellName + " cellIndex: " + cellIndex);
try {
XAccessibleContext ac = xSheetAcc.getAccessibleChild(cellIndex).getAccessibleContext();
System.out.println(ac.getAccessibleRole() + "," +
ac.getAccessibleName() + "(" +
ac.getAccessibleDescription() + "):" +
utils.getImplName(ac));
return ac;
} catch (com.sun.star.lang.IndexOutOfBoundsException ex) {
System.out.println("ERROR: could not get child at index " + cellIndex +"': " + ex.toString());
return null;
}
}
public static void printAccessibleTree(PrintWriter log, XAccessible xacc, boolean debugIsActive) {
debug = debugIsActive;
if (debug) printAccessibleTree(log, xacc, "");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment