X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetTOC.cpp;h=83e5560cc6474821722d0b5e52216ad10d28b124;hb=d8a6b5bfd0baa02a4ba03f8c9e9c618baf41b03f;hp=801e5aa5653ebded2e66eeb0921f877ff902f582;hpb=32871c1284f15265f652ff01c438e539a7c8181f;p=lyx.git diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp index 801e5aa565..83e5560cc6 100644 --- a/src/insets/InsetTOC.cpp +++ b/src/insets/InsetTOC.cpp @@ -15,60 +15,56 @@ #include "Buffer.h" #include "DispatchResult.h" #include "FuncRequest.h" -#include "gettext.h" +#include "support/gettext.h" #include "MetricsInfo.h" #include "OutputParams.h" #include "TocBackend.h" -#include "support/std_ostream.h" +#include +using namespace std; namespace lyx { -using std::string; -using std::ostream; - InsetTOC::InsetTOC(InsetCommandParams const & p) : InsetCommand(p, "toc") {} -std::auto_ptr InsetTOC::doClone() const +ParamInfo const & InsetTOC::findInfo(string const & /* cmdName */) { - return std::auto_ptr(new InsetTOC(*this)); + static ParamInfo param_info_; + if (param_info_.empty()) { + param_info_.add("type", ParamInfo::LATEX_REQUIRED); + } + return param_info_; } -docstring const InsetTOC::getScreenLabel(Buffer const &) const +Inset * InsetTOC::clone() const { - if (getCmdName() == "tableofcontents") - return _("Table of Contents"); - return _("Unknown toc list"); + return new InsetTOC(*this); } -Inset::Code InsetTOC::lyxCode() const +docstring InsetTOC::screenLabel() const { if (getCmdName() == "tableofcontents") - return Inset::TOC_CODE; - return Inset::NO_CODE; + return buffer().B_("Table of Contents"); + return _("Unknown TOC type"); } -int InsetTOC::plaintext(Buffer const & buffer, odocstream & os, - OutputParams const &) const +int InsetTOC::plaintext(odocstream & os, OutputParams const &) const { - os << getScreenLabel(buffer) << "\n\n"; - - buffer.tocBackend().writePlaintextTocList(getCmdName(), os); - + os << screenLabel() << "\n\n"; + buffer().tocBackend().writePlaintextTocList(getCmdName(), os); return PLAINTEXT_NEWLINE; } -int InsetTOC::docbook(Buffer const &, odocstream & os, - OutputParams const &) const +int InsetTOC::docbook(odocstream & os, OutputParams const &) const { if (getCmdName() == "tableofcontents") os << "";