| 771 | } |
| 772 | |
| 773 | void Document::recursiveConvertToC(QList<PDFToCItem> & items, pdf_outline * node) const |
| 774 | { |
| 775 | while (node && node->title) { |
| 776 | // TODO: It seems that this works, at least for pdfs produced with pdflatex |
| 777 | // using either utf8 or latin1 encoding (and the approrpriate inputenc |
| 778 | // package). Is this valid generally? |
| 779 | PDFToCItem item(QString::fromUtf8(node->title)); |
| 780 | item.setOpen(node->count > 0); |
| 781 | |
| 782 | if (node->link && (node->link->kind == PDF_LINK_GOTO || node->link->kind == PDF_LINK_NAMED)) { |
| 783 | Q_ASSERT(_mupdf_data != NULL); |
| 784 | item.setAction(new PDFGotoAction(toPDFDestination(_mupdf_data, node->link->dest))); |
| 785 | } |
| 786 | |
| 787 | recursiveConvertToC(item.children(), node->child); |
| 788 | |
| 789 | // NOTE: pdf_outline doesn't include color or flags; we could go through the |
| 790 | // pdf ourselves to get to them, but for now we simply don't support them |
| 791 | items << item; |
| 792 | node = node->next; |
| 793 | } |
| 794 | } |
| 795 | |
| 796 | PDFToC Document::toc() const |
| 797 | { |
nothing calls this directly
no test coverage detected