}
-void InsetText::addToToc(DocIterator const & cdit) const
+void InsetText::addToToc(DocIterator const & cdit, bool output_active) const
{
DocIterator dit = cdit;
dit.push_back(CursorSlice(const_cast<InsetText &>(*this)));
BufferParams const & bufparams = buffer_->params();
int const min_toclevel = bufparams.documentClass().min_toclevel();
+ // we really should have done this before we got here, but it
+ // can't hurt too much to do it again
+ bool const doing_output = output_active && producesOutput();
// For each paragraph, traverse its insets and let them add
// their toc items
Inset & inset = *it->inset;
dit.pos() = it->pos;
//lyxerr << (void*)&inset << " code: " << inset.lyxCode() << std::endl;
- inset.addToToc(dit);
+ inset.addToToc(dit, doing_output);
if (inset.lyxCode() == ARG_CODE)
arginset = inset.asInsetText();
}
if (toclevel != Layout::NOT_IN_TOC && toclevel >= min_toclevel) {
// insert this into the table of contents
docstring tocstring;
+ int const length = doing_output ? INT_MAX : TOC_ENTRY_LENGTH;
if (arginset) {
tocstring = par.labelString();
if (!tocstring.empty())
tocstring += ' ';
- arginset->text().forToc(tocstring, TOC_ENTRY_LENGTH);
+ arginset->text().forToc(tocstring, length);
} else
- par.forToc(tocstring, TOC_ENTRY_LENGTH);
+ par.forToc(tocstring, length);
dit.pos() = 0;
toc.push_back(TocItem(dit, toclevel - min_toclevel,
- tocstring, tocstring));
+ tocstring, doing_output, tocstring));
}
// And now the list of changes.
- par.addChangesToToc(dit, buffer());
+ par.addChangesToToc(dit, buffer(), doing_output);
}
}