bool TextClass::convertLayoutFormat(support::FileName const & filename, ReadType rt)
{
LYXERR(Debug::TCLASS, "Converting layout file to " << FORMAT);
- FileName const tempfile = FileName::tempName();
+ FileName const tempfile = FileName::tempName("convert_layout");
bool success = layout2layout(filename, tempfile);
if (success)
success = read(tempfile, rt);
// we do this before loading any layout file, so that classes can
// override features of this layout if they should choose to do so.
if (rt == BASECLASS && !hasLayout(emptylayout_))
- layoutlist_.push_back(createDefaultLayout(emptylayout_));
+ layoutlist_.push_back(createEmptyLayout(emptylayout_));
Lexer lexrc(textClassTags);
lexrc.setFile(filename);
return retval == OK;
// write the layout string to a temporary file
- FileName const tempfile = FileName::tempName();
+ FileName const tempfile = FileName::tempName("TextClass_read");
ofstream os(tempfile.toFilesystemEncoding().c_str());
if (!os) {
- LYXERR0("Unable to create tempoary file");
+ LYXERR0("Unable to create temporary file");
return false;
}
os << str;
}
-void TextClass::addLayoutIfNeeded(docstring const & n) const
-{
- if (!hasLayout(n))
- layoutlist_.push_back(createDefaultLayout(n, true));
-}
-
-
Layout const & TextClass::operator[](docstring const & name) const
{
LASSERT(!name.empty(), /**/);
}
+void DocumentClass::addLayoutIfNeeded(docstring const & n) const
+{
+ if (!hasLayout(n))
+ layoutlist_.push_back(createEmptyLayout(n, true));
+}
+
+
InsetLayout const & DocumentClass::insetLayout(docstring const & name) const
{
+ // FIXME The fix for the InsetLayout part of 4812 would be here:
+ // Add the InsetLayout to the document class if it is not found.
docstring n = name;
InsetLayouts::const_iterator cen = insetlayoutlist_.end();
while (!n.empty()) {
}
-Layout TextClass::createDefaultLayout(docstring const & name, bool unknown) const
+Layout TextClass::createEmptyLayout(docstring const & name, bool unknown) const
{
static Layout * defaultLayout = NULL;