]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetTOC.cpp
Remove all BufferParam arguments in InsetXXX methods (since insets know about their...
[lyx.git] / src / insets / InsetTOC.cpp
index bc4b6201d70f59720dcdd2edf06f62e411c1a9f4..723d539d5be60f2eb0f5099fd3c0af51db3ee132 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Lars Gullik Bjønnes
+ * \author Lars Gullik Bjønnes
  *
  * Full author contact details are available in file CREDITS.
  */
 #include "Buffer.h"
 #include "DispatchResult.h"
 #include "FuncRequest.h"
-#include "gettext.h"
 #include "MetricsInfo.h"
 #include "OutputParams.h"
 #include "TocBackend.h"
 
-#include "support/std_ostream.h"
+#include "support/gettext.h"
 
+#include <ostream>
 
-namespace lyx {
+using namespace std;
 
-using std::string;
-using std::ostream;
+namespace lyx {
 
 
 InsetTOC::InsetTOC(InsetCommandParams const & p)
@@ -34,41 +33,33 @@ InsetTOC::InsetTOC(InsetCommandParams const & p)
 {}
 
 
-Inset * InsetTOC::clone() const
+ParamInfo const & InsetTOC::findInfo(string const & /* cmdName */)
 {
-       return 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 & 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");
 }
 
 
-Inset::Code InsetTOC::lyxCode() const
+int InsetTOC::plaintext(odocstream & os, OutputParams const &) const
 {
-       if (getCmdName() == "tableofcontents")
-               return Inset::TOC_CODE;
-       return Inset::NO_CODE;
-}
-
-
-int InsetTOC::plaintext(Buffer const & buffer, 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>";