X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FBufferParams.cpp;h=9d45d80d1034738d704496c9b275829dbbe652e1;hb=5887601f6836ebf6f2b16cc7587a98cc3aa6c391;hp=bb59d0d71c644bab8d2ac47362f6df8e61164e33;hpb=b5969212119673d479bb2e0a99ccc0e359d35e0b;p=lyx.git diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index bb59d0d71c..9d45d80d10 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -21,19 +21,17 @@ #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" @@ -50,10 +48,10 @@ #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" @@ -449,6 +447,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) @@ -471,6 +471,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 +565,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); } @@ -991,7 +992,7 @@ string BufferParams::readToken(Lexer & lex, string const & token, branch_ptr->setColor(color); // Update also the Color table: if (color == "none") - color = lcolor.getX11Name(Color_background); + color = lcolor.getX11HexName(Color_background); // FIXME UNICODE lcolor.setColor(to_utf8(branch), color); } @@ -1020,7 +1021,7 @@ 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); @@ -1134,6 +1135,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(temp); } else if (token == "\\output_sync") { lex >> output_sync; } else if (token == "\\output_sync_macro") { @@ -1366,9 +1371,9 @@ 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")) os << "\\notefontcolor " << lyx::X11hexname(notefontcolor) << '\n'; @@ -1491,6 +1496,8 @@ void BufferParams::writeFile(ostream & os, Buffer const * buf) const << "\\html_css_as_file " << html_css_as_file << '\n' << "\\html_be_strict " << convert(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(html_math_img_scale) << '\n'; if (!html_latex_start.empty()) @@ -1732,8 +1739,7 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features, docstring options_encodable; Encoding const * const enc = features.runparams().encoding; if (enc) { - for (size_t n = 0; n < strOptions.size(); ++n) { - char_type c = strOptions[n]; + for (char_type c : strOptions) { if (!enc->encodable(c)) { docstring const glyph(1, c); LYXERR0("Uncodable character '" @@ -1970,7 +1976,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 @@ -1979,7 +1985,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 @@ -2175,8 +2181,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 '" @@ -2648,11 +2653,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::const_iterator it = backs.begin() + 1; for (; it != backs.end(); ++it) { FormatList r = theConverters().getReachable(*it, only_viewable, @@ -2721,6 +2728,8 @@ OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const // something with formats. if (dformat == "xhtml") result = OutputParams::HTML; + else if (dformat == "docbook5") + result = OutputParams::DOCBOOK5; else if (dformat == "text") result = OutputParams::TEXT; else if (dformat == "lyx") @@ -2760,13 +2769,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) @@ -2805,12 +2807,6 @@ bool BufferParams::isLiterate() const } -bool BufferParams::isDocBook() const -{ - return documentClass().outputType() == DOCBOOK; -} - - void BufferParams::readPreamble(Lexer & lex) { if (lex.getString() != "\\begin_preamble") @@ -3511,7 +3507,7 @@ string const & BufferParams::defaultBiblioStyle() const } -bool const & BufferParams::fullAuthorList() const +bool BufferParams::fullAuthorList() const { return documentClass().fullAuthorList(); }