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

git-svn-id: https://only.mawhrin.net/repos/FBReaderJ/trunk@107 6a642e6f-84f6-412e-ac94-c4a38d5a04b0

This commit is contained in:
griffon 2007-11-11 22:10:05 +00:00
parent 4b833c39d8
commit 7e728b6090
4 changed files with 64 additions and 5 deletions

View file

@ -1,6 +1,10 @@
package org.zlibrary.text.view.impl;
class ZLTextLineInfo {
/*This class has public fields like struct in C++.
Should I remove prefix "my", or should I make "getters" and "setters" for all the fields, making them private?*/
public ZLTextWordCursor myStart;
public ZLTextWordCursor myRealStart;
public ZLTextWordCursor myEnd;

View file

@ -2,10 +2,44 @@ package org.zlibrary.text.view.impl;
import org.zlibrary.text.model.ZLTextModel;
import org.zlibrary.text.model.ZLTextParagraph;
import org.zlibrary.text.model.entry.ZLTextParagraphEntry;
import org.zlibrary.text.model.entry.ZLTextEntry;
import java.util.*;
abstract class ZLTextParagraphCursor {
private static abstract class Processor {
protected ZLTextParagraph myParagraph;
protected List <ZLTextElement> myElements;
protected int myOffset;
protected Processor(ZLTextParagraph paragraph, int index, List <ZLTextElement> elements) {
myParagraph = paragraph;
myElements = elements;
myOffset = 0;
}
public void fill() {
List <ZLTextParagraphEntry> entries = myParagraph.getEntries();
for (ZLTextParagraphEntry entry : entries) {
// switch (entry.Kind) {
// case ZLTextParagraphEntry.Kind.TEXT_ENTRY: {
processTextEntry((ZLTextEntry) entry);
// break;
// }
// }
}
}
public abstract void processTextEntry(ZLTextEntry textEntry);
protected void addWord(String s, int offset, int len) {
myElements.add(new ZLTextWord(s, (short) len, offset));
}
}
protected ZLTextModel myModel;
protected int myIndex;
protected List <ZLTextElement> myElements;

View file

@ -1,11 +1,30 @@
package org.zlibrary.text.view.impl;
import org.zlibrary.text.model.*;
import org.zlibrary.text.view.ZLTextView;
class ZLTextViewImpl implements ZLTextView {
ZLTextLineInfo processTextLine(ZLTextWordCursor start, ZLTextWordCursor end) {
private ZLTextModel myModel;
/* ZLTextLineInfo processTextLine(ZLTextWordCursor start, ZLTextWordCursor end) {
ZLTextLineInfo info = new ZLTextLineInfo(start);
ZLTextWordCursor current = start;
final ZLTextParagraphCursor paragraphCursor = current.getParagraphCursor();
final boolean isFirstLine = current.isStartOfParagraph();
if (isFirstLine) {
}
if (info.myRealStart.equalWordNumber(length)) {
info.myEnd = info.myRealStart;
return info;
}
int newWidth = info.myWidth;
int newHeight = info.myHeight;
return info;
}
}*/
}

View file

@ -1,12 +1,14 @@
package org.zlibrary.text.view.impl;
class ZLTextWord extends ZLTextElement {
/*package*/ class ZLTextWord extends ZLTextElement {
public String myData;
public short mySize;
public short myLength;
public int myParagraphOffset;
private ZLTextWord(String data, short size, int paragraphOffset) {
/*Temporarily made public to avoid implementing ZLTextElementPool with all its messy allocators, wtf is it?*/
public ZLTextWord(String data, short size, int paragraphOffset) {
myData = data;
mySize = size;
myLength = (short) data.length();