]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
HTML for comments and colors.
[lyx.git] / src / BufferParams.cpp
index 8d9eadef49540259b340991f20a0cee887cdc6b0..04d035481f9c4272b58447e17ac26777e970225d 100644 (file)
@@ -369,7 +369,7 @@ BufferParams::BufferParams()
        suppress_date = false;
        // white is equal to no background color
        backgroundcolor = lyx::rgbFromHexName("#ffffff");
-       compressed = false;
+       compressed = lyxrc.save_compressed;
        for (int iter = 0; iter < 4; ++iter) {
                user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
                temp_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -377,7 +377,7 @@ BufferParams::BufferParams()
        // default index
        indiceslist().addDefault(B_("Index"));
        html_be_strict = true;
-       html_use_mathml = true;
+       html_math_output = MathML;
 }
 
 
@@ -519,16 +519,22 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                // We assume that a tex class exists for local or unknown layouts so this warning
                // will only be given for system layouts.
                if (!baseClass()->isTeXClassAvailable()) {
+                       docstring desc = 
+                               translateIfPossible(from_utf8(baseClass()->description()));
                        docstring const msg =
-                               bformat(_("The layout file requested by this document,\n"
-                                                "%1$s.layout,\n"
-                                                "is not usable. This is probably because a LaTeX\n"
-                                                "class or style file required by it is not\n"
-                                                "available. See the Customization documentation\n"
-                                                "for more information.\n"), from_utf8(classname));
+                               bformat(_("The document class requested\n"
+                                                "\t%1$s\n"
+                                                "requires external files that are not available.\n"
+                                                "The document class can still be used, but LyX\n"
+                                                "will not be able to produce output until the\n"
+                                                "following prerequisites are installed:\n"
+                                                "\t%2$s\n"
+                                                "See section 3.1.2.2 of the User's Guide for\n"
+                                                "more information."), 
+                                                desc, from_utf8(baseClass()->prerequisites()));
                        frontend::Alert::warning(_("Document class not available"),
-                                      msg + _("LyX will not be able to produce output."));
-               } 
+                                      msg);
+               }
        } else if (token == "\\begin_preamble") {
                readPreamble(lex);
        } else if (token == "\\begin_local_layout") {
@@ -775,8 +781,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                                toktmp << endl;
                        return toktmp;
                }
-       } else if (token == "\\html_use_mathml") {
-               lex >> html_use_mathml;
+       } else if (token == "\\html_math_output") {
+               int temp;
+               lex >> temp;
+               html_math_output = static_cast<MathOutput>(temp);
        } else if (token == "\\html_be_strict") {
                lex >> html_be_strict;
        } else {
@@ -992,7 +1000,7 @@ void BufferParams::writeFile(ostream & os) const
 
        os << "\\tracking_changes " << convert<string>(trackChanges) << "\n"
           << "\\output_changes " << convert<string>(outputChanges) << "\n"
-          << "\\html_use_mathml " << convert<string>(html_use_mathml) << "\n"
+          << "\\html_math_output " << html_math_output << "\n"
           << "\\html_be_strict " << convert<string>(html_be_strict) << "\n";
 
        os << pimpl_->authorlist;
@@ -1280,7 +1288,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
                                incfile = mangled;
                        // \includeonly doesn't want an extension 
                        incfile = changeExtension(incfile, string());
-                       incfile = latex_path(incfile);
+                       incfile = support::latex_path(incfile);
                        if (!incfile.empty()) {
                                if (!first)
                                        os << ",";
@@ -1534,13 +1542,23 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
        //   before hyperref. Then hyperref has a chance to detect babel.
        // * Has to be loaded before the "LyX specific LaTeX commands" to
        //   avoid errors with algorithm floats.
-       // use hyperref explicitely when it is required
+       // use hyperref explicitly if it is required
        if (features.isRequired("hyperref")) {
-               odocstringstream oss;
-               pdfoptions().writeLaTeX(oss, documentClass().provides("hyperref"));
-               lyxpreamble += oss.str();
+               // pass what we have to stream here, since we need 
+               // to access the stream itself in PDFOptions.
+               os << lyxpreamble;
+
+               int lines =
+                       int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
+
+               OutputParams tmp_params = features.runparams();
+               lines += pdfoptions().writeLaTeX(tmp_params, os,
+                                       documentClass().provides("hyperref"));
+               texrow.newlines(lines);
+               // set back for the rest
+               lyxpreamble.clear();
        }
-       
+
        // Will be surrounded by \makeatletter and \makeatother when not empty
        docstring atlyxpreamble;
 
@@ -1644,9 +1662,7 @@ bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
 
        int const nlines =
                int(count(lyxpreamble.begin(), lyxpreamble.end(), '\n'));
-       for (int j = 0; j != nlines; ++j) {
-               texrow.newline();
-       }
+       texrow.newlines(nlines);
 
        os << lyxpreamble;
 
@@ -2261,7 +2277,7 @@ string const BufferParams::loadFonts(string const & rm,
        }
 
        // ROMAN FONTS
-       // Computer Modern (must be explicitely selectable -- there might be classes
+       // Computer Modern (must be explicitly selectable -- there might be classes
        // that define a different default font!
        if (rm == "cmr") {
                os << "\\renewcommand{\\rmdefault}{cmr}\n";