use of org.ebookdroid.core.codec.OutlineLink in project LibreraReader by foobnix.
the class Fb2Extractor method genetateNCXbyOutline.
public static String genetateNCXbyOutline(List<OutlineLink> titles) {
StringBuilder navs = new StringBuilder();
for (int i = 0; i < titles.size(); i++) {
OutlineLink link = titles.get(i);
String titleTxt = link.getTitle();
if (TxtUtils.isNotEmpty(titleTxt)) {
String createNavPoint = createNavPoint(OutlineLinkWrapper.getPageNumber(link.getLink()), link.getLevel() + DIVIDER + titleTxt);
createNavPoint = createNavPoint.replace("fb2.fb2", "temp-reflow.html");
navs.append(createNavPoint);
}
}
return NCX.replace("%nav%", navs.toString());
}
use of org.ebookdroid.core.codec.OutlineLink in project LibreraReader by foobnix.
the class DjvuOutline method getOutline.
public List<OutlineLink> getOutline(final long dochandle) {
final List<OutlineLink> ls = new ArrayList<OutlineLink>();
docHandle = dochandle;
final long expr = open(docHandle);
ttOutline(ls, expr, 0);
ls.add(new OutlineLink("", "", -1, dochandle, ""));
return ls;
}
use of org.ebookdroid.core.codec.OutlineLink in project LibreraReader by foobnix.
the class Fb2Context method openDocumentInner2.
public CodecDocument openDocumentInner2(final String fileName1, String password) {
final String fileName = cacheFile1.getPath();
Fb2Extractor.get().convertFB2(fileName1, fileName);
MuPdfDocument muPdfDocument2 = new MuPdfDocument(this, MuPdfDocument.FORMAT_PDF, fileName, password) {
@Override
public java.util.List<OutlineLink> getOutline() {
List<OutlineLink> res = new ArrayList<OutlineLink>();
try {
String encoding = Fb2Extractor.findHeaderEncoding(fileName1);
List<String> titles = Fb2Extractor.getFb2Titles(fileName1, encoding);
for (int i = 0; i < titles.size(); i++) {
String string = titles.get(i).replace("~@~[title]", "###");
String[] full = string.split("###");
int level = Integer.parseInt(full[0]);
String title = full[1];
String linkUri = "#" + (i + 1);
res.add(new OutlineLink(title + linkUri, "", level, getDocumentHandle(), linkUri));
}
} catch (Exception e) {
LOG.e(e);
}
return res;
}
};
return muPdfDocument2;
}
use of org.ebookdroid.core.codec.OutlineLink in project LibreraReader by foobnix.
the class DjvuOutline method ttOutline.
private void ttOutline(final List<OutlineLink> ls, long expr, int level) {
while (expConsp(expr)) {
final String title = getTitle(expr);
final String link = getLink(expr, docHandle);
if (title != null) {
ls.add(new OutlineLink(title, link, level, docHandle, ""));
}
final long child = getChild(expr);
ttOutline(ls, child, level + 1);
expr = getNext(expr);
}
}
use of org.ebookdroid.core.codec.OutlineLink in project LibreraReader by foobnix.
the class MuPdfOutline method getOutline.
public List<OutlineLink> getOutline(final long dochandle) {
final List<OutlineLink> ls = new ArrayList<OutlineLink>();
docHandle = dochandle;
try {
TempHolder.lock.lock();
final long outline = open(dochandle);
ttOutline(ls, outline, 0);
free(dochandle);
ls.add(new OutlineLink("", "", -1, dochandle, ""));
} finally {
TempHolder.lock.unlock();
}
return ls;
}
Aggregations