#include "DispatchResult.h"
#include "FuncRequest.h"
-#include "gettext.h"
+#include "FuncStatus.h"
+#include "support/gettext.h"
#include "LaTeXFeatures.h"
#include "MetricsInfo.h"
#include "sgml.h"
-#include "support/std_ostream.h"
+#include <ostream>
+using namespace std;
namespace lyx {
-using std::string;
-using std::ostream;
+
+InsetIndex::InsetIndex(BufferParams const & bp)
+ : InsetCollapsable(bp)
+{}
-InsetIndex::InsetIndex(InsetCommandParams const & p)
- : InsetCommand(p, "index")
+InsetIndex::InsetIndex(InsetIndex const & in)
+ : InsetCollapsable(in)
{}
-docstring const InsetIndex::getScreenLabel(Buffer const &) const
+int InsetIndex::docbook(Buffer const & buf, odocstream & os,
+ OutputParams const & runparams) const
{
- size_t const maxLabelChars = 25;
-
- docstring label = _("Idx: ") + getParam("name");
- if (label.size() > maxLabelChars) {
- label.erase(maxLabelChars - 3);
- label += "...";
- }
- return label;
+ os << "<indexterm><primary>";
+ int const i = InsetText::docbook(buf, os, runparams);
+ os << "</primary></indexterm>";
+ return i;
}
-int InsetIndex::docbook(Buffer const &, odocstream & os,
- OutputParams const &) const
+Inset * InsetIndex::clone() const
{
- os << "<indexterm><primary>"
- << sgml::escapeString(getParam("name"))
- << "</primary></indexterm>";
- return 0;
+ return new InsetIndex(*this);
}
-Inset::Code InsetIndex::lyxCode() const
+void InsetIndex::write(Buffer const & buf, ostream & os) const
{
- return Inset::INDEX_CODE;
+ os << to_utf8(name()) << "\n";
+ InsetCollapsable::write(buf, os);
}
-
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
: InsetCommand(p, string())
{}
+CommandInfo const * InsetPrintIndex::findInfo(string const & /* cmdName */)
+{
+ static const char * const paramnames[] = {"name", ""};
+ static const bool isoptional[] = {false};
+ static const CommandInfo info = {1, paramnames, isoptional};
+ return &info;
+}
+
+
docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
{
return _("Index");
}
-Inset::Code InsetPrintIndex::lyxCode() const
+InsetCode InsetPrintIndex::lyxCode() const
{
- return Inset::INDEX_PRINT_CODE;
+ return INDEX_PRINT_CODE;
}