]> git.lyx.org Git - lyx.git/blob - src/insets/insetindex.C
Re-add the RasterImage template.
[lyx.git] / src / insets / insetindex.C
1 /**
2  * \file insetindex.C
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 "funcrequest.h"
15 #include "gettext.h"
16 #include "LaTeXFeatures.h"
17 #include "metricsinfo.h"
18
19 using std::ostream;
20
21
22 InsetIndex::InsetIndex(InsetCommandParams const & p)
23         : InsetCommand(p)
24 {}
25
26
27 // InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
28 //      : InsetCommand(p, false)
29 // {}
30
31
32 InsetIndex::~InsetIndex()
33 {
34         InsetCommandMailer mailer("index", *this);
35         mailer.hideDialog();
36 }
37
38
39 string const InsetIndex::getScreenLabel(Buffer const &) const
40 {
41         return _("Idx");
42 }
43
44
45 void InsetPrintIndex::metrics(MetricsInfo & mi, Dimension & dim) const
46 {
47         InsetCommand::metrics(mi, dim);
48         center_indent_ = (mi.base.textwidth - dim.wid) / 2;
49         dim.wid = mi.base.textwidth;
50         dim_ = dim;
51 }
52
53
54 void InsetPrintIndex::draw(PainterInfo & pi, int x, int y) const
55 {
56                     InsetCommand::draw(pi, x + center_indent_, y);
57 }
58
59
60 dispatch_result InsetIndex::localDispatch(FuncRequest const & cmd)
61 {
62         switch (cmd.action) {
63                 case LFUN_INSET_EDIT:
64                         InsetCommandMailer("index", *this).showDialog(cmd.view());
65                         return DISPATCHED;
66
67                 default:
68                         return InsetCommand::localDispatch(cmd);
69         }
70 }
71
72
73 int InsetIndex::docbook(Buffer const &, ostream & os, bool) const
74 {
75         os << "<indexterm><primary>" << getContents()
76            << "</primary></indexterm>";
77         return 0;
78 }
79
80
81 InsetOld::Code InsetIndex::lyxCode() const
82 {
83         return InsetOld::INDEX_CODE;
84 }
85
86
87
88 InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
89         : InsetCommand(p)
90 {}
91
92
93 // InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
94 //      : InsetCommand(p, false)
95 // {}
96
97
98 InsetPrintIndex::~InsetPrintIndex()
99 {}
100
101
102 string const InsetPrintIndex::getScreenLabel(Buffer const &) const
103 {
104         return _("Index");
105 }
106
107
108 void InsetPrintIndex::validate(LaTeXFeatures & features) const
109 {
110         features.require("makeidx");
111 }
112
113
114 InsetOld::Code InsetPrintIndex::lyxCode() const
115 {
116         return InsetOld::INDEX_PRINT_CODE;
117 }