3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS.
13 #include "insetnomencl.h"
14 #include "insetnote.h"
17 #include "dispatchresult.h"
18 #include "funcrequest.h"
20 #include "insetiterator.h"
21 #include "LaTeXFeatures.h"
22 #include "metricsinfo.h"
31 InsetNomencl::InsetNomencl(InsetCommandParams const & p)
32 : InsetCommand(p, "nomenclature"),
33 glossary_entry_id(sgml::uniqueID(from_ascii("gloss")))
37 docstring const InsetNomencl::getScreenLabel(Buffer const &) const
43 int InsetNomencl::docbook(Buffer const &, odocstream & os,
44 OutputParams const &) const
46 os << "<glossterm linkend=\"" << glossary_entry_id << "\">"
47 << sgml::escapeString(getParam("symbol"))
53 int InsetNomencl::docbookGlossary(odocstream & os) const
55 os << "<glossentry id=\"" << glossary_entry_id << "\">\n"
57 << sgml::escapeString(getParam("symbol"))
60 << sgml::escapeString(getParam("description"))
61 << "</para></glossdef>\n"
67 void InsetNomencl::validate(LaTeXFeatures & features) const
69 features.require("nomencl");
73 InsetBase::Code InsetNomencl::lyxCode() const
75 return InsetBase::NOMENCL_CODE;
79 InsetPrintNomencl::InsetPrintNomencl(InsetCommandParams const & p)
80 : InsetCommand(p, string())
84 docstring const InsetPrintNomencl::getScreenLabel(Buffer const &) const
90 int InsetPrintNomencl::docbook(Buffer const & buf, odocstream & os,
91 OutputParams const &) const
95 for (InsetIterator it = inset_iterator_begin(buf.inset()); it;) {
96 if (it->lyxCode() == InsetBase::NOMENCL_CODE) {
97 newlines += static_cast<InsetNomencl const &>(*it).docbookGlossary(os);
99 } else if(it->lyxCode() == InsetBase::NOTE_CODE &&
100 static_cast<InsetNote const &>(*it).params().type == InsetNoteParams::Note) {
101 // Don't output anything nested in note insets
102 size_t const depth = it.depth();
104 while (it.depth() > depth)
110 os << "</glossary>\n";
115 void InsetPrintNomencl::validate(LaTeXFeatures & features) const
117 features.require("nomencl");
121 InsetBase::Code InsetPrintNomencl::lyxCode() const
123 return InsetBase::NOMENCL_PRINT_CODE;