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"
14 #include "dispatchresult.h"
15 #include "funcrequest.h"
17 #include "LaTeXFeatures.h"
18 #include "metricsinfo.h"
20 #include "support/std_ostream.h"
26 InsetIndex::InsetIndex(InsetCommandParams const & p)
31 // InsetIndex::InsetIndex(InsetCommandParams const & p, bool)
32 // : InsetCommand(p, false)
36 InsetIndex::~InsetIndex()
38 InsetCommandMailer mailer("index", *this);
43 string const InsetIndex::getScreenLabel(Buffer const &) const
49 void InsetPrintIndex::metrics(MetricsInfo & mi, Dimension & dim) const
51 InsetCommand::metrics(mi, dim);
52 center_indent_ = (mi.base.textwidth - dim.wid) / 2;
53 dim.wid = mi.base.textwidth;
58 void InsetPrintIndex::draw(PainterInfo & pi, int x, int y) const
60 InsetCommand::draw(pi, x + center_indent_, y);
64 DispatchResult InsetIndex::priv_dispatch(FuncRequest const & cmd,
65 idx_type & idx, pos_type & pos)
68 case LFUN_MOUSE_RELEASE:
69 InsetCommandMailer("index", *this).showDialog(cmd.view());
70 return DispatchResult(true, true);
73 return InsetCommand::priv_dispatch(cmd, idx, pos);
78 int InsetIndex::docbook(Buffer const &, ostream & os,
79 OutputParams const &) const
81 os << "<indexterm><primary>" << getContents()
82 << "</primary></indexterm>";
87 InsetOld::Code InsetIndex::lyxCode() const
89 return InsetOld::INDEX_CODE;
94 InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
99 // InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p, bool)
100 // : InsetCommand(p, false)
104 InsetPrintIndex::~InsetPrintIndex()
108 string const InsetPrintIndex::getScreenLabel(Buffer const &) const
114 void InsetPrintIndex::validate(LaTeXFeatures & features) const
116 features.require("makeidx");
120 InsetOld::Code InsetPrintIndex::lyxCode() const
122 return InsetOld::INDEX_PRINT_CODE;