]> git.lyx.org Git - lyx.git/blobdiff - src/bufferparams.C
The "I want this in now" patch.
[lyx.git] / src / bufferparams.C
index fd2a8eae061fc8f31166e3386494e26505fc1b30..f4bfd76fef46979b6637b4e1db9f427cdb165dcc 100644 (file)
 #include "lyxlex.h"
 #include "Lsstream.h"
 #include "author.h"
+#include "gettext.h"
 
 #include "support/lyxalgo.h" // for lyx::count
 #include "support/lyxlib.h"
 #include "support/lstrings.h"
 #include "support/types.h"
 
+#include "frontends/Alert.h"
+
 #include <cstdlib>
 #include <algorithm>
 
@@ -40,6 +43,7 @@ using std::pair;
 #endif
 bool use_babel;
 
+
 BufferParams::BufferParams()
        // Initialize textclass to point to article. if `first' is
        // true in the returned pair, then `second' is the textclass
@@ -92,6 +96,12 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                        textclass = 0;
                        return classname;
                }
+               if (!getLyXTextClass().isTeXClassAvailable()) {
+                       string msg = bformat(_("The document uses a missing "
+                               "TeX class \"%1$s\".\n"), classname);
+                       Alert::warning(_("Document class not available"),
+                                      msg + _("LyX will not be able to produce output."));
+               }
        } else if (token == "\\begin_preamble") {
                readPreamble(lex);
        } else if (token == "\\options") {
@@ -186,7 +196,7 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                tracking_changes = lex.getInteger();
        } else if (token == "\\author") {
                lex.nextToken();
-               istringstream ss(lex.getString());
+               istringstream ss(STRCONV(lex.getString()));
                Author a;
                ss >> a;
                author_map.push_back(authorlist.record(a));
@@ -449,7 +459,7 @@ void BufferParams::writeFile(ostream & os) const
 }
 
 
-void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
+bool BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                              TexRow & texrow) const
 {
        os << "\\documentclass";
@@ -836,6 +846,7 @@ void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
        }
 
        os << lyxpreamble;
+       return use_babel;
 }
 
 void BufferParams::setPaperStuff()