]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
Add empty InsetLayout for undefined cases. Should avoid possible bugs caused by empty...
[lyx.git] / src / TextClass.cpp
index 78e3fcf7d6fc4f1b07ee54fbf46c9f467d7ace24..7f640b85be0f4a65d28d74a596dd867282e5a5c6 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;
@@ -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_;
 }