+namespace {
+
+LexerKeyword textClassTags[] = {
+ { "addtohtmlpreamble", TC_ADDTOHTMLPREAMBLE },
+ { "addtohtmlstyles", TC_ADDTOHTMLSTYLES },
+ { "addtopreamble", TC_ADDTOPREAMBLE },
+ { "citeengine", TC_CITEENGINE },
+ { "citeenginetype", TC_CITEENGINETYPE },
+ { "citeformat", TC_CITEFORMAT },
+ { "classoptions", TC_CLASSOPTIONS },
+ { "columns", TC_COLUMNS },
+ { "counter", TC_COUNTER },
+ { "defaultbiblio", TC_DEFAULTBIBLIO },
+ { "defaultfont", TC_DEFAULTFONT },
+ { "defaultmodule", TC_DEFAULTMODULE },
+ { "defaultstyle", TC_DEFAULTSTYLE },
+ { "excludesmodule", TC_EXCLUDESMODULE },
+ { "float", TC_FLOAT },
+ { "format", TC_FORMAT },
+ { "fullauthorlist", TC_FULLAUTHORLIST },
+ { "htmlpreamble", TC_HTMLPREAMBLE },
+ { "htmlstyles", TC_HTMLSTYLES },
+ { "htmltocsection", TC_HTMLTOCSECTION },
+ { "ifcounter", TC_IFCOUNTER },
+ { "input", TC_INPUT },
+ { "insetlayout", TC_INSETLAYOUT },
+ { "leftmargin", TC_LEFTMARGIN },
+ { "modifystyle", TC_MODIFYSTYLE },
+ { "nocounter", TC_NOCOUNTER },
+ { "nofloat", TC_NOFLOAT },
+ { "noinsetlayout", TC_NOINSETLAYOUT },
+ { "nostyle", TC_NOSTYLE },
+ { "outlinername", TC_OUTLINERNAME },
+ { "outputformat", TC_OUTPUTFORMAT },
+ { "outputtype", TC_OUTPUTTYPE },
+ { "packageoptions", TC_PKGOPTS },
+ { "pagestyle", TC_PAGESTYLE },
+ { "preamble", TC_PREAMBLE },
+ { "provides", TC_PROVIDES },
+ { "providesmodule", TC_PROVIDESMODULE },
+ { "providestyle", TC_PROVIDESTYLE },
+ { "requires", TC_REQUIRES },
+ { "rightmargin", TC_RIGHTMARGIN },
+ { "secnumdepth", TC_SECNUMDEPTH },
+ { "sides", TC_SIDES },
+ { "style", TC_STYLE },
+ { "titlelatexname", TC_TITLELATEXNAME },
+ { "titlelatextype", TC_TITLELATEXTYPE },
+ { "tocdepth", TC_TOCDEPTH }
+};
+
+} //namespace anon
+
+
+bool TextClass::convertLayoutFormat(support::FileName const & filename, ReadType rt)
+{
+ LYXERR(Debug::TCLASS, "Converting layout file to " << LAYOUT_FORMAT);
+ TempFile tmp("convertXXXXXX.layout");
+ FileName const tempfile = tmp.name();
+ bool success = layout2layout(filename, tempfile);
+ if (success)
+ success = readWithoutConv(tempfile, rt) == OK;
+ return success;
+}
+
+
+std::string TextClass::convert(std::string const & str)
+{
+ TempFile tmp1("localXXXXXX.layout");
+ FileName const fn = tmp1.name();
+ ofstream os(fn.toFilesystemEncoding().c_str());
+ os << str;
+ os.close();
+ TempFile tmp2("convert_localXXXXXX.layout");
+ FileName const tempfile = tmp2.name();
+ bool success = layout2layout(fn, tempfile);
+ if (!success)
+ return "";
+ ifstream is(tempfile.toFilesystemEncoding().c_str());
+ string ret;
+ string tmp;
+ while (!is.eof()) {
+ getline(is, tmp);
+ ret += tmp + '\n';
+ }
+ is.close();
+ return ret;
+}
+
+
+TextClass::ReturnValues TextClass::readWithoutConv(FileName const & filename, ReadType rt)