3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
6 * \author Lars Gullik Bjønnes
8 * Full author contact details are available in file CREDITS.
16 #include "dispatchresult.h"
17 #include "funcrequest.h"
19 #include "metricsinfo.h"
20 #include "outputparams.h"
21 #include "TocBackend.h"
23 #include "support/std_ostream.h"
32 InsetTOC::InsetTOC(InsetCommandParams const & p)
33 : InsetCommand(p, "toc")
37 std::auto_ptr<InsetBase> InsetTOC::doClone() const
39 return std::auto_ptr<InsetBase>(new InsetTOC(*this));
43 docstring const InsetTOC::getScreenLabel(Buffer const &) const
45 if (getCmdName() == "tableofcontents")
46 return _("Table of Contents");
47 return _("Unknown toc list");
51 InsetBase::Code InsetTOC::lyxCode() const
53 if (getCmdName() == "tableofcontents")
54 return InsetBase::TOC_CODE;
55 return InsetBase::NO_CODE;
59 int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
60 OutputParams const & runparams) const
62 os << getScreenLabel(buffer) << "\n\n";
64 buffer.tocBackend().writePlaintextTocList(getCmdName(), os);
66 return runparams.linelen; // start with column 0 in new line
70 int InsetTOC::docbook(Buffer const &, odocstream & os,
71 OutputParams const &) const
73 if (getCmdName() == "tableofcontents")