]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
This should be the last of the commits refactoring the InsetLayout code.
[lyx.git] / src / insets / InsetTOC.cpp
index 2c74aea5f2d190b5901609c0d3e7ea913d681e46..d1d0e8b5489534dcae4745340b64ab88029df22d 100644 (file)
 #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 <ostream>
 
+using namespace std;
 
 namespace lyx {
 
-using std::string;
-using std::ostream;
-
 
 InsetTOC::InsetTOC(InsetCommandParams const & p)
        : InsetCommand(p, "toc")
 {}
 
 
-std::auto_ptr<Inset> InsetTOC::doClone() const
+CommandInfo const * InsetTOC::findInfo(string const & /* cmdName */)
 {
-       return std::auto_ptr<Inset>(new InsetTOC(*this));
+       static const char * const paramnames[] = {"type", ""};
+       static const bool isoptional[] = {false};
+       static const CommandInfo info = {1, paramnames, isoptional};
+       return &info;
 }
 
 
-docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
+Inset * InsetTOC::clone() const
 {
-       if (getCmdName() == "tableofcontents")
-               return buf.B_("Table of Contents");
-       return _("Unknown TOC type");
+       return new InsetTOC(*this);
 }
 
 
-Inset::Code InsetTOC::lyxCode() const
+docstring const InsetTOC::getScreenLabel(Buffer const & buf) const
 {
        if (getCmdName() == "tableofcontents")
-               return Inset::TOC_CODE;
-       return Inset::NO_CODE;
+               return buf.B_("Table of Contents");
+       return _("Unknown TOC type");
 }
 
 
 int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
-                        OutputParams const &) const
+                       OutputParams const &) const
 {
        os << getScreenLabel(buffer) << "\n\n";
 
@@ -68,7 +67,7 @@ int InsetTOC::plaintext(Buffer const & buffer, odocstream & os,
 
 
 int InsetTOC::docbook(Buffer const &, odocstream & os,
-                      OutputParams const &) const
+                     OutputParams const &) const
 {
        if (getCmdName() == "tableofcontents")
                os << "<toc></toc>";