+LayoutFileIndex LayoutFileList::addEmptyClass(string const & textclass)
+{
+ FileName const tempLayout = FileName::tempName("basic_layout");
+ ofstream ofs(tempLayout.toFilesystemEncoding().c_str());
+ // This writes a very basic class, but it also attempts to include
+ // stdclass.inc. That would give us something moderately usable.
+ ofs << "# This layout is automatically generated\n"
+ "# \\DeclareLaTeXClass{" << textclass << "}\n\n"
+ "Format " << LAYOUT_FORMAT << "\n"
+ "Input stdclass.inc\n\n"
+ << layoutpost;
+ 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, textclass + ".cls", "", true);
+
+ if (!tc->load(tempLayout.absFileName())) {
+ // The only way this happens is because the hardcoded layout file
+ // above is wrong or stdclass.inc cannot be found. So try again
+ // without stdclass.inc and without stdinsets.inc.
+ ofstream ofs2(tempLayout.toFilesystemEncoding().c_str());
+ ofs2 << "# This layout is automatically generated\n"
+ "# \\DeclareLaTeXClass{" << textclass << "}\n\n"
+ "Format " << LAYOUT_FORMAT << "\n"
+ "Provides stdinsets 1\n"
+ << layoutpost;
+ ofs2.close();
+ if (!tc->load(tempLayout.absFileName())) {
+ // This can only happen if the hardcoded file above is wrong.
+ LASSERT(false, /* */);
+ }
+ }
+
+ classmap_[textclass] = tc;
+ return textclass;
+}
+
+
+LayoutFileIndex LayoutFileList::addLocalLayout(
+ string const & textclass, string const & path)