MCPcopy Create free account
hub / github.com/TeXworks/texworks / recursiveConvertToC

Method recursiveConvertToC

modules/QtPDF/src/backends/MuPDFBackend.cpp:773–794  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

771}
772
773void 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
796PDFToC Document::toc() const
797{

Callers

nothing calls this directly

Calls 3

setActionMethod · 0.80
toPDFDestinationFunction · 0.70
setOpenMethod · 0.45

Tested by

no test coverage detected