]> git.lyx.org Git - lyx.git/blob - src/insets/InsetIndex.cpp
cosmetics. mainly replace #include "dostring.h" by #include "strfwd.h"
[lyx.git] / src / insets / InsetIndex.cpp
1 /**
2  * \file InsetIndex.cpp
3  * This file is part of LyX, the document processor.
4  * Licence details can be found in the file COPYING.
5  *
6  * \author Lars Gullik Bjønnes
7  *
8  * Full author contact details are available in file CREDITS.
9  */
10 #include <config.h>
11
12 #include "InsetIndex.h"
13
14 #include "DispatchResult.h"
15 #include "FuncRequest.h"
16 #include "FuncStatus.h"
17 #include "gettext.h"
18 #include "LaTeXFeatures.h"
19 #include "MetricsInfo.h"
20 #include "sgml.h"
21
22 #include "support/std_ostream.h"
23
24
25 namespace lyx {
26
27 using std::string;
28 using std::ostream;
29
30
31 InsetIndex::InsetIndex(BufferParams const & bp)
32         : InsetCollapsable(bp)
33 {
34         setLayout(bp);
35 }
36
37
38 InsetIndex::InsetIndex(InsetIndex const & in)
39         : InsetCollapsable(in)
40 {}
41
42
43 int InsetIndex::docbook(Buffer const & buf, odocstream & os,
44                         OutputParams const & runparams) const
45 {
46         os << "<indexterm><primary>";
47         int const i = InsetText::docbook(buf, os, runparams);
48         os << "</primary></indexterm>";
49         return i;
50 }
51
52
53 Inset * InsetIndex::clone() const
54 {
55         return new InsetIndex(*this);
56 }
57
58
59 void InsetIndex::write(Buffer const & buf, std::ostream & os) const
60 {
61         os << to_utf8(name()) << "\n";
62         InsetCollapsable::write(buf, os);
63 }
64
65
66 InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
67         : InsetCommand(p, string())
68 {}
69
70
71 CommandInfo const * InsetPrintIndex::findInfo(std::string const & /* cmdName */)
72 {
73         static const char * const paramnames[] = {"name", ""};
74         static const bool isoptional[] = {false};
75         static const CommandInfo info = {1, paramnames, isoptional};
76         return &info;
77 }
78
79
80 docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
81 {
82         return _("Index");
83 }
84
85
86 void InsetPrintIndex::validate(LaTeXFeatures & features) const
87 {
88         features.require("makeidx");
89 }
90
91
92 InsetCode InsetPrintIndex::lyxCode() const
93 {
94         return INDEX_PRINT_CODE;
95 }
96
97
98 } // namespace lyx