]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Set GUI name for local greyedouttext color (#12130)
[lyx.git] / src / BufferParams.cpp
index 750c6e83fbebaf7b89d53f329b4eb5309eeb7715..7004a9211f2e176ceed5c65ace6641b75eb204c5 100644 (file)
 #include "LayoutFile.h"
 #include "BranchList.h"
 #include "Buffer.h"
-#include "buffer_funcs.h"
 #include "Bullet.h"
 #include "CiteEnginesList.h"
 #include "Color.h"
 #include "ColorSet.h"
 #include "Converter.h"
 #include "Encoding.h"
+#include "Format.h"
 #include "IndicesList.h"
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "LaTeXFonts.h"
-#include "Length.h"
-#include "ModuleList.h"
 #include "Font.h"
 #include "Lexer.h"
 #include "LyXRC.h"
 #include "frontends/alert.h"
 
 #include "insets/InsetListingsParams.h"
+#include "insets/InsetQuotes.h"
 
 #include "support/convert.h"
 #include "support/debug.h"
-#include "support/docstream.h"
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/gettext.h"
+#include "support/Length.h"
 #include "support/Messages.h"
 #include "support/mutex.h"
 #include "support/Package.h"
@@ -74,7 +73,8 @@ static char const * const string_paragraph_separation[] = {
 
 static char const * const string_quotes_style[] = {
        "english", "swedish", "german", "polish", "swiss", "danish", "plain",
-       "british", "swedishg", "french", "frenchin", "russian", "cjk", "cjkangle", ""
+       "british", "swedishg", "french", "frenchin", "russian", "cjk", "cjkangle",
+       "hungarian", ""
 };
 
 
@@ -137,26 +137,27 @@ ParSepTranslator const & parseptranslator()
 
 
 // Quotes style
-typedef Translator<string, InsetQuotesParams::QuoteStyle> QuotesStyleTranslator;
+typedef Translator<string, QuoteStyle> QuotesStyleTranslator;
 
 
 QuotesStyleTranslator const init_quotesstyletranslator()
 {
        QuotesStyleTranslator translator
-               (string_quotes_style[0], InsetQuotesParams::EnglishQuotes);
-       translator.addPair(string_quotes_style[1], InsetQuotesParams::SwedishQuotes);
-       translator.addPair(string_quotes_style[2], InsetQuotesParams::GermanQuotes);
-       translator.addPair(string_quotes_style[3], InsetQuotesParams::PolishQuotes);
-       translator.addPair(string_quotes_style[4], InsetQuotesParams::SwissQuotes);
-       translator.addPair(string_quotes_style[5], InsetQuotesParams::DanishQuotes);
-       translator.addPair(string_quotes_style[6], InsetQuotesParams::PlainQuotes);
-       translator.addPair(string_quotes_style[7], InsetQuotesParams::BritishQuotes);
-       translator.addPair(string_quotes_style[8], InsetQuotesParams::SwedishGQuotes);
-       translator.addPair(string_quotes_style[9], InsetQuotesParams::FrenchQuotes);
-       translator.addPair(string_quotes_style[10], InsetQuotesParams::FrenchINQuotes);
-       translator.addPair(string_quotes_style[11], InsetQuotesParams::RussianQuotes);
-       translator.addPair(string_quotes_style[12], InsetQuotesParams::CJKQuotes);
-       translator.addPair(string_quotes_style[13], InsetQuotesParams::CJKAngleQuotes);
+               (string_quotes_style[0], QuoteStyle::English);
+       translator.addPair(string_quotes_style[1], QuoteStyle::Swedish);
+       translator.addPair(string_quotes_style[2], QuoteStyle::German);
+       translator.addPair(string_quotes_style[3], QuoteStyle::Polish);
+       translator.addPair(string_quotes_style[4], QuoteStyle::Swiss);
+       translator.addPair(string_quotes_style[5], QuoteStyle::Danish);
+       translator.addPair(string_quotes_style[6], QuoteStyle::Plain);
+       translator.addPair(string_quotes_style[7], QuoteStyle::British);
+       translator.addPair(string_quotes_style[8], QuoteStyle::SwedishG);
+       translator.addPair(string_quotes_style[9], QuoteStyle::French);
+       translator.addPair(string_quotes_style[10], QuoteStyle::FrenchIN);
+       translator.addPair(string_quotes_style[11], QuoteStyle::Russian);
+       translator.addPair(string_quotes_style[12], QuoteStyle::CJK);
+       translator.addPair(string_quotes_style[13], QuoteStyle::CJKAngle);
+       translator.addPair(string_quotes_style[14], QuoteStyle::Hungarian);
        return translator;
 }
 
@@ -395,7 +396,7 @@ BufferParams::BufferParams()
        paragraph_separation = ParagraphIndentSeparation;
        is_math_indent = false;
        math_numbering_side = DEFAULT;
-       quotes_style = InsetQuotesParams::EnglishQuotes;
+       quotes_style = QuoteStyle::English;
        dynamic_quotes = false;
        fontsize = "default";
 
@@ -449,6 +450,8 @@ BufferParams::BufferParams()
        listings_params = string();
        pagestyle = "default";
        tablestyle = "default";
+       float_alignment = "class";
+       float_placement = "class";
        suppress_date = false;
        justification = true;
        // no color is the default (white)
@@ -459,7 +462,9 @@ BufferParams::BufferParams()
        isfontcolor = false;
        // light gray is the default font color for greyed-out notes
        notefontcolor = lyx::rgbFromHexName("#cccccc");
+       isnotefontcolor = false;
        boxbgcolor = lyx::rgbFromHexName("#ff0000");
+       isboxbgcolor = false;
        compressed = lyxrc.save_compressed;
        for (int iter = 0; iter < 4; ++iter) {
                user_defined_bullet(iter) = ITEMIZE_DEFAULTS[iter];
@@ -471,6 +476,7 @@ BufferParams::BufferParams()
        html_math_output = MathML;
        html_math_img_scale = 1.0;
        html_css_as_file = false;
+       docbook_table_output = HTMLTable;
        display_pixel_ratio = 1.0;
 
        shell_escape = false;
@@ -564,7 +570,7 @@ AuthorList const & BufferParams::authors() const
 }
 
 
-void BufferParams::addAuthor(Author a)
+void BufferParams::addAuthor(Author const & a)
 {
        author_map_[a.bufferId()] = pimpl_->authorlist.record(a);
 }
@@ -698,9 +704,10 @@ BufferParams::MathNumber BufferParams::getMathNumber() const
 
 
 string BufferParams::readToken(Lexer & lex, string const & token,
-       FileName const & filepath)
+       FileName const & filename)
 {
        string result;
+       FileName const & filepath = filename.onlyPath();
 
        if (token == "\\textclass") {
                lex.next();
@@ -986,14 +993,13 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                        }
                        if (tok == "\\color") {
                                lex.eatLine();
-                               string color = lex.getString();
+                               vector<string> const colors = getVectorFromString(lex.getString(), " ");
+                               string const lmcolor = colors.front();
+                               string dmcolor;
+                               if (colors.size() > 1)
+                                       dmcolor = colors.back();
                                if (branch_ptr)
-                                       branch_ptr->setColor(color);
-                               // Update also the Color table:
-                               if (color == "none")
-                                       color = lcolor.getX11Name(Color_background);
-                               // FIXME UNICODE
-                               lcolor.setColor(to_utf8(branch), color);
+                                       branch_ptr->setColors(lmcolor, dmcolor);
                        }
                }
        } else if (token == "\\index") {
@@ -1020,10 +1026,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                                        index_ptr->setColor(color);
                                // Update also the Color table:
                                if (color == "none")
-                                       color = lcolor.getX11Name(Color_background);
+                                       color = lcolor.getX11HexName(Color_background);
                                // FIXME UNICODE
                                if (!shortcut.empty())
-                                       lcolor.setColor(to_utf8(shortcut), color);
+                                       lcolor.setColor(to_utf8(shortcut)+ "@" + filename.absFileName(), color);
                        }
                }
        } else if (token == "\\author") {
@@ -1049,11 +1055,17 @@ string BufferParams::readToken(Lexer & lex, string const & token,
                string color = lex.getString();
                notefontcolor = lyx::rgbFromHexName(color);
                lcolor.setColor("notefontcolor", color);
+               lcolor.setLaTeXName("notefontcolor", "note_fontcolor");
+               lcolor.setGUIName("notefontcolor", N_("greyedout inset text"));
+               // set a local name for the painter
+               lcolor.setColor("notefontcolor@" + filename.absFileName(), color);
+               isnotefontcolor = true;
        } else if (token == "\\boxbgcolor") {
                lex.eatLine();
                string color = lex.getString();
                boxbgcolor = lyx::rgbFromHexName(color);
-               lcolor.setColor("boxbgcolor", color);
+               lcolor.setColor("boxbgcolor@" + filename.absFileName(), color);
+               isboxbgcolor = true;
        } else if (token == "\\paperwidth") {
                lex >> paperwidth;
        } else if (token == "\\paperheight") {
@@ -1134,6 +1146,10 @@ string BufferParams::readToken(Lexer & lex, string const & token,
        } else if (token == "\\html_latex_end") {
                lex.eatLine();
                html_latex_end = lex.getString();
+       } else if (token == "\\docbook_table_output") {
+               int temp;
+               lex >> temp;
+               docbook_table_output = static_cast<TableOutput>(temp);
        } else if (token == "\\output_sync") {
                lex >> output_sync;
        } else if (token == "\\output_sync_macro") {
@@ -1366,20 +1382,20 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
        if (!lineno_opts.empty())
                os << "\\lineno_options " << lineno_opts << '\n';
 
-       if (isbackgroundcolor == true)
+       if (isbackgroundcolor)
                os << "\\backgroundcolor " << lyx::X11hexname(backgroundcolor) << '\n';
-       if (isfontcolor == true)
+       if (isfontcolor)
                os << "\\fontcolor " << lyx::X11hexname(fontcolor) << '\n';
-       if (notefontcolor != lyx::rgbFromHexName("#cccccc"))
+       if (isnotefontcolor)
                os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n';
-       if (boxbgcolor != lyx::rgbFromHexName("#ff0000"))
+       if (isboxbgcolor)
                os << "\\boxbgcolor " << lyx::X11hexname(boxbgcolor) << '\n';
 
        for (auto const & br : branchlist()) {
                os << "\\branch " << to_utf8(br.branch())
                   << "\n\\selected " << br.isSelected()
                   << "\n\\filename_suffix " << br.hasFileNameSuffix()
-                  << "\n\\color " << lyx::X11hexname(br.color())
+                  << "\n\\color " << br.lightModeColor() << " " << br.darkModeColor()
                   << "\n\\end_branch"
                   << "\n";
        }
@@ -1447,7 +1463,7 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
                os << "default";
        }
        os << "\n\\quotes_style "
-          << string_quotes_style[quotes_style]
+          << string_quotes_style[static_cast<int>(quotes_style)]
           << "\n\\dynamic_quotes " << dynamic_quotes
           << "\n\\papercolumns " << columns
           << "\n\\papersides " << sides
@@ -1491,6 +1507,8 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const
           << "\\html_css_as_file " << html_css_as_file << '\n'
           << "\\html_be_strict " << convert<string>(html_be_strict) << '\n';
 
+       os << "\\docbook_table_output " << docbook_table_output << '\n';
+
        if (html_math_img_scale != 1.0)
                os << "\\html_math_img_scale " << convert<string>(html_math_img_scale) << '\n';
        if (!html_latex_start.empty())
@@ -1514,8 +1532,8 @@ void BufferParams::validate(LaTeXFeatures & features) const
                                  LaTeXFeatures::isAvailable("xcolor");
 
                switch (features.runparams().flavor) {
-               case OutputParams::LATEX:
-               case OutputParams::DVILUATEX:
+               case Flavor::LaTeX:
+               case Flavor::DviLuaTeX:
                        if (xcolorulem) {
                                features.require("ct-xcolor-ulem");
                                features.require("ulem");
@@ -1524,9 +1542,9 @@ void BufferParams::validate(LaTeXFeatures & features) const
                                features.require("ct-none");
                        }
                        break;
-               case OutputParams::LUATEX:
-               case OutputParams::PDFLATEX:
-               case OutputParams::XETEX:
+               case Flavor::LuaTeX:
+               case Flavor::PdfLaTeX:
+               case Flavor::XeTeX:
                        if (xcolorulem) {
                                features.require("ct-xcolor-ulem");
                                features.require("ulem");
@@ -1724,17 +1742,59 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        if (!options.empty()) {
                clsoptions << options << ',';
        }
-
-       string strOptions(clsoptions.str());
+       
+       docstring const strOptions = from_utf8(clsoptions.str());
        if (!strOptions.empty()) {
-               strOptions = rtrim(strOptions, ",");
-               // FIXME UNICODE
-               os << '[' << from_utf8(strOptions) << ']';
+               // Check if class options contain uncodable glyphs
+               docstring uncodable_glyphs;
+               docstring options_encodable;
+               Encoding const * const enc = features.runparams().encoding;
+               if (enc) {
+                       for (char_type c : strOptions) {
+                               if (!enc->encodable(c)) {
+                                       docstring const glyph(1, c);
+                                       LYXERR0("Uncodable character '"
+                                               << glyph
+                                               << "' in class options!");
+                                       uncodable_glyphs += glyph;
+                                       if (features.runparams().dryrun) {
+                                               options_encodable += "<" + _("LyX Warning: ")
+                                                  + _("uncodable character") + " '";
+                                               options_encodable += c;
+                                               options_encodable += "'>";
+                                       }
+                               } else
+                                       options_encodable += c;
+                       }
+               } else
+                       options_encodable = strOptions;
+       
+               // On BUFFER_VIEW|UPDATE, warn user if we found uncodable glyphs
+               if (!features.runparams().dryrun && !uncodable_glyphs.empty()) {
+                       frontend::Alert::warning(
+                               _("Uncodable character in class options"),
+                               support::bformat(
+                                 _("The class options of your document contain glyphs "
+                                   "that are unknown in the current document encoding "
+                                   "(namely %1$s).\nThese glyphs are omitted "
+                                   " from the output, which may result in "
+                                   "incomplete output."
+                                   "\n\nPlease select an appropriate "
+                                   "document encoding\n"
+                                   "(such as utf8) or change the "
+                                   "class options accordingly."),
+                                 uncodable_glyphs));
+               }
+               options_encodable = rtrim(options_encodable, ",");
+               os << '[' << options_encodable << ']';
        }
 
        os << '{' << from_ascii(tclass.latexname()) << "}\n";
        // end of \documentclass defs
 
+       // The package options (via \PassOptionsToPackage)
+       os << from_ascii(features.getPackageOptions());
+
        // if we use fontspec or newtxmath, we have to load the AMS packages here
        string const ams = features.loadAMSPackages();
        bool const ot1 = (main_font_encoding() == "default" || main_font_encoding() == "OT1");
@@ -1927,7 +1987,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        }
 
        // only output when the background color is not default
-       if (isbackgroundcolor == true) {
+       if (isbackgroundcolor) {
                // only require color here, the background color will be defined
                // in LaTeXFeatures.cpp to avoid interferences with the LaTeX
                // package pdfpages
@@ -1936,7 +1996,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        }
 
        // only output when the font color is not default
-       if (isfontcolor == true) {
+       if (isfontcolor) {
                // only require color here, the font color will be defined
                // in LaTeXFeatures.cpp to avoid interferences with the LaTeX
                // package pdfpages
@@ -1960,26 +2020,36 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
 
        if (paragraph_separation) {
                // when skip separation
+               string psopt;
                switch (getDefSkip().kind()) {
                case VSpace::SMALLSKIP:
-                       os << "\\setlength{\\parskip}{\\smallskipamount}\n";
+                       psopt = "\\smallskipamount";
                        break;
                case VSpace::MEDSKIP:
-                       os << "\\setlength{\\parskip}{\\medskipamount}\n";
+                       psopt = "\\medskipamount";
                        break;
                case VSpace::BIGSKIP:
-                       os << "\\setlength{\\parskip}{\\bigskipamount}\n";
+                       psopt = "\\bigskipamount";
+                       break;
+               case VSpace::HALFLINE:
+                       // default (no option)
+                       break;
+               case VSpace::FULLLINE:
+                       psopt = "\\baselineskip";
                        break;
                case VSpace::LENGTH:
-                       os << "\\setlength{\\parskip}{"
-                          << from_utf8(getDefSkip().length().asLatexString())
-                          << "}\n";
+                       psopt = getDefSkip().length().asLatexString();
                        break;
-               default: // should never happen // Then delete it.
-                       os << "\\setlength{\\parskip}{\\medskipamount}\n";
+               default:
                        break;
                }
-               os << "\\setlength{\\parindent}{0pt}\n";
+               if (!features.isProvided("parskip")) {
+                       if (!psopt.empty())
+                               psopt = "[skip=" + psopt + "]";
+                       os << "\\usepackage" + psopt + "{parskip}\n";
+               } else {
+                       os << "\\setlength{\\parskip}{" + psopt + "}\n";
+               }
        } else {
                // when separation by indentation
                // only output something when a width is given
@@ -2007,15 +2077,12 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        if (output_sync) {
                if (!output_sync_macro.empty())
                        os << from_utf8(output_sync_macro) +"\n";
-               else if (features.runparams().flavor == OutputParams::LATEX)
+               else if (features.runparams().flavor == Flavor::LaTeX)
                        os << "\\usepackage[active]{srcltx}\n";
-               else if (features.runparams().flavor == OutputParams::PDFLATEX)
+               else if (features.runparams().flavor == Flavor::PdfLaTeX)
                        os << "\\synctex=-1\n";
        }
 
-       // The package options (via \PassOptionsToPackage)
-       os << from_ascii(features.getPackageOptions());
-
        // due to interferences with babel and hyperref, the color package has to
        // be loaded (when it is not already loaded) before babel when hyperref
        // is used with the colorlinks option, see
@@ -2125,8 +2192,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                docstring uncodable_glyphs;
                Encoding const * const enc = features.runparams().encoding;
                if (enc) {
-                       for (size_t n = 0; n < preamble.size(); ++n) {
-                               char_type c = preamble[n];
+                       for (char_type c : preamble) {
                                if (!enc->encodable(c)) {
                                        docstring const glyph(1, c);
                                        LYXERR0("Uncodable character '"
@@ -2182,8 +2248,10 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
        // use \PassOptionsToPackage here because the user could have
        // already loaded subfig in the preamble.
        if (features.mustProvide("subfig"))
-               atlyxpreamble << "\\@ifundefined{showcaptionsetup}{}{%\n"
-                                " \\PassOptionsToPackage{caption=false}{subfig}}\n"
+               atlyxpreamble << "\\ifdefined\\showcaptionsetup\n"
+                                " % Caption package is used. Advise subfig not to load it again.\n"
+                                " \\PassOptionsToPackage{caption=false}{subfig}\n"
+                                "\\fi\n"
                                 "\\usepackage{subfig}\n";
 
        // Itemize bullet settings need to be last in case the user
@@ -2290,7 +2358,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
            && !features.isProvided("xunicode")) {
                // The `xunicode` package officially only supports XeTeX,
                //  but also works with LuaTeX. We work around its XeTeX test.
-               if (features.runparams().flavor != OutputParams::XETEX) {
+               if (features.runparams().flavor != Flavor::XeTeX) {
                        os << "% Pretend to xunicode that we are XeTeX\n"
                           << "\\def\\XeTeXpicfile{}\n";
                }
@@ -2507,7 +2575,7 @@ LayoutFileIndex const & BufferParams::baseClassID() const
 }
 
 
-void BufferParams::makeDocumentClass(bool const clone)
+void BufferParams::makeDocumentClass(bool clone, bool internal)
 {
        if (!baseClass())
                return;
@@ -2517,7 +2585,7 @@ void BufferParams::makeDocumentClass(bool const clone)
        for (auto const & mod : layout_modules_)
                mods.push_back(mod);
 
-       doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone);
+       doc_class_ = getDocumentClass(*baseClass(), mods, cite_engine_, clone, internal);
 
        TextClass::ReturnValues success = TextClass::OK;
        if (!forced_local_layout_.empty())
@@ -2598,11 +2666,13 @@ FormatList const & BufferParams::exportableFormats(bool only_viewable) const
        if (useNonTeXFonts) {
                excludes.insert("latex");
                excludes.insert("pdflatex");
-       } else if (inputenc != "ascii" && inputenc != "utf8-plain")
+       } else if (inputenc != "ascii" && inputenc != "utf8-plain") {
                  // XeTeX with TeX fonts requires input encoding ascii (#10600).
                  excludes.insert("xetex");
-       FormatList result = theConverters().getReachable(backs[0], only_viewable,
-                                                                                                        true, excludes);
+       }
+
+       FormatList result =
+               theConverters().getReachable(backs[0], only_viewable, true, excludes);
        vector<string>::const_iterator it = backs.begin() + 1;
        for (; it != backs.end(); ++it) {
                FormatList r = theConverters().getReachable(*it, only_viewable,
@@ -2648,13 +2718,14 @@ vector<string> BufferParams::backends() const
        }
 
        v.push_back("xhtml");
+       v.push_back("docbook5");
        v.push_back("text");
        v.push_back("lyx");
        return v;
 }
 
 
-OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const
+Flavor BufferParams::getOutputFlavor(string const & format) const
 {
        string const dformat = (format.empty() || format == "default") ?
                getDefaultOutputFormat() : format;
@@ -2664,24 +2735,26 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const
        if (it != default_flavors_.end())
                return it->second;
 
-       OutputParams::FLAVOR result = OutputParams::LATEX;
+       Flavor result = Flavor::LaTeX;
 
        // FIXME It'd be better not to hardcode this, but to do
        //       something with formats.
        if (dformat == "xhtml")
-               result = OutputParams::HTML;
+               result = Flavor::Html;
+       else if (dformat == "docbook5")
+               result = Flavor::DocBook5;
        else if (dformat == "text")
-               result = OutputParams::TEXT;
+               result = Flavor::Text;
        else if (dformat == "lyx")
-               result = OutputParams::LYX;
+               result = Flavor::LyX;
        else if (dformat == "pdflatex")
-               result = OutputParams::PDFLATEX;
+               result = Flavor::PdfLaTeX;
        else if (dformat == "xetex")
-               result = OutputParams::XETEX;
+               result = Flavor::XeTeX;
        else if (dformat == "luatex")
-               result = OutputParams::LUATEX;
+               result = Flavor::LuaTeX;
        else if (dformat == "dviluatex")
-               result = OutputParams::DVILUATEX;
+               result = Flavor::DviLuaTeX;
        else {
                // Try to determine flavor of default output format
                vector<string> backs = backends();
@@ -2709,13 +2782,6 @@ string BufferParams::getDefaultOutputFormat() const
        if (!default_output_format.empty()
            && default_output_format != "default")
                return default_output_format;
-       if (isDocBook()) {
-               FormatList const & formats = exportableFormats(true);
-               if (formats.empty())
-                       return string();
-               // return the first we find
-               return formats.front()->name();
-       }
        if (encoding().package() == Encoding::japanese)
                return lyxrc.default_platex_view_format;
        if (useNonTeXFonts)
@@ -2736,7 +2802,7 @@ Font const BufferParams::getFont() const
 }
 
 
-InsetQuotesParams::QuoteStyle BufferParams::getQuoteStyle(string const & qs) const
+QuoteStyle BufferParams::getQuoteStyle(string const & qs) const
 {
        return quotesstyletranslator().find(qs);
 }
@@ -2754,12 +2820,6 @@ bool BufferParams::isLiterate() const
 }
 
 
-bool BufferParams::isDocBook() const
-{
-       return documentClass().outputType() == DOCBOOK;
-}
-
-
 void BufferParams::readPreamble(Lexer & lex)
 {
        if (lex.getString() != "\\begin_preamble")
@@ -3208,8 +3268,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                // Create list of inputenc options:
                set<string> encoding_set;
                // luainputenc fails with more than one encoding
-               if (features.runparams().flavor != OutputParams::LUATEX
-                       && features.runparams().flavor != OutputParams::DVILUATEX)
+               if (features.runparams().flavor != Flavor::LuaTeX
+                       && features.runparams().flavor != Flavor::DviLuaTeX)
                        // list all input encodings used in the document
                        encoding_set = features.getEncodingSet(doc_encoding);
 
@@ -3233,8 +3293,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                                        os << ',';
                                os << from_ascii(doc_encoding);
                        }
-                       if (features.runparams().flavor == OutputParams::LUATEX
-                           || features.runparams().flavor == OutputParams::DVILUATEX)
+                       if (features.runparams().flavor == Flavor::LuaTeX
+                           || features.runparams().flavor == Flavor::DviLuaTeX)
                                os << "]{luainputenc}\n";
                        else
                                os << "]{inputenc}\n";
@@ -3257,8 +3317,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os,
                            || features.isProvided("inputenc"))
                                break;
                        os << "\\usepackage[" << from_ascii(encoding().latexName());
-                       if (features.runparams().flavor == OutputParams::LUATEX
-                           || features.runparams().flavor == OutputParams::DVILUATEX)
+                       if (features.runparams().flavor == Flavor::LuaTeX
+                           || features.runparams().flavor == Flavor::DviLuaTeX)
                                os << "]{luainputenc}\n";
                        else
                                os << "]{inputenc}\n";
@@ -3319,7 +3379,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
                bool const babelfonts = features.useBabel()
                                && features.isAvailable("babel-2017/11/03");
                string const texmapping =
-                       (features.runparams().flavor == OutputParams::XETEX) ?
+                       (features.runparams().flavor == Flavor::XeTeX) ?
                        "Mapping=tex-text" : "Ligatures=TeX";
                if (fontsRoman() != "default") {
                        if (babelfonts)
@@ -3402,7 +3462,7 @@ string const BufferParams::loadFonts(LaTeXFeatures & features) const
        bool const ot1 = (main_font_encoding() == "default" || main_font_encoding() == "OT1");
        bool const dryrun = features.runparams().dryrun;
        bool const complete = (fontsSans() == "default" && fontsTypewriter() == "default");
-       bool const nomath = (fontsMath() == "default");
+       bool const nomath = (fontsMath() != "auto");
 
        // ROMAN FONTS
        os << theLaTeXFonts().getLaTeXFont(from_ascii(fontsRoman())).getLaTeXCode(
@@ -3460,7 +3520,7 @@ string const & BufferParams::defaultBiblioStyle() const
 }
 
 
-bool const & BufferParams::fullAuthorList() const
+bool BufferParams::fullAuthorList() const
 {
        return documentClass().fullAuthorList();
 }