]> git.lyx.org Git - features.git/blob - src/insets/InsetIndex.cpp
Move debug.{cpp,h}, Messages.{cpp,h} and gettext.{cpp,h} to support/.
[features.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 "support/gettext.h"
18 #include "LaTeXFeatures.h"
19 #include "MetricsInfo.h"
20 #include "sgml.h"
21
22 #include <ostream>
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
35
36 InsetIndex::InsetIndex(InsetIndex const & in)
37         : InsetCollapsable(in)
38 {}
39
40
41 int InsetIndex::docbook(Buffer const & buf, odocstream & os,
42                         OutputParams const & runparams) const
43 {
44         os << "<indexterm><primary>";
45         int const i = InsetText::docbook(buf, os, runparams);
46         os << "</primary></indexterm>";
47         return i;
48 }
49
50
51 Inset * InsetIndex::clone() const
52 {
53         return new InsetIndex(*this);
54 }
55
56
57 void InsetIndex::write(Buffer const & buf, std::ostream & os) const
58 {
59         os << to_utf8(name()) << "\n";
60         InsetCollapsable::write(buf, os);
61 }
62
63
64 InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
65         : InsetCommand(p, string())
66 {}
67
68
69 CommandInfo const * InsetPrintIndex::findInfo(std::string const & /* cmdName */)
70 {
71         static const char * const paramnames[] = {"name", ""};
72         static const bool isoptional[] = {false};
73         static const CommandInfo info = {1, paramnames, isoptional};
74         return &info;
75 }
76
77
78 docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
79 {
80         return _("Index");
81 }
82
83
84 void InsetPrintIndex::validate(LaTeXFeatures & features) const
85 {
86         features.require("makeidx");
87 }
88
89
90 InsetCode InsetPrintIndex::lyxCode() const
91 {
92         return INDEX_PRINT_CODE;
93 }
94
95
96 } // namespace lyx