Kaydet (Commit) f195f5c2 authored tarafından Vladimir Glazounov's avatar Vladimir Glazounov

INTEGRATION: CWS uaa03 (1.9.8); FILE MERGED

2003/05/16 11:20:05 obr 1.9.8.1: #i14510# getText[At/Before/After] now returns a TextSegment structure - first shot only to make it compile
üst 27c24708
...@@ -112,17 +112,17 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText { ...@@ -112,17 +112,17 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
try { try {
// the office returns an empty string when asking for the word at // the office returns an empty string when asking for the word at
// the position of a blank // the position of a blank
String s = unoObject.getTextBehindIndex(index, type); TextSegment ts = unoObject.getTextBehindIndex(index, type);
if ((part == AccessibleText.WORD) && (s.length() == 0)) { if ((part == AccessibleText.WORD) && (ts.SegmentText.length() == 0)) {
// int max = getCharCount(); // int max = getCharCount();
// for (int i=index; i < max; i++) { // for (int i=index; i < max; i++) {
// if (! unoObject.getTextBehindIndex(i, AccessibleTextType.CHARACTER).equals(" ")) // if (! unoObject.getTextBehindIndex(i, AccessibleTextType.CHARACTER).equals(" "))
// break; // break;
// s += " "; // s += " ";
// } // }
s = " "; ts.SegmentText = " ";
} }
return s; return ts.SegmentText;
} catch (com.sun.star.uno.Exception e) { } catch (com.sun.star.uno.Exception e) {
} }
} }
...@@ -401,17 +401,17 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText { ...@@ -401,17 +401,17 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
try { try {
// the office returns an empty string when asking for the word at // the office returns an empty string when asking for the word at
// the position of a blank // the position of a blank
String s = unoObject.getTextBeforeIndex(index, type); TextSegment ts = unoObject.getTextBeforeIndex(index, type);
if ((part == AccessibleText.WORD) && (s.length() == 0)) { if ((part == AccessibleText.WORD) && (ts.SegmentText.length() == 0)) {
// int max = getCharCount(); // int max = getCharCount();
// for (int i=index; i < max; i++) { // for (int i=index; i < max; i++) {
// if (! unoObject.getTextBeforeIndex(i, AccessibleTextType.CHARACTER).equals(" ")) // if (! unoObject.getTextBeforeIndex(i, AccessibleTextType.CHARACTER).equals(" "))
// break; // break;
// s += " "; // s += " ";
// } // }
s = " "; ts.SegmentText = " ";
} }
return s; return ts.SegmentText;
} catch (com.sun.star.uno.Exception e) { } catch (com.sun.star.uno.Exception e) {
if (Build.DEBUG) { if (Build.DEBUG) {
System.err.println(this + e .getClass().getName() + " caught in getBeforeIndex(" + part + ", " + index + "): "); System.err.println(this + e .getClass().getName() + " caught in getBeforeIndex(" + part + ", " + index + "): ");
...@@ -429,27 +429,27 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText { ...@@ -429,27 +429,27 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
try { try {
// the office returns an empty string when asking for the word at // the office returns an empty string when asking for the word at
// the position of a blank // the position of a blank
String s = unoObject.getTextAtIndex(index, type); TextSegment ts = unoObject.getTextAtIndex(index, type);
if ((part == AccessibleText.WORD) && (s.length() == 0)) { if ((part == AccessibleText.WORD) && (ts.SegmentText.length() == 0)) {
// int max = getCharCount(); // int max = getCharCount();
// for (int i=index; i < max; i++) { // for (int i=index; i < max; i++) {
// if (! unoObject.getTextAtIndex(i, AccessibleTextType.CHARACTER).equals(" ")) // if (! unoObject.getTextAtIndex(i, AccessibleTextType.CHARACTER).equals(" "))
// break; // break;
// s += " "; // s += " ";
// } // }
s = " "; ts.SegmentText = " ";
// Workaround for #104847# // Workaround for #104847#
} else if ((type == AccessibleTextType.LINE) && (s.length() == 0)) { } else if ((type == AccessibleTextType.LINE) && (ts.SegmentText.length() == 0)) {
if (index == getCharCount()) { if (index == getCharCount()) {
s = unoObject.getTextAtIndex(index - 1, type); ts = unoObject.getTextAtIndex(index - 1, type);
} }
} }
// if (Build.DEBUG) { // if (Build.DEBUG) {
// System.err.println(this + " getAtIndex(" + part + "," + index + ") returns " + s + " (length: " + s.length() + ")"); // System.err.println(this + " getAtIndex(" + part + "," + index + ") returns " + s + " (length: " + s.length() + ")");
// } // }
return s; return ts.SegmentText;
} catch (com.sun.star.lang.IndexOutOfBoundsException e) { } catch (com.sun.star.lang.IndexOutOfBoundsException e) {
if (Build.DEBUG) { if (Build.DEBUG) {
System.err.println(this + "IndexOutOfBoundsException caught for getAtIndex(" + part + "," + index + ")"); System.err.println(this + "IndexOutOfBoundsException caught for getAtIndex(" + part + "," + index + ")");
...@@ -459,7 +459,7 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText { ...@@ -459,7 +459,7 @@ public class AccessibleTextImpl implements javax.accessibility.AccessibleText {
if (type == AccessibleTextType.LINE) { if (type == AccessibleTextType.LINE) {
try { try {
return unoObject.getTextAtIndex(index - 1, type); return unoObject.getTextAtIndex(index - 1, type).SegmentText;
} catch (com.sun.star.uno.Exception e2) { } catch (com.sun.star.uno.Exception e2) {
} }
} }
......
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