]> git.lyx.org Git - lyx.git/blobdiff - src/BufferParams.cpp
Correct Right Arrow key processing in Modules list
[lyx.git] / src / BufferParams.cpp
index 776c5c9e6cdc3b7f5fa3bbb5a03d17e42eab5b16..6e0d9f91c6aacb37a2b188cb218c1bb427c83b7d 100644 (file)
@@ -32,7 +32,6 @@
 #include "Language.h"
 #include "LaTeXFeatures.h"
 #include "LaTeXFonts.h"
-#include "Length.h"
 #include "ModuleList.h"
 #include "Font.h"
 #include "Lexer.h"
@@ -54,6 +53,7 @@
 #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"
@@ -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;
@@ -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<TableOutput>(temp);
        } else if (token == "\\output_sync") {
                lex >> output_sync;
        } else if (token == "\\output_sync_macro") {
@@ -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<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())
@@ -2006,27 +2013,33 @@ bool BufferParams::writeLaTeX(otexstream & os, LaTeXFeatures & features,
                string psopt;
                switch (getDefSkip().kind()) {
                case VSpace::SMALLSKIP:
-                       psopt = "[skip=\\smallskipamount]";
+                       psopt = "\\smallskipamount";
                        break;
                case VSpace::MEDSKIP:
-                       psopt = "[skip=\\medskipamount]";
+                       psopt = "\\medskipamount";
                        break;
                case VSpace::BIGSKIP:
-                       psopt = "[skip=\\bigskipamount]";
+                       psopt = "\\bigskipamount";
                        break;
                case VSpace::HALFLINE:
+                       // default (no option)
                        break;
                case VSpace::FULLLINE:
-                       psopt = "[skip=\\baselineskip]";
+                       psopt = "\\baselineskip";
                        break;
                case VSpace::LENGTH:
-                       psopt = "[skip={" + getDefSkip().length().asLatexString() + "}]";
+                       psopt = getDefSkip().length().asLatexString();
                        break;
                default:
                        break;
                }
-               if (features.isAvailable("parskip"))
+               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
@@ -2642,11 +2655,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,
@@ -2692,6 +2707,7 @@ vector<string> BufferParams::backends() const
        }
 
        v.push_back("xhtml");
+       v.push_back("docbook5");
        v.push_back("text");
        v.push_back("lyx");
        return v;
@@ -2714,6 +2730,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")
@@ -2753,13 +2771,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)
@@ -2798,12 +2809,6 @@ bool BufferParams::isLiterate() const
 }
 
 
-bool BufferParams::isDocBook() const
-{
-       return documentClass().outputType() == DOCBOOK;
-}
-
-
 void BufferParams::readPreamble(Lexer & lex)
 {
        if (lex.getString() != "\\begin_preamble")