2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetIndex.cpp
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2002-09-25 14:26:13 +00:00
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetIndex.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "DispatchResult.h"
|
|
|
|
|
#include "FuncRequest.h"
|
2001-04-05 12:26:41 +00:00
|
|
|
|
#include "gettext.h"
|
2003-09-05 09:01:27 +00:00
|
|
|
|
#include "LaTeXFeatures.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
2004-10-25 00:26:05 +00:00
|
|
|
|
#include "sgml.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-10-10 21:08:55 +00:00
|
|
|
|
#include "support/std_ostream.h"
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2006-10-11 19:40:50 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
using std::string;
|
2001-11-03 11:43:23 +00:00
|
|
|
|
using std::ostream;
|
|
|
|
|
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetIndex::InsetIndex(InsetCommandParams const & p)
|
2003-12-11 15:23:15 +00:00
|
|
|
|
: InsetCommand(p, "index")
|
2000-07-15 23:51:46 +00:00
|
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
|
docstring const InsetIndex::getScreenLabel(Buffer const &) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2007-09-16 14:08:16 +00:00
|
|
|
|
size_t const maxLabelChars = 25;
|
|
|
|
|
|
|
|
|
|
docstring label = "Idx:" + getParam("name");
|
|
|
|
|
if (label.size() > maxLabelChars) {
|
|
|
|
|
label.erase(maxLabelChars - 3);
|
|
|
|
|
label += "...";
|
|
|
|
|
}
|
|
|
|
|
return label;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-26 10:33:59 +00:00
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
|
int InsetIndex::docbook(Buffer const &, odocstream & os,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &) const
|
2001-11-02 16:11:19 +00:00
|
|
|
|
{
|
2006-10-19 21:00:33 +00:00
|
|
|
|
os << "<indexterm><primary>"
|
2007-05-28 22:27:45 +00:00
|
|
|
|
<< sgml::escapeString(getParam("name"))
|
2002-05-01 22:17:09 +00:00
|
|
|
|
<< "</primary></indexterm>";
|
|
|
|
|
return 0;
|
2001-11-02 16:11:19 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::Code InsetIndex::lyxCode() const
|
2001-07-23 09:11:14 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return Inset::INDEX_CODE;
|
2001-07-23 09:11:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-05-16 07:44:00 +00:00
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetPrintIndex::InsetPrintIndex(InsetCommandParams const & p)
|
2003-12-11 15:23:15 +00:00
|
|
|
|
: InsetCommand(p, string())
|
2000-07-15 23:51:46 +00:00
|
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-05-01 22:17:09 +00:00
|
|
|
|
|
2006-10-11 19:40:50 +00:00
|
|
|
|
docstring const InsetPrintIndex::getScreenLabel(Buffer const &) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2006-10-11 19:40:50 +00:00
|
|
|
|
return _("Index");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void InsetPrintIndex::validate(LaTeXFeatures & features) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2001-11-19 15:34:11 +00:00
|
|
|
|
features.require("makeidx");
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::Code InsetPrintIndex::lyxCode() const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return Inset::INDEX_PRINT_CODE;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|