return null;
}
case AccessibleText.WORD:
try {
String s = unoObject.getText();
BreakIterator words = BreakIterator.getWordInstance(getLocale(index));
words.setText(s);
int start = words.following(index);
if (start == BreakIterator.DONE || start >= s.length()) {
return null;
}
int end = words.following(start);
if (end == BreakIterator.DONE || end >= s.length()) {
return null;
}
return s.substring(start, end);
} catch (IllegalArgumentException e) {
return null;
} catch (IndexOutOfBoundsException e) {
return null;
}
case AccessibleText.SENTENCE:
try {
String s = unoObject.getText();
BreakIterator sentence =
BreakIterator.getSentenceInstance(getLocale(index));
sentence.setText(s);
int start = sentence.following(index);
if (start == BreakIterator.DONE || start >= s.length()) {
return null;
}
int end = sentence.following(start);
if (end == BreakIterator.DONE || end >= s.length()) {
return null;
}
return s.substring(start, end);
} catch (IllegalArgumentException e) {