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.
15 #include "dispatchresult.h"
16 #include "funcrequest.h"
18 #include "metricsinfo.h"
21 #include "support/std_ostream.h"
28 InsetTOC::InsetTOC(InsetCommandParams const & p)
35 InsetCommandMailer("toc", *this).hideDialog();
39 std::auto_ptr<InsetBase> InsetTOC::clone() const
41 return std::auto_ptr<InsetBase>(new InsetTOC(*this));
45 string const InsetTOC::getScreenLabel(Buffer const &) const
47 if (getCmdName() == "tableofcontents")
48 return _("Table of Contents");
49 return _("Unknown toc list");
53 InsetOld::Code InsetTOC::lyxCode() const
55 if (getCmdName() == "tableofcontents")
56 return InsetOld::TOC_CODE;
57 return InsetOld::NO_CODE;
62 InsetTOC::priv_dispatch(FuncRequest const & cmd,
63 idx_type & idx, pos_type & pos)
66 case LFUN_MOUSE_RELEASE:
67 case LFUN_INSET_DIALOG_SHOW:
68 InsetCommandMailer("toc", *this).showDialog(cmd.view());
69 return DispatchResult(true, true);
72 return InsetCommand::priv_dispatch(cmd, idx, pos);
77 int InsetTOC::plaintext(Buffer const & buffer, ostream & os,
78 OutputParams const &) const
80 os << getScreenLabel(buffer) << "\n\n";
82 lyx::toc::asciiTocList(lyx::toc::getType(getCmdName()), buffer, os);
89 int InsetTOC::linuxdoc(Buffer const &, ostream & os,
90 OutputParams const &) const
92 if (getCmdName() == "tableofcontents")
98 int InsetTOC::docbook(Buffer const &, ostream & os,
99 OutputParams const &) const
101 if (getCmdName() == "tableofcontents")