1
0
Fork 0
mirror of https://github.com/geometer/FBReaderJ.git synced 2025-10-03 09:49:19 +02:00

text highlighting, misc fixes

This commit is contained in:
Nikolay Pultsin 2011-06-19 16:18:48 +01:00
parent 9296cef55e
commit 083629c6bf
7 changed files with 252 additions and 87 deletions

View file

@ -66,8 +66,15 @@ public class ApiServerImplementation extends ApiInterface.Stub implements ApiMet
setPageStart((TextPosition)parameters[0]);
return ApiObject.Void.Instance;
case HIGHLIGHT_AREA:
{
myReader.getTextView().highlight(
getZLTextPosition((TextPosition)parameters[0]),
getZLTextPosition((TextPosition)parameters[1])
);
return ApiObject.Void.Instance;
}
case CLEAR_HIGHLIGHTING:
myReader.getTextView().clearHighlighting();
return ApiObject.Void.Instance;
default:
return unsupportedMethodError(method);
@ -96,6 +103,14 @@ public class ApiServerImplementation extends ApiInterface.Stub implements ApiMet
);
}
private ZLTextFixedPosition getZLTextPosition(TextPosition position) {
return new ZLTextFixedPosition(
position.ParagraphIndex,
position.ElementIndex,
position.CharIndex
);
}
private boolean isPageEndOfSection() {
final ZLTextWordCursor cursor = myReader.getTextView().getEndCursor();
return cursor.isEndOfParagraph() && cursor.getParagraphCursor().isEndOfSection();