void InsetLabel::addToToc(DocIterator const & cpit, bool output_active,
- UpdateType, TocBackend & backend) const
+ UpdateType, TocBackend & backend) const
{
docstring const & label = getParam("name");
- if (!buffer().activeLabel(label))
- return;
+ // inactive labels get a cross mark
+ if (buffer().insetLabel(label, true) != this)
+ output_active = false;
+
+ // We put both active and inactive labels to the outliner
shared_ptr<Toc> toc = backend.toc("label");
- if (buffer().insetLabel(label, true) != this) {
- toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
- } else {
- toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
+ toc->push_back(TocItem(cpit, 0, screen_label_, output_active));
+ // The refs get assigned only to the active label. If no active one exists,
+ // assign the (BROKEN) refs to the first inactive one.
+ if (buffer().insetLabel(label, true) == this || !buffer().activeLabel(label)) {
for (auto const & p : buffer().references(label)) {
DocIterator const ref_pit(p.second);
if (p.first->lyxCode() == MATH_REF_CODE)
UpdateType, TocBackend & backend) const
{
docstring const & label = getParam("reference");
- if (buffer().activeLabel(label))
+ if (buffer().insetLabel(label)) {
+ broken_ = !buffer().activeLabel(label);
// This InsetRef has already been taken care of in InsetLabel::addToToc().
return;
+ }
// It seems that this reference does not point to any valid label.