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
|
|
|
|
|
2008-02-15 10:13:32 +00:00
|
|
|
|
#include "Buffer.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "DispatchResult.h"
|
|
|
|
|
#include "FuncRequest.h"
|
2007-10-03 13:38:19 +00:00
|
|
|
|
#include "FuncStatus.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"
|
2008-02-13 13:19:39 +00:00
|
|
|
|
#include "TocBackend.h"
|
|
|
|
|
|
|
|
|
|
#include "support/gettext.h"
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2007-11-06 21:45:24 +00:00
|
|
|
|
#include <ostream>
|
2003-10-06 15:43:21 +00:00
|
|
|
|
|
2007-12-12 10:16:00 +00:00
|
|
|
|
using namespace std;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
namespace lyx {
|
2006-10-11 19:40:50 +00:00
|
|
|
|
|
2003-09-05 09:01:27 +00:00
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
|
InsetIndex::InsetIndex(BufferParams const & bp)
|
|
|
|
|
: InsetCollapsable(bp)
|
2007-11-02 17:47:51 +00:00
|
|
|
|
{}
|
2007-10-03 13:38:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
InsetIndex::InsetIndex(InsetIndex const & in)
|
|
|
|
|
: InsetCollapsable(in)
|
2000-07-15 23:51:46 +00:00
|
|
|
|
{}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
|
int InsetIndex::docbook(Buffer const & buf, odocstream & os,
|
|
|
|
|
OutputParams const & runparams) const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2007-10-03 13:38:19 +00:00
|
|
|
|
os << "<indexterm><primary>";
|
|
|
|
|
int const i = InsetText::docbook(buf, os, runparams);
|
|
|
|
|
os << "</primary></indexterm>";
|
|
|
|
|
return i;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2003-08-26 10:33:59 +00:00
|
|
|
|
|
2007-10-03 13:38:19 +00:00
|
|
|
|
Inset * InsetIndex::clone() const
|
2001-07-23 09:11:14 +00:00
|
|
|
|
{
|
2007-10-03 13:38:19 +00:00
|
|
|
|
return new InsetIndex(*this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-12-12 19:28:07 +00:00
|
|
|
|
void InsetIndex::write(Buffer const & buf, ostream & os) const
|
2007-10-03 13:38:19 +00:00
|
|
|
|
{
|
|
|
|
|
os << to_utf8(name()) << "\n";
|
|
|
|
|
InsetCollapsable::write(buf, os);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2008-02-15 10:13:32 +00:00
|
|
|
|
void InsetIndex::addToToc(Buffer const & buf,
|
2008-02-15 08:39:58 +00:00
|
|
|
|
ParConstIterator const & cpit) const
|
2008-02-13 13:19:39 +00:00
|
|
|
|
{
|
2008-02-15 08:39:58 +00:00
|
|
|
|
ParConstIterator pit = cpit;
|
|
|
|
|
pit.push_back(*this);
|
2008-02-13 13:19:39 +00:00
|
|
|
|
|
2008-02-15 10:13:32 +00:00
|
|
|
|
Toc & toc = buf.tocBackend().toc("index");
|
2008-02-13 13:19:39 +00:00
|
|
|
|
docstring str;
|
|
|
|
|
str = getNewLabel(str);
|
|
|
|
|
toc.push_back(TocItem(pit, 0, str));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2008-02-23 22:01:02 +00:00
|
|
|
|
ParamInfo const & InsetPrintIndex::findInfo(string const & /* cmdName */)
|
2007-10-25 04:13:56 +00:00
|
|
|
|
{
|
2008-02-23 22:01:02 +00:00
|
|
|
|
static ParamInfo param_info_;
|
|
|
|
|
if (param_info_.empty()) {
|
|
|
|
|
param_info_.add("name", false);
|
|
|
|
|
}
|
|
|
|
|
return param_info_;
|
2007-10-25 04:13:56 +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-10-13 09:04:52 +00:00
|
|
|
|
InsetCode InsetPrintIndex::lyxCode() const
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
2007-10-13 09:04:52 +00:00
|
|
|
|
return INDEX_PRINT_CODE;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|