]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
This is the first of a series of commits that will make InsetLayout a real class.
[lyx.git] / src / TextClass.cpp
index 78e3fcf7d6fc4f1b07ee54fbf46c9f467d7ace24..2dbd10b6f364d82d679f1fbb29f47afc33c5241a 100644 (file)
@@ -35,7 +35,6 @@
 #include "support/os.h"
 
 #include <sstream>
-#include <strstream>
 
 using namespace std;
 using namespace lyx::support;
@@ -134,6 +133,9 @@ TextClass::TextClass(string const & fn, string const & cln,
 docstring const TextClass::emptylayout_ = from_ascii("PlainLayout");
 
 
+InsetLayout TextClass::empty_insetlayout_;
+
+
 bool TextClass::isTeXClassAvailable() const
 {
        return texClassAvail_;
@@ -236,7 +238,7 @@ bool TextClass::read(FileName const & filename, ReadType rt)
                        "AlignPossible Left, Right, Center\n"
                        "LabelType No_Label\n"
                        "End";
-               istrstream ss(s);
+               istringstream ss(s);
                Lexer lex(textClassTags, sizeof(textClassTags) / sizeof(textClassTags[0]));
                lex.setStream(ss);
                Layout lay;
@@ -822,27 +824,27 @@ void TextClass::readInsetLayout(Lexer & lexrc, docstring const & name)
        // Here add element to list if getout == true
        if (getout) {
                InsetLayout il;
-               il.name = to_ascii(name);
-               il.lyxtype = lyxtype;
-               il.labelstring = labelstring;
-               il.decoration = decoration;
-               il.latextype = latextype;
-               il.latexname = latexname;
-               il.latexparam = latexparam;
-               il.multipar = multipar;
-               il.passthru = passthru;
-               il.needprotect = needprotect;
-               il.freespacing = freespacing;
-               il.forceltr = forceltr;
-               il.keepempty = keepempty;
-               il.font = font;
+               il.name_ = to_ascii(name);
+               il.lyxtype_ = lyxtype;
+               il.labelstring_ = labelstring;
+               il.decoration_ = decoration;
+               il.latextype_ = latextype;
+               il.latexname_ = latexname;
+               il.latexparam_ = latexparam;
+               il.multipar_ = multipar;
+               il.passthru_ = passthru;
+               il.needprotect_ = needprotect;
+               il.freespacing_ = freespacing;
+               il.forceltr_ = forceltr;
+               il.keepempty_ = keepempty;
+               il.font_ = font;
                // The label font is generally used as-is without
                // any realization against a given context.
                labelfont.realize(sane_font);
-               il.labelfont = labelfont;
-               il.bgcolor = bgcolor;
-               il.preamble = preamble;
-               il.requires = requires;
+               il.labelfont_ = labelfont;
+               il.bgcolor_ = bgcolor;
+               il.preamble_ = preamble;
+               il.requires_ = requires;
                insetlayoutlist_[name] = il;
        }
 
@@ -1169,12 +1171,7 @@ InsetLayout const & TextClass::insetlayout(docstring const & name) const
                        break;
                n = n.substr(0,i);
        }
-       static InsetLayout empty;
-       empty.labelstring = from_utf8("UNDEFINED");
-       empty.labelfont = sane_font;
-       empty.labelfont.setColor(Color_error);
-       empty.bgcolor = Color_error;
-       return empty;
+       return empty_insetlayout_;
 }