- Toc & toc = buffer().tocBackend().toc("label");
- if (buffer().insetLabel(label) != this) {
- toc.push_back(TocItem(cpit, 0, screen_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");
+ 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)
+ toc->push_back(TocItem(ref_pit, 1,
+ p.first->asInsetMath()->asRefInset()->screenLabel(),
+ output_active));
+ else
+ toc->push_back(TocItem(ref_pit, 1,
+ static_cast<InsetRef *>(p.first)->getTOCString(),
+ output_active));
+ }