assure("gotoStartOfWord(): succeeded", !bSuccess);
// XSentenceCursor
xText.setString("This is a sentence. Another sentence.");
xTextCursor.gotoStart(false);
XSentenceCursor xSentenceCursor = (XSentenceCursor)
UnoRuntime.queryInterface(XSentenceCursor.class, xTextCursor);
bSuccess = xSentenceCursor.gotoNextSentence(true);
assure("gotoNextSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assure("gotoNextSentence(): wrong string: " + string,
"This is a sentence. ".equals(string));
}
bSuccess = xSentenceCursor.gotoNextSentence(false);
assure("gotoNextSentence(): succeeded", !bSuccess);
// FIXME:
// the sentence cursor seems to work differently than the word cursor
xText.setString("This is a sentence. Another sentence. Sentence 3.");
xTextCursor.gotoEnd(false);
bSuccess = xSentenceCursor.gotoPreviousSentence(true);
assure("gotoPreviousSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assure("gotoPreviousSentence(): wrong string: " + string,
"Another sentence. Sentence 3.".equals(string));
}
bSuccess = xSentenceCursor.gotoPreviousSentence(false);
assure("gotoPreviousSentence(): succeeded", !bSuccess);
bSuccess = xSentenceCursor.gotoEndOfSentence(true);
assure("gotoEndOfSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assure("gotoEndOfSentence(): wrong string: " + string,
"This is a sentence.".equals(string));
}
xTextCursor.gotoEnd(false);
bSuccess = xSentenceCursor.gotoStartOfSentence(true);
assure("gotoStartOfSentence(): failed", bSuccess);
{
String string = xTextCursor.getString();
assure("gotoStartOfSentence(): wrong string: " + string,
"Sentence 3.".equals(string));
}
xText.setString("");
bSuccess = xSentenceCursor.gotoEndOfSentence(false);
assure("gotoEndOfSentence(): succeeded", !bSuccess);
bSuccess = xSentenceCursor.gotoStartOfSentence(false);
assure("gotoStartOfSentence(): succeeded", !bSuccess);
XParagraphCursor xParagraphCursor = (XParagraphCursor)
UnoRuntime.queryInterface(XParagraphCursor.class, xTextCursor);