]> git.lyx.org Git - lyx.git/blobdiff - src/TextClass.cpp
* GuiToolbar.cpp:
[lyx.git] / src / TextClass.cpp
index 69f40e9b79d3a3ee62f41c5a3dc3c4cda452f72c..3f756bdd4997c30373f37461e9b715d06ba9b4cd 100644 (file)
@@ -222,7 +222,7 @@ namespace {
 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);
@@ -245,7 +245,7 @@ bool TextClass::read(FileName const & filename, ReadType 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);
@@ -285,10 +285,10 @@ bool TextClass::read(std::string const & str, ReadType rt)
                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;
@@ -903,13 +903,6 @@ bool TextClass::hasLayout(docstring const & n) const
 }
 
 
-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(), /**/);
@@ -995,8 +988,17 @@ bool TextClass::load(string const & path) const
 }
 
 
+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()) {
@@ -1037,7 +1039,7 @@ bool TextClass::isPlainLayout(Layout const & layout) const
 }
 
 
-Layout TextClass::createDefaultLayout(docstring const & name, bool unknown) const
+Layout TextClass::createEmptyLayout(docstring const & name, bool unknown) const
 {
        static Layout * defaultLayout = NULL;