is included in output.
d->bibinfo_cache_valid_ = true;
d->cite_labels_valid_ = true;
- cbuf.tocBackend().update();
+ cbuf.tocBackend().update(true);
if (scope == UpdateMaster)
cbuf.structureChanged();
}
}
-void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer) const
+void Changes::addToToc(DocIterator const & cdit, Buffer const & buffer,
+ bool output_active) const
{
if (table_.empty())
return;
break;
case Change::INSERTED:
// 0x270d is the hand writting symbol in the Dingbats unicode group.
- str.push_back(0x270d);
- break;
+ str.push_back(0x270d); break;
}
dit.pos() = it->range.start;
Paragraph const & par = dit.paragraph();
docstring const & author = author_list.get(it->change.author).name();
Toc::iterator it = change_list.item(0, author);
if (it == change_list.end()) {
- change_list.push_back(TocItem(dit, 0, author));
- change_list.push_back(TocItem(dit, 1, str,
+ change_list.push_back(TocItem(dit, 0, author, output_active));
+ change_list.push_back(TocItem(dit, 1, str, output_active,
support::wrapParas(str, 4)));
continue;
}
if (it->depth() == 0 && it->str() != author)
break;
}
- change_list.insert(it, TocItem(dit, 1, str,
+ change_list.insert(it, TocItem(dit, 1, str, output_active,
support::wrapParas(str, 4)));
}
}
void checkAuthors(AuthorList const & authorList);
///
- void addToToc(DocIterator const & cdit, Buffer const & buffer) const;
+ void addToToc(DocIterator const & cdit, Buffer const & buffer,
+ bool output_active) const;
private:
class Range {
void Paragraph::addChangesToToc(DocIterator const & cdit,
- Buffer const & buf) const
+ Buffer const & buf, bool output_active) const
{
- d->changes_.addToToc(cdit, buf);
+ d->changes_.addToToc(cdit, buf, output_active);
}
void setId(int id);
///
- void addChangesToToc(DocIterator const & cdit, Buffer const & buf) const;
+ void addChangesToToc(DocIterator const & cdit, Buffer const & buf,
+ bool output_active) const;
///
Language const * getParLanguage(BufferParams const &) const;
///
///////////////////////////////////////////////////////////////////////////
TocItem::TocItem(DocIterator const & dit, int d, docstring const & s,
- docstring const & t) : dit_(dit), depth_(d), str_(s), tooltip_(t)
+ bool output_active, docstring const & t) :
+ dit_(dit), depth_(d), str_(s), tooltip_(t), output_(output_active)
{
}
}
-void TocBackend::update()
+void TocBackend::update(bool output_active)
{
tocs_.clear();
if (!buffer_->isInternal()) {
DocIterator dit;
- buffer_->inset().addToToc(dit);
+ buffer_->inset().addToToc(dit, output_active);
}
}
TocItem(DocIterator const & dit,
int depth,
docstring const & s,
+ bool output_active,
docstring const & t = docstring()
);
///
docstring const asString() const;
///
DocIterator const & dit() const;
+ ///
+ bool isOutput() const { return output_; }
/// the action corresponding to the goTo above
FuncRequest action() const;
protected:
/// Current position of item.
DocIterator dit_;
-
/// nesting depth
int depth_;
-
/// Full item string
docstring str_;
-
/// The tooltip string
docstring tooltip_;
+ /// Is this item in a note, inactive branch, etc?
+ bool output_;
};
///
void setBuffer(Buffer const * buffer) { buffer_ = buffer; }
///
- void update();
+ void update(bool output_active);
/// \return true if the item was updated.
bool updateItem(DocIterator const & pit);
/// Add an entry to the TocList
/// Pass a DocIterator that points at the paragraph containing
/// the inset
- virtual void addToToc(DocIterator const &) const {}
+ virtual void addToToc(DocIterator const & /* di */, bool /* output_active */) const {}
/// Collect BibTeX information
virtual void collectBibKeys(InsetIterator const &) const {}
/// Update the counters of this inset and of its contents.
}
-void InsetBranch::addToToc(DocIterator const & cpit) const
+void InsetBranch::addToToc(DocIterator const & cpit, bool output_active) 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)));
+ toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit);
+ bool const doing_output = output_active && isBranchSelected();
+ InsetCollapsable::addToToc(cpit, doing_output);
}
///
std::string contextMenuName() const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
InsetBranchParams const & params() const { return params_; }
///
}
-void InsetCaption::addToToc(DocIterator const & cpit) const
+void InsetCaption::addToToc(DocIterator const & cpit, bool output_active) const
{
if (floattype_.empty())
return;
Toc & toc = buffer().tocBackend().toc(floattype_);
docstring str = full_label_;
text().forToc(str, TOC_ENTRY_LENGTH);
- toc.push_back(TocItem(pit, 0, str));
+ toc.push_back(TocItem(pit, 0, str, output_active));
// Proceed with the rest of the inset.
- InsetText::addToToc(cpit);
+ InsetText::addToToc(cpit, output_active);
}
///
void setCustomLabel(docstring const & label);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
virtual bool forcePlainLayout(idx_type = 0) const { return true; }
/// Captions don't accept alignment, spacing, etc.
}
-void InsetCitation::addToToc(DocIterator const & cpit) const
+void InsetCitation::addToToc(DocIterator const & cpit, bool output_active) const
{
// NOTE
// XHTML output uses the TOC to collect the citations
// will need to change how the citations are collected.
docstring const tocitem = getParam("key");
Toc & toc = buffer().tocBackend().toc("citation");
- toc.push_back(TocItem(cpit, 0, tocitem));
+ toc.push_back(TocItem(cpit, 0, tocitem, output_active));
}
///
void updateBuffer(ParIterator const & it, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
std::string contextMenuName() const;
//@}
}
-void InsetFoot::addToToc(DocIterator const & cpit) const
+void InsetFoot::addToToc(DocIterator const & cpit, bool output_active) const
{
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetFoot &>(*this)));
Toc & toc = buffer().tocBackend().toc("footnote");
docstring str = custom_label_ + ": ";
text().forToc(str, TOC_ENTRY_LENGTH);
- toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+ toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset.
- InsetFootlike::addToToc(cpit);
+ InsetFootlike::addToToc(cpit, output_active);
}
/// Update the counters of this inset and of its contents
void updateBuffer(ParIterator const &, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
}
-void InsetGraphics::addToToc(DocIterator const & cpit) const
+void InsetGraphics::addToToc(DocIterator const & cpit, bool output_active) const
{
TocBackend & backend = buffer().tocBackend();
//FIXME UNICODE
docstring const str = from_utf8(params_.filename.onlyFileName());
- backend.toc("graphics").push_back(TocItem(cpit, 0, str));
+ backend.toc("graphics").push_back(TocItem(cpit, 0, str, output_active));
}
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
std::string contextMenuName() const;
/// Force inset into LTR environment if surroundings are RTL
}
-void InsetInclude::addToToc(DocIterator const & cpit) const
+void InsetInclude::addToToc(DocIterator const & cpit, bool output_active) const
{
TocBackend & backend = buffer().tocBackend();
if (isListings(params())) {
if (label_)
- label_->addToToc(cpit);
+ label_->addToToc(cpit, output_active);
InsetListingsParams p(to_utf8(params()["lstparams"]));
string caption = p.getParamValue("caption");
docstring str = convert<docstring>(toc.size() + 1)
+ ". " + from_utf8(caption);
DocIterator pit = cpit;
- toc.push_back(TocItem(pit, 0, str));
+ toc.push_back(TocItem(pit, 0, str, output_active));
return;
}
Buffer const * const childbuffer = getChildBuffer();
Toc & toc = backend.toc("child");
docstring str = childbuffer->fileName().displayName();
- toc.push_back(TocItem(cpit, 0, str));
+ toc.push_back(TocItem(cpit, 0, str, output_active));
TocList & toclist = backend.tocs();
- childbuffer->tocBackend().update();
+ childbuffer->tocBackend().update(output_active);
TocList const & childtoclist = childbuffer->tocBackend().tocs();
TocList::const_iterator it = childtoclist.begin();
TocList::const_iterator const end = childtoclist.end();
///
void addPreview(DocIterator const &, graphics::PreviewLoader &) const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
void updateBuffer(ParIterator const &, UpdateType);
///
}
-void InsetIndex::addToToc(DocIterator const & cpit) const
+void InsetIndex::addToToc(DocIterator const & cpit, bool output_active) const
{
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetIndex &>(*this)));
docstring str;
text().forToc(str, 0);
- buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str));
+ buffer().tocBackend().toc("index").push_back(TocItem(pit, 0, str, output_active));
// Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit);
+ InsetCollapsable::addToToc(cpit, output_active);
}
/// should paragraph indendation be omitted in any case?
bool neverIndent() const { return true; }
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
docstring toolTip(BufferView const & bv, int x, int y) const;
///
}
-void InsetLabel::addToToc(DocIterator const & cpit) const
+void InsetLabel::addToToc(DocIterator const & cpit, bool output_active) const
{
docstring const & label = getParam("name");
Toc & toc = buffer().tocBackend().toc("label");
if (buffer().insetLabel(label) != this) {
- toc.push_back(TocItem(cpit, 0, screen_label_));
+ toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
return;
}
- toc.push_back(TocItem(cpit, 0, screen_label_));
+ toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
Buffer::References const & refs = buffer().references(label);
Buffer::References::const_iterator it = refs.begin();
Buffer::References::const_iterator end = refs.end();
DocIterator const ref_pit(it->second);
if (it->first->lyxCode() == MATH_REF_CODE)
toc.push_back(TocItem(ref_pit, 1,
- it->first->asInsetMath()->asRefInset()->screenLabel()));
+ it->first->asInsetMath()->asRefInset()->screenLabel(),
+ output_active));
else
toc.push_back(TocItem(ref_pit, 1,
- static_cast<InsetRef *>(it->first)->screenLabel()));
+ static_cast<InsetRef *>(it->first)->screenLabel(),
+ output_active));
}
}
///
void updateBuffer(ParIterator const & it, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
//@}
/// \name Static public methods obligated for InsetCommand derived classes
}
-void InsetMarginal::addToToc(DocIterator const & cpit) const
+void InsetMarginal::addToToc(DocIterator const & cpit, bool output_active) const
{
DocIterator pit = cpit;
pit.push_back(CursorSlice(const_cast<InsetMarginal &>(*this)));
Toc & toc = buffer().tocBackend().toc("marginalnote");
docstring str;
text().forToc(str, TOC_ENTRY_LENGTH);
- toc.push_back(TocItem(pit, 0, str, toolTipText(docstring(), 3, 60)));
+ toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
// Proceed with the rest of the inset.
- InsetFootlike::addToToc(cpit);
+ InsetFootlike::addToToc(cpit, output_active);
}
} // namespace lyx
///
int docbook(odocstream &, OutputParams const & runparams) const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
private:
///
Inset * clone() const { return new InsetMarginal(*this); }
}
-void InsetNote::addToToc(DocIterator const & cpit) const
+void InsetNote::addToToc(DocIterator const & cpit, bool output_active) 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)));
+ toc.push_back(TocItem(pit, 0, str, output_active, toolTipText(docstring(), 3, 60)));
+
// Proceed with the rest of the inset.
- InsetCollapsable::addToToc(cpit);
+ bool doing_output = output_active && producesOutput();
+ InsetCollapsable::addToToc(cpit, doing_output);
}
///
bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
void doDispatch(Cursor & cur, FuncRequest & cmd);
///
}
-void InsetRef::addToToc(DocIterator const & cpit) const
+void InsetRef::addToToc(DocIterator const & cpit, bool output_active) const
{
docstring const & label = getParam("reference");
if (buffer().insetLabel(label))
// It seems that this reference does not point to any valid label.
screen_label_ = _("BROKEN: ") + screen_label_;
Toc & toc = buffer().tocBackend().toc("label");
- toc.push_back(TocItem(cpit, 0, screen_label_));
+ toc.push_back(TocItem(cpit, 0, screen_label_, output_active));
}
///
void updateBuffer(ParIterator const & it, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
bool forceLTR() const { return true; }
//@}
}
-void InsetTabular::addToToc(DocIterator const & cpit) const
+void InsetTabular::addToToc(DocIterator const & cpit, bool output_active) const
{
DocIterator dit = cpit;
dit.forwardPos();
size_t const end = dit.nargs();
for ( ; dit.idx() < end; dit.top().forwardIdx())
- cell(dit.idx())->addToToc(dit);
+ cell(dit.idx())->addToToc(dit, output_active);
}
/// Update the counters of this inset and of its contents
void updateBuffer(ParIterator const &, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
bool completionSupported(Cursor const &) const;
}
-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();
}
par.forToc(tocstring, TOC_ENTRY_LENGTH);
dit.pos() = 0;
toc.push_back(TocItem(dit, toclevel - min_toclevel,
- tocstring, tocstring));
+ tocstring, output_active, tocstring));
}
// And now the list of changes.
- par.addChangesToToc(dit, buffer());
+ par.addChangesToToc(dit, buffer(), doing_output);
}
}
///
void forToc(docstring &, size_t) const;
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
Inset * clone() const { return new InsetText(*this); }
///
}
-void InsetMathHull::addToToc(DocIterator const & pit) const
+void InsetMathHull::addToToc(DocIterator const & pit, bool output_active) const
{
if (!buffer_) {
//FIXME: buffer_ should be set at creation for this inset! Problem is
if (!numbered_[row])
continue;
if (label_[row])
- label_[row]->addToToc(pit);
- toc.push_back(TocItem(pit, 0, nicelabel(row)));
+ label_[row]->addToToc(pit, output_active);
+ toc.push_back(TocItem(pit, 0, nicelabel(row), output_active));
}
}
///
void updateBuffer(ParIterator const &, UpdateType);
///
- void addToToc(DocIterator const &) const;
+ void addToToc(DocIterator const & di, bool output_active) const;
///
InsetMathHull & operator=(InsetMathHull const &);
///