]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetFlex.cpp
Inset::addToToc(): change signature. Use DocIterator instead of ParConstIterator...
[lyx.git] / src / insets / InsetFlex.cpp
index 45e8b739d756a2ce5af012f4e6d14d57acd9c498..1972f52295008016d09b6f3c6d007702bc90ae20 100644 (file)
 
 #include "Buffer.h"
 #include "BufferParams.h"
-#include "BufferView.h"
-#include "DispatchResult.h"
-#include "FuncRequest.h"
-#include "FuncStatus.h"
-#include "Cursor.h"
 #include "support/gettext.h"
 #include "LaTeXFeatures.h"
 #include "Lexer.h"
 #include "paragraph_funcs.h"
 #include "sgml.h"
 
-#include "support/convert.h"
-
-#include <sstream>
+#include <ostream>
 
 using namespace std;
 
 namespace lyx {
 
 
-InsetFlex::InsetFlex(BufferParams const & bp,
-       TextClassPtr tc, string const & layoutName)
-       : InsetCollapsable(bp, Collapsed, tc),
-       name_(layoutName)
+InsetFlex::InsetFlex(Buffer const & buf, string const & layoutName)
+       : InsetCollapsable(buf, Collapsed), name_(layoutName)
 {
-       setLayout(tc); // again, because now the name is initialized
+       // again, because now the name is initialized
+       setLayout(buf.params().documentClassPtr());
        packages_ = getLayout().requires();
        preamble_ = getLayout().preamble();
 }
@@ -55,12 +47,6 @@ InsetFlex::InsetFlex(InsetFlex const & in)
 {}
 
 
-Inset * InsetFlex::clone() const
-{
-       return new InsetFlex(*this);
-}
-
-
 docstring InsetFlex::editMessage() const
 {
        return _("Opened Flex Inset");
@@ -77,17 +63,14 @@ void InsetFlex::write(ostream & os) const
 
 void InsetFlex::read(Lexer & lex)
 {
+       string token;
        while (lex.isOK()) {
-               lex.next();
-               string token = lex.getString();
-
+               lex >> token;
                if (token == "Flex") {
                        lex.next();
                        name_ = lex.getString();
-               }
-
-               // This is handled in Collapsable
-               else if (token == "status") {
+               } else if (token == "status") {
+                       // This is handled in Collapsable
                        lex.pushToken(token);
                        break;
                }