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
8 * Full author contact details are available in file CREDITS.
12 #include "InsetIndex.h"
15 #include "DispatchResult.h"
16 #include "FuncRequest.h"
17 #include "FuncStatus.h"
18 #include "LaTeXFeatures.h"
19 #include "MetricsInfo.h"
21 #include "TocBackend.h"
23 #include "support/gettext.h"
32 InsetIndex::InsetIndex(BufferParams const & bp)
33 : InsetCollapsable(bp)
37 InsetIndex::InsetIndex(InsetIndex const & in)
38 : InsetCollapsable(in)
42 int InsetIndex::docbook(odocstream & os, OutputParams const & runparams) const
44 os << "<indexterm><primary>";
45 int const i = InsetText::docbook(os, runparams);
46 os << "</primary></indexterm>";
51 Inset * InsetIndex::clone() const
53 return new InsetIndex(*this);
57 void InsetIndex::write(ostream & os) const
59 os << to_utf8(name()) << "\n";
60 InsetCollapsable::write(os);
64 void InsetIndex::addToToc(ParConstIterator const & cpit) const
66 ParConstIterator pit = cpit;
69 Toc & toc = buffer().tocBackend().toc("index");
71 str = getNewLabel(str);
72 toc.push_back(TocItem(pit, 0, str));
76 InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
77 : InsetCommand(p, string())
81 ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */)
83 static ParamInfo param_info_;
84 if (param_info_.empty()) {
85 param_info_.add("name", ParamInfo::LATEX_REQUIRED);
91 docstring InsetPrintIndex::screenLabel() const
97 void InsetPrintIndex::validate(LaTeXFeatures & features) const
99 features.require("makeidx");
103 InsetCode InsetPrintIndex::lyxCode() const
105 return INDEX_PRINT_CODE;