lyx_mirror/src/insets/InsetTOC.cpp
Bo Peng 00e305c9d9 Rename .C ==> .cpp for files in src, part one
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18018 a592a061-630c-0410-9148-cb99ea01b6c8
2007-04-26 04:41:58 +00:00

80 lines
1.5 KiB
C++

/**
* \file InsetTOC.cpp
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Lars Gullik Bjønnes
*
* Full author contact details are available in file CREDITS.
*/
#include <config.h>
#include "InsetTOC.h"
#include "Buffer.h"
#include "DispatchResult.h"
#include "FuncRequest.h"
#include "gettext.h"
#include "MetricsInfo.h"
#include "OutputParams.h"
#include "TocBackend.h"
#include "support/std_ostream.h"
namespace lyx {
using std::string;
using std::ostream;
InsetTOC::InsetTOC(InsetCommandParams const & p)
: InsetCommand(p, "toc")
{}
std::auto_ptr<InsetBase> InsetTOC::doClone() const
{
return std::auto_ptr<InsetBase>(new InsetTOC(*this));
}
docstring const InsetTOC::getScreenLabel(Buffer const &) const
{
if (getCmdName() == "tableofcontents")
return _("Table of Contents");
return _("Unknown toc list");
}
InsetBase::Code InsetTOC::lyxCode() const
{
if (getCmdName() == "tableofcontents")
return InsetBase::TOC_CODE;
return InsetBase::NO_CODE;
}
int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
OutputParams const &) const
{
os << getScreenLabel(buffer) << "\n\n";
buffer.tocBackend().writePlaintextTocList(getCmdName(), os);
return PLAINTEXT_NEWLINE;
}
int InsetTOC::docbook(Buffer const &, odocstream & os,
OutputParams const &) const
{
if (getCmdName() == "tableofcontents")
os << "<toc></toc>";
return 0;
}
} // namespace lyx