2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
|
* \file InsetTOC.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
|
|
|
|
*/
|
2003-10-28 11:18:40 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include <config.h>
|
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
|
#include "InsetTOC.h"
|
2003-09-04 01:18:42 +00:00
|
|
|
|
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "Buffer.h"
|
|
|
|
|
#include "DispatchResult.h"
|
|
|
|
|
#include "FuncRequest.h"
|
2003-09-04 01:18:42 +00:00
|
|
|
|
#include "gettext.h"
|
2007-04-26 04:41:58 +00:00
|
|
|
|
#include "MetricsInfo.h"
|
|
|
|
|
#include "OutputParams.h"
|
2006-11-11 00:35:14 +00:00
|
|
|
|
#include "TocBackend.h"
|
2003-09-04 01:18:42 +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;
|
2002-02-16 15:59:55 +00:00
|
|
|
|
using std::ostream;
|
|
|
|
|
|
2000-04-04 00:19:15 +00:00
|
|
|
|
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetTOC::InsetTOC(InsetCommandParams const & p)
|
2003-12-11 15:23:15 +00:00
|
|
|
|
: InsetCommand(p, "toc")
|
2003-02-25 14:51:38 +00:00
|
|
|
|
{}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
std::auto_ptr<Inset> InsetTOC::doClone() const
|
2000-04-04 00:19:15 +00:00
|
|
|
|
{
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return std::auto_ptr<Inset>(new InsetTOC(*this));
|
2003-10-28 11:18:40 +00:00
|
|
|
|
}
|
|
|
|
|
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2007-05-01 08:26:40 +00:00
|
|
|
|
docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
|
2003-10-28 11:18:40 +00:00
|
|
|
|
{
|
|
|
|
|
if (getCmdName() == "tableofcontents")
|
2007-05-01 08:26:40 +00:00
|
|
|
|
return buf.B_("Table of Contents");
|
|
|
|
|
return _("Unknown TOC type");
|
2000-08-01 17:33:32 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
|
Inset::Code InsetTOC::lyxCode() const
|
2000-08-01 17:33:32 +00:00
|
|
|
|
{
|
2003-10-28 11:18:40 +00:00
|
|
|
|
if (getCmdName() == "tableofcontents")
|
2007-04-29 13:39:47 +00:00
|
|
|
|
return Inset::TOC_CODE;
|
|
|
|
|
return Inset::NO_CODE;
|
2000-04-04 00:19:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2006-10-19 16:51:30 +00:00
|
|
|
|
int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const
|
2001-01-11 14:55:36 +00:00
|
|
|
|
{
|
2001-07-28 12:24:16 +00:00
|
|
|
|
os << getScreenLabel(buffer) << "\n\n";
|
2001-01-11 14:55:36 +00:00
|
|
|
|
|
2007-01-18 22:29:50 +00:00
|
|
|
|
buffer.tocBackend().writePlaintextTocList(getCmdName(), os);
|
2001-05-04 10:36:36 +00:00
|
|
|
|
|
2007-02-20 17:52:41 +00:00
|
|
|
|
return PLAINTEXT_NEWLINE;
|
2001-01-11 14:55:36 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-08-01 17:33:32 +00:00
|
|
|
|
|
2006-10-19 21:00:33 +00:00
|
|
|
|
int InsetTOC::docbook(Buffer const &, odocstream & os,
|
2007-05-28 22:27:45 +00:00
|
|
|
|
OutputParams const &) const
|
2000-03-06 02:42:40 +00:00
|
|
|
|
{
|
2001-04-27 07:58:56 +00:00
|
|
|
|
if (getCmdName() == "tableofcontents")
|
2000-08-01 17:33:32 +00:00
|
|
|
|
os << "<toc></toc>";
|
2000-03-06 02:42:40 +00:00
|
|
|
|
return 0;
|
|
|
|
|
}
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace lyx
|