]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
Inset::addToToc(): change signature. Use DocIterator instead of ParConstIterator...
[lyx.git] / src / insets / InsetTOC.cpp
index dc4bb4f360a2b40c5d0c10b8d2ce5c2905041c9b..80abdf91634d65f6e89f4c25020d342f2c1bad8e 100644 (file)
@@ -32,42 +32,33 @@ InsetTOC::InsetTOC(InsetCommandParams const & p)
 {}
 
 
-CommandInfo const * InsetTOC::findInfo(std::string const & /* cmdName */)
+ParamInfo const & InsetTOC::findInfo(string const & /* cmdName */)
 {
-       static const char * const paramnames[] = {"type", ""};
-       static const bool isoptional[] = {false};
-       static const CommandInfo info = {1, paramnames, isoptional};
-       return &info;
+       static ParamInfo param_info_;
+       if (param_info_.empty()) {
+               param_info_.add("type", ParamInfo::LATEX_REQUIRED);
+       }
+       return param_info_;
 }
 
 
-Inset * InsetTOC::clone() const
-{
-       return new InsetTOC(*this);
-}
-
-
-docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
+docstring InsetTOC::screenLabel() const
 {
        if (getCmdName() == "tableofcontents")
-               return buf.B_("Table of Contents");
+               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 << "<toc></toc>";