]> git.lyx.org Git - features.git/blobdiff - src/insets/InsetFlex.cpp
* Do not keep pointers to data structures around if you don't know
[features.git] / src / insets / InsetFlex.cpp
index 50c16a50cd33208da615ca673f8ad22da243ba94..9555cb2461a1bc69bdd18430af5741152095cd01 100644 (file)
@@ -43,12 +43,13 @@ namespace lyx {
 
 
 InsetFlex::InsetFlex(BufferParams const & bp,
-                               InsetLayout const & il)
-       : InsetCollapsable(bp, Collapsed, &il)
+       TextClassPtr tc, string const & layoutName)
+       : InsetCollapsable(bp, Collapsed, tc),
+       name_(layoutName)
 {
-       name_ = il.name;
-       packages_ = il.requires;
-       preamble_ = il.preamble;
+       setLayout(tc); // again, because now the name is initialized
+       packages_ = getLayout().requires;
+       preamble_ = getLayout().preamble;
 }
 
 
@@ -65,7 +66,7 @@ Inset * InsetFlex::clone() const
 
 bool InsetFlex::undefined() const
 {
-       return layout_->labelstring == from_utf8("UNDEFINED");
+       return getLayout().labelstring == from_utf8("UNDEFINED");
 }
 
 
@@ -118,8 +119,8 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os,
        ParagraphList::const_iterator end = paragraphs().end();
 
        if (!undefined())
-               sgml::openTag(os, layout_->latexname,
-                             par->getID(buf, runparams) + layout_->latexparam);
+               sgml::openTag(os, getLayout().latexname,
+                             par->getID(buf, runparams) + getLayout().latexparam);
 
        for (; par != end; ++par) {
                par->simpleDocBookOnePar(buf, os, runparams,
@@ -128,7 +129,7 @@ int InsetFlex::docbook(Buffer const & buf, odocstream & os,
        }
 
        if (!undefined())
-               sgml::closeTag(os, layout_->latexname);
+               sgml::closeTag(os, getLayout().latexname);
 
        return 0;
 }