#include "Cursor.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "LyXFunc.h"
#include "OutputParams.h"
+#include "ParIterator.h"
#include "sgml.h"
+#include "TocBackend.h"
#include "support/docstream.h"
+#include "support/gettext.h"
#include "support/lstrings.h"
-using namespace std;
using namespace lyx::support;
+using namespace std;
namespace lyx {
}
-docstring const InsetRef::getScreenLabel(Buffer const &) const
+docstring InsetRef::screenLabel() const
{
docstring temp;
for (int i = 0; !types[i].latex_name.empty(); ++i) {
}
-int InsetRef::latex(Buffer const &, odocstream & os,
- OutputParams const &) const
+int InsetRef::latex(odocstream & os, OutputParams const &) const
{
// We don't want to output p_["name"], since that is only used
// in docbook. So we construct new params, without it, and use that.
}
-int InsetRef::plaintext(Buffer const &, odocstream & os,
- OutputParams const &) const
+int InsetRef::plaintext(odocstream & os, OutputParams const &) const
{
docstring const str = getParam("reference");
os << '[' << str << ']';
}
-int InsetRef::docbook(Buffer const & buf, odocstream & os,
- OutputParams const & runparams) const
+int InsetRef::docbook(odocstream & os, OutputParams const & runparams) const
{
docstring const & name = getParam("name");
if (name.empty()) {
if (runparams.flavor == OutputParams::XML) {
os << "<xref linkend=\""
- << sgml::cleanID(buf, runparams, getParam("reference"))
+ << sgml::cleanID(buffer(), runparams, getParam("reference"))
<< "\" />";
} else {
os << "<xref linkend=\""
- << sgml::cleanID(buf, runparams, getParam("reference"))
+ << sgml::cleanID(buffer(), runparams, getParam("reference"))
<< "\">";
}
} else {
os << "<link linkend=\""
- << sgml::cleanID(buf, runparams, getParam("reference"))
+ << sgml::cleanID(buffer(), runparams, getParam("reference"))
<< "\">"
<< getParam("name")
<< "</link>";
}
-void InsetRef::textString(Buffer const & buf, odocstream & os) const
+void InsetRef::textString(odocstream & os) const
+{
+ plaintext(os, OutputParams(0));
+}
+
+
+void InsetRef::updateLabels(ParIterator const & it)
+{
+ docstring const & label = getParam("reference");
+ buffer().references(label).push_back(make_pair(this, it));
+}
+
+
+void InsetRef::addToToc(ParConstIterator const & cpit) const
{
- plaintext(buf, os, OutputParams(0));
+ docstring const & label = getParam("reference");
+ if (buffer().insetLabel(label))
+ // This InsetRef has already been taken care of in InsetLabel::addToToc().
+ return;
+
+ Toc & toc = buffer().tocBackend().toc("label");
+ docstring const reflabel = _("BROKEN: ") + screenLabel();
+ toc.push_back(TocItem(cpit, 0, reflabel));
}