+LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
+{
+ if (haveClass(textclass))
+ return textclass;
+
+ FileName const tempLayout = FileName::tempName();
+ ofstream ofs(tempLayout.toFilesystemEncoding().c_str());
+ ofs << "# This layout is automatically generated\n"
+ "# \\DeclareLaTeXClass{" << textclass << "}\n\n"
+ "Format 7\n"
+ "Input stdclass.inc\n\n"
+ "Columns 1\n"
+ "Sides 1\n"
+ "SecNumDepth 2\n"
+ "TocDepth 2\n"
+ "DefaultStyle Standard\n\n"
+ "Style Standard\n"
+ " Category MainText\n"
+ " Margin Static\n"
+ " LatexType Paragraph\n"
+ " LatexName dummy\n"
+ " ParIndent MM\n"
+ " ParSkip 0.4\n"
+ " Align Block\n"
+ " AlignPossible Block, Left, Right, Center\n"
+ " LabelType No_Label\n"
+ "End\n";
+ ofs.close();
+
+ // We do not know if a LaTeX class is available for this document, but setting
+ // the last parameter to true will suppress a warning message about missing
+ // tex class.
+ LayoutFile * tc = new LayoutFile(textclass, textclass, "Unknown text class " + textclass, true);
+ if (!tc->load(tempLayout.absFilename()))
+ // The only way this happens is because the hardcoded layout file above
+ // is wrong.
+ LASSERT(false, /**/);
+ classmap_[textclass] = tc;
+ return textclass;
+}