void InsetText::addToToc(DocIterator const & cdit, bool output_active, UpdateType utype, TocBackend & backend) const { DocIterator dit = cdit; dit.push_back(CursorSlice(const_cast<InsetText &>(*this))); iterateForToc(dit, output_active, utype, backend); }
void InsetBranch::addToToc(DocIterator const & cpit) const { DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetBranch &>(*this))); Toc & toc = buffer().tocBackend().toc("branch"); docstring str = params_.branch + ": "; text().forToc(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. InsetCollapsable::addToToc(cpit); }
void InsetNote::addToToc(DocIterator const & cpit) const { DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetNote &>(*this))); Toc & toc = buffer().tocBackend().toc("note"); InsetLayout const & il = getLayout(); docstring str = translateIfPossible(il.labelstring()) + from_ascii(": "); text().forToc(str, TOC_ENTRY_LENGTH); toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60))); // Proceed with the rest of the inset. InsetCollapsable::addToToc(cpit); }
void InsetText::addToToc(DocIterator const & cdit) const { DocIterator dit = cdit; dit.push_back(CursorSlice(const_cast<InsetText &>(*this))); Toc & toc = buffer().tocBackend().toc("tableofcontents"); BufferParams const & bufparams = buffer_->params(); int const min_toclevel = bufparams.documentClass().min_toclevel(); // For each paragraph, traverse its insets and let them add // their toc items ParagraphList const & pars = paragraphs(); pit_type pend = paragraphs().size(); for (pit_type pit = 0; pit != pend; ++pit) { Paragraph const & par = pars[pit]; dit.pit() = pit; // if we find an optarg, we'll save it for use later. InsetText const * arginset = 0; InsetList::const_iterator it = par.insetList().begin(); InsetList::const_iterator end = par.insetList().end(); for (; it != end; ++it) { Inset & inset = *it->inset; dit.pos() = it->pos; //lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl; inset.addToToc(dit); if (inset.lyxCode() == ARG_CODE) arginset = inset.asInsetText(); } // now the toc entry for the paragraph int const toclevel = par.layout().toclevel; if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) { // insert this into the table of contents docstring tocstring; if (arginset) { tocstring = par.labelString(); if (!tocstring.empty()) tocstring += ' '; arginset->text().forToc(tocstring, TOC_ENTRY_LENGTH); } else par.forToc(tocstring, TOC_ENTRY_LENGTH); dit.pos() = 0; toc.push_back(TocItem(dit, toclevel - min_toclevel, tocstring, tocstring)); } // And now the list of changes. par.addChangesToToc(dit, buffer()); } }
void InsetCaptionable::addToToc(DocIterator const & cpit, bool output_active, UpdateType utype, TocBackend & backend) const { DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetCaptionable &>(*this))); docstring str; // Leave str empty if we generate for output (e.g. xhtml lists of figures). // This ensures that there is a caption if and only if the string is // non-empty. if (utype != OutputUpdate) text().forOutliner(str, TOC_ENTRY_LENGTH); TocBuilder & b = backend.builder(caption_type_); b.pushItem(pit, str, output_active); // Proceed with the rest of the inset. InsetCollapsible::addToToc(cpit, output_active, utype, backend); b.pop(); }
void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const { if (floattype_.empty()) return; DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetCaption &>(*this))); Toc & toc = buffer().tocBackend().toc(floattype_); docstring str = full_label_; int length = output_active ? INT_MAX : TOC_ENTRY_LENGTH; text().forToc(str, length); toc.push_back(TocItem(pit, 0, str, output_active)); // Proceed with the rest of the inset. InsetText::addToToc(cpit, output_active); }
void InsetCaption::addToToc(DocIterator const & cpit, bool output_active, UpdateType utype, TocBackend & backend) const { string const & type = floattype_.empty() ? "senseless" : floattype_; DocIterator pit = cpit; pit.push_back(CursorSlice(const_cast<InsetCaption &>(*this))); int length = (utype == OutputUpdate) ? // For output (e.g. xhtml) all (bug #8603) or nothing (output_active ? INT_MAX : 0) : // TOC for LyX interface TOC_ENTRY_LENGTH; docstring str; if (length > 0) { str = full_label_; text().forOutliner(str, length); } backend.builder(type).captionItem(pit, str, output_active); // Proceed with the rest of the inset. InsetText::addToToc(cpit, output_active, utype, backend); }
void InsetText::addToToc(DocIterator const & cdit, bool output_active) const { DocIterator dit = cdit; dit.push_back(CursorSlice(const_cast<InsetText &>(*this))); iterateForToc(dit, output_active); }