[LyX/master] Add outliner section for broken refs and citations

Juergen Spitzmueller spitz at lyx.org
Sat Mar 14 13:59:16 UTC 2020


commit a1da60642c0541b6ebac85dd8b64de8ff993c256
Author: Juergen Spitzmueller <spitz at lyx.org>
Date:   Sat Mar 14 15:18:28 2020 +0100

    Add outliner section for broken refs and citations
---
 src/TocBackend.cpp           |    1 +
 src/insets/InsetCitation.cpp |    9 ++++++++-
 src/insets/InsetCommand.h    |    2 ++
 src/insets/InsetRef.cpp      |    2 ++
 4 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/src/TocBackend.cpp b/src/TocBackend.cpp
index 7ea16b7..43a2188 100644
--- a/src/TocBackend.cpp
+++ b/src/TocBackend.cpp
@@ -288,6 +288,7 @@ void TocBackend::resetOutlinerNames()
 	addName("senseless", _("Senseless"));
 	addName("citation", _("Citations"));
 	addName("label", _("Labels and References"));
+	addName("brokenrefs", _("Broken References and Citations"));
 	// Customizable, but the corresponding insets have no layout definition
 	addName("child", _("Child Documents"));
 	addName("graphics", _("Graphics"));
diff --git a/src/insets/InsetCitation.cpp b/src/insets/InsetCitation.cpp
index f3d4d2a..3fa8245 100644
--- a/src/insets/InsetCitation.cpp
+++ b/src/insets/InsetCitation.cpp
@@ -493,10 +493,17 @@ void InsetCitation::addToToc(DocIterator const & cpit, bool output_active,
 	// from the document. It is used indirectly, via BiblioInfo::makeCitationLables,
 	// by both XHTML and plaintext output. So, if we change what goes into the TOC,
 	// then we will also need to change that routine.
-	docstring const tocitem = getParam("key");
+	docstring tocitem;
+	if (isBroken())
+		tocitem = _("BROKEN: ");
+	tocitem += getParam("key");
 	TocBuilder & b = backend.builder("citation");
 	b.pushItem(cpit, tocitem, output_active);
 	b.pop();
+	if (isBroken()) {
+		shared_ptr<Toc> toc2 = backend.toc("brokenrefs");
+		toc2->push_back(TocItem(cpit, 0, tocitem, output_active));
+	}
 }
 
 
diff --git a/src/insets/InsetCommand.h b/src/insets/InsetCommand.h
index f959d19..58d2345 100644
--- a/src/insets/InsetCommand.h
+++ b/src/insets/InsetCommand.h
@@ -64,6 +64,8 @@ public:
 	docstring const getFirstNonOptParam() const { return p_.getFirstNonOptParam(); }
 	///
 	void setBroken(bool const b) const { broken_ = b; }
+	///
+	bool isBroken() const { return broken_; }
 
 	/// \name Public functions inherited from Inset class
 	//@{
diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp
index 8f12dba..2c4b7c2 100644
--- a/src/insets/InsetRef.cpp
+++ b/src/insets/InsetRef.cpp
@@ -470,6 +470,8 @@ void InsetRef::addToToc(DocIterator const & cpit, bool output_active,
 	setBroken(broken_);
 	shared_ptr<Toc> toc = backend.toc("label");
 	toc->push_back(TocItem(cpit, 0, screenLabel(), output_active));
+	shared_ptr<Toc> toc2 = backend.toc("brokenrefs");
+	toc2->push_back(TocItem(cpit, 0, screenLabel(), output_active));
 }
 
 


More information about the lyx-cvs mailing list