]> git.lyx.org Git - lyx.git/blobdiff - src/bufferparams.C
"Inter-word Space"
[lyx.git] / src / bufferparams.C
index fd2a8eae061fc8f31166e3386494e26505fc1b30..d4c166aaf828de5bfeebfc15af4780e810ff738d 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>
 
@@ -35,10 +38,6 @@ using std::ostream;
 using std::endl;
 using std::pair;
 
-#ifdef WITH_WARNINGS
-#warning Do we need this horrible thing? (JMarc)
-#endif
-bool use_babel;
 
 BufferParams::BufferParams()
        // Initialize textclass to point to article. if `first' is
@@ -92,6 +91,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 +191,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 +454,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";
@@ -514,17 +519,14 @@ void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
                clsoptions << "landscape,";
 
        // language should be a parameter to \documentclass
-       use_babel = false;
-       ostringstream language_options;
        if (language->babel() == "hebrew"
            && default_language->babel() != "hebrew")
                // This seems necessary
                features.useLanguage(default_language);
 
-       if (lyxrc.language_use_babel ||
-           language->lang() != lyxrc.default_language ||
-           features.hasLanguages()) {
-               use_babel = true;
+       ostringstream language_options;
+       bool const use_babel = features.useBabel();
+       if (use_babel) {
                language_options << features.getLanguages();
                language_options << language->babel();
                if (lyxrc.language_global_options)
@@ -836,6 +838,7 @@ void BufferParams::writeLaTeX(ostream & os, LaTeXFeatures & features,
        }
 
        os << lyxpreamble;
+       return use_babel;
 }
 
 void BufferParams::setPaperStuff()