DocTocItem *Chm2EngineImpl::GetTocTree() { EbookTocBuilder builder(this); doc->ParseToc(&builder); if (doc->HasIndex()) { // TODO: ToC code doesn't work too well for displaying an index, // so this should really become a tree of its own (which // doesn't rely on entries being in the same order as pages) builder.Visit(L"Index", NULL, 1); builder.SetIsIndex(true); doc->ParseIndex(&builder); } return builder.GetRoot(); }