diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 058fb44fd5..64513fada1 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -2321,7 +2321,7 @@ int Buffer::runChktex() // Generate the LaTeX file if neccessary OutputParams runparams(¶ms().encoding()); - runparams.flavor = OutputParams::LATEX; + runparams.flavor = FLAVOR::LATEX; runparams.nice = false; runparams.linelen = lyxrc.plaintext_linelen; ExportStatus const retval = @@ -4069,23 +4069,23 @@ unique_ptr Buffer::getSourceCode(odocstream & os, string const & format, << "\n\n"; } // output paragraphs - if (runparams.flavor == OutputParams::LYX) { + if (runparams.flavor == FLAVOR::LYX) { Paragraph const & par = text().paragraphs()[par_begin]; ostringstream ods; depth_type dt = par.getDepth(); par.write(ods, params(), dt); os << from_utf8(ods.str()); - } else if (runparams.flavor == OutputParams::HTML) { + } else if (runparams.flavor == FLAVOR::HTML) { XMLStream xs(os); setMathFlavor(runparams); xhtmlParagraphs(text(), *this, xs, runparams); - } else if (runparams.flavor == OutputParams::TEXT) { + } else if (runparams.flavor == FLAVOR::TEXT) { bool dummy = false; // FIXME Handles only one paragraph, unlike the others. // Probably should have some routine with a signature like them. writePlaintextParagraph(*this, text().paragraphs()[par_begin], os, runparams, dummy); - } else if (runparams.flavor == OutputParams::DOCBOOK5) { + } else if (runparams.flavor == FLAVOR::DOCBOOK5) { XMLStream xs{os}; docbookParagraphs(text(), *this, xs, runparams); } else { @@ -4123,7 +4123,7 @@ unique_ptr Buffer::getSourceCode(odocstream & os, string const & format, else if (output == OnlyBody) os << _("Preview body"); os << "\n\n"; - if (runparams.flavor == OutputParams::LYX) { + if (runparams.flavor == FLAVOR::LYX) { ostringstream ods; if (output == FullSource) write(ods); @@ -4132,14 +4132,14 @@ unique_ptr Buffer::getSourceCode(odocstream & os, string const & format, else if (output == OnlyBody) text().write(ods); os << from_utf8(ods.str()); - } else if (runparams.flavor == OutputParams::HTML) { + } else if (runparams.flavor == FLAVOR::HTML) { writeLyXHTMLSource(os, runparams, output); - } else if (runparams.flavor == OutputParams::TEXT) { + } else if (runparams.flavor == FLAVOR::TEXT) { if (output == OnlyPreamble) { os << "% "<< _("Plain text does not have a preamble."); } else writePlaintextFile(*this, os, runparams); - } else if (runparams.flavor == OutputParams::DOCBOOK5) { + } else if (runparams.flavor == FLAVOR::DOCBOOK5) { writeDocBookSource(os, runparams, output); } else { // latex or literate @@ -4374,7 +4374,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } MarkAsExporting exporting(this); string backend_format; - runparams.flavor = OutputParams::LATEX; + runparams.flavor = FLAVOR::LATEX; runparams.linelen = lyxrc.plaintext_linelen; runparams.includeall = includeall; vector backs = params().backends(); @@ -4418,13 +4418,13 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir LYXERR(Debug::FILES, "backend_format=" << backend_format); // FIXME: Don't hardcode format names here, but use a flag if (backend_format == "pdflatex") - runparams.flavor = OutputParams::PDFLATEX; + runparams.flavor = FLAVOR::PDFLATEX; else if (backend_format == "luatex") - runparams.flavor = OutputParams::LUATEX; + runparams.flavor = FLAVOR::LUATEX; else if (backend_format == "dviluatex") - runparams.flavor = OutputParams::DVILUATEX; + runparams.flavor = FLAVOR::DVILUATEX; else if (backend_format == "xetex") - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; } string filename = latexName(false); @@ -4435,7 +4435,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir // Plain text backend if (backend_format == "text") { - runparams.flavor = OutputParams::TEXT; + runparams.flavor = FLAVOR::TEXT; try { writePlaintextFile(*this, FileName(filename), runparams); } @@ -4443,7 +4443,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir } // HTML backend else if (backend_format == "xhtml") { - runparams.flavor = OutputParams::HTML; + runparams.flavor = FLAVOR::HTML; setMathFlavor(runparams); if (makeLyXHTMLFile(FileName(filename), runparams) == ExportKilled) return ExportKilled; @@ -4451,7 +4451,7 @@ Buffer::ExportStatus Buffer::doExport(string const & target, bool put_in_tempdir writeFile(FileName(filename)); // DocBook backend else if (backend_format == "docbook5") { - runparams.flavor = OutputParams::DOCBOOK5; + runparams.flavor = FLAVOR::DOCBOOK5; runparams.nice = false; if (makeDocBookFile(FileName(filename), runparams) == ExportKilled) return ExportKilled; diff --git a/src/BufferList.cpp b/src/BufferList.cpp index 198e0bfad0..1a538d413f 100644 --- a/src/BufferList.cpp +++ b/src/BufferList.cpp @@ -15,6 +15,7 @@ #include "Author.h" #include "Buffer.h" #include "BufferParams.h" +#include "OutputParams.h" #include "frontends/alert.h" diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 9d45d80d10..bd78dae698 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -1521,8 +1521,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"); @@ -1531,9 +1531,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"); @@ -2066,9 +2066,9 @@ 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"; } @@ -2345,7 +2345,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"; } @@ -2712,7 +2712,7 @@ vector BufferParams::backends() const } -OutputParams::FLAVOR BufferParams::getOutputFlavor(string const & format) const +FLAVOR BufferParams::getOutputFlavor(string const & format) const { string const dformat = (format.empty() || format == "default") ? getDefaultOutputFormat() : format; @@ -2722,26 +2722,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 = OutputParams::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 backs = backends(); @@ -3255,8 +3255,8 @@ void BufferParams::writeEncodingPreamble(otexstream & os, // Create list of inputenc options: set 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); @@ -3280,8 +3280,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"; @@ -3304,8 +3304,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"; @@ -3366,7 +3366,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) diff --git a/src/BufferParams.h b/src/BufferParams.h index 6a5ded8260..21bfc10b2e 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -18,7 +18,6 @@ #include "Citation.h" #include "DocumentClassPtr.h" #include "LayoutModuleList.h" -#include "OutputParams.h" #include "paper.h" #include "insets/InsetQuotes.h" @@ -50,6 +49,8 @@ class PDFOptions; class Spacing; class VSpace; +enum class FLAVOR : int; + /** Buffer parameters. * This class contains all the parameters for this buffer's use. Some * work needs to be done on this class to make it nice. Now everything @@ -193,8 +194,7 @@ public: /// return the default output format of the current backend std::string getDefaultOutputFormat() const; /// return the output flavor of \p format or the default - OutputParams::FLAVOR getOutputFlavor( - std::string const & format = std::string()) const; + FLAVOR getOutputFlavor(std::string const & format = std::string()) const; /// bool isExportable(std::string const & format, bool need_viewable) const; /// @@ -613,7 +613,7 @@ private: /// void readIncludeonly(Lexer &); /// A cache for the default flavors - typedef std::map DefaultFlavorCache; + typedef std::map DefaultFlavorCache; /// mutable DefaultFlavorCache default_flavors_; /// the cite engine diff --git a/src/Changes.cpp b/src/Changes.cpp index dfe04cd306..e1c7515564 100644 --- a/src/Changes.cpp +++ b/src/Changes.cpp @@ -429,7 +429,7 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams, int column = 0; if (oldChange.type != Change::UNCHANGED) { - if (oldChange.type != Change::DELETED || runparams.ctObject != OutputParams::CT_OMITOBJECT) { + if (oldChange.type != Change::DELETED || runparams.ctObject != CtObject::OmitObject) { // close \lyxadded or \lyxdeleted os << '}'; column++; @@ -446,13 +446,13 @@ int Changes::latexMarkChange(otexstream & os, BufferParams const & bparams, docstring macro_beg; if (change.type == Change::DELETED) { - if (runparams.ctObject == OutputParams::CT_OMITOBJECT) + if (runparams.ctObject == CtObject::OmitObject) return 0; - else if (runparams.ctObject == OutputParams::CT_OBJECT) + else if (runparams.ctObject == CtObject::Object) macro_beg = from_ascii("\\lyxobjdeleted"); - else if (runparams.ctObject == OutputParams::CT_DISPLAYOBJECT) + else if (runparams.ctObject == CtObject::DisplayObject) macro_beg = from_ascii("\\lyxdisplayobjdeleted"); - else if (runparams.ctObject == OutputParams::CT_UDISPLAYOBJECT) + else if (runparams.ctObject == CtObject::UDisplayObject) macro_beg = from_ascii("\\lyxudisplayobjdeleted"); else { macro_beg = from_ascii("\\lyxdeleted"); diff --git a/src/Converter.cpp b/src/Converter.cpp index 747dd88ada..138980b5f4 100644 --- a/src/Converter.cpp +++ b/src/Converter.cpp @@ -23,6 +23,7 @@ #include "LaTeX.h" #include "LyXRC.h" #include "Mover.h" +#include "OutputParams.h" #include "ParagraphList.h" #include "Session.h" @@ -258,28 +259,28 @@ void Converters::updateLast(Formats const & formats) } -OutputParams::FLAVOR Converters::getFlavor(Graph::EdgePath const & path, +FLAVOR Converters::getFlavor(Graph::EdgePath const & path, Buffer const * buffer) const { for (auto const & edge : path) { Converter const & conv = converterlist_[edge]; if (conv.latex() || conv.need_aux()) { if (conv.latex_flavor() == "latex") - return OutputParams::LATEX; + return FLAVOR::LATEX; if (conv.latex_flavor() == "xelatex") - return OutputParams::XETEX; + return FLAVOR::XETEX; if (conv.latex_flavor() == "lualatex") - return OutputParams::LUATEX; + return FLAVOR::LUATEX; if (conv.latex_flavor() == "dvilualatex") - return OutputParams::DVILUATEX; + return FLAVOR::DVILUATEX; if (conv.latex_flavor() == "pdflatex") - return OutputParams::PDFLATEX; + return FLAVOR::PDFLATEX; } if (conv.docbook()) - return OutputParams::DOCBOOK5; + return FLAVOR::DOCBOOK5; } return buffer ? buffer->params().getOutputFlavor() - : OutputParams::LATEX; + : FLAVOR::LATEX; } @@ -601,16 +602,16 @@ Converters::RetVal Converters::convert(Buffer const * buffer, LASSERT(buffer, return FAILURE); string command; switch (runparams.flavor) { - case OutputParams::DVILUATEX: + case FLAVOR::DVILUATEX: command = dvilualatex_command_; break; - case OutputParams::LUATEX: + case FLAVOR::LUATEX: command = lualatex_command_; break; - case OutputParams::PDFLATEX: + case FLAVOR::PDFLATEX: command = pdflatex_command_; break; - case OutputParams::XETEX: + case FLAVOR::XETEX: command = xelatex_command_; break; default: @@ -832,7 +833,7 @@ bool Converters::scanLog(Buffer const & buffer, string const & /*command*/, FileName const & filename, ErrorList & errorList) { OutputParams runparams(nullptr); - runparams.flavor = OutputParams::LATEX; + runparams.flavor = FLAVOR::LATEX; LaTeX latex("", runparams, filename); TeXErrors terr; int const result = latex.scanLogFile(terr); diff --git a/src/Converter.h b/src/Converter.h index b9ee3292bb..ca60e16696 100644 --- a/src/Converter.h +++ b/src/Converter.h @@ -13,7 +13,6 @@ #define CONVERTER_H #include "Graph.h" -#include "OutputParams.h" #include "support/trivstring.h" #include @@ -29,6 +28,9 @@ class Buffer; class ErrorList; class Format; class Formats; +class OutputParams; + +enum class FLAVOR : int; class ConversionException : public std::exception { public: @@ -175,7 +177,7 @@ public: /// Graph::EdgePath getPath(std::string const & from, std::string const & to); /// - OutputParams::FLAVOR getFlavor(Graph::EdgePath const & path, + FLAVOR getFlavor(Graph::EdgePath const & path, Buffer const * buffer = nullptr) const; /// std::string getHyperrefDriver(Graph::EdgePath const & path) const; diff --git a/src/Format.cpp b/src/Format.cpp index 62c09d0fa4..4af5790058 100644 --- a/src/Format.cpp +++ b/src/Format.cpp @@ -818,20 +818,20 @@ string const Formats::extensions(string const & name) const namespace { -typedef Translator FlavorTranslator; +typedef Translator FlavorTranslator; FlavorTranslator initFlavorTranslator() { - FlavorTranslator f(OutputParams::LATEX, "latex"); - f.addPair(OutputParams::DVILUATEX, "dviluatex"); - f.addPair(OutputParams::LUATEX, "luatex"); - f.addPair(OutputParams::PDFLATEX, "pdflatex"); - f.addPair(OutputParams::XETEX, "xetex"); - f.addPair(OutputParams::DOCBOOK5, "docbook-xml"); - f.addPair(OutputParams::HTML, "xhtml"); - f.addPair(OutputParams::TEXT, "text"); - f.addPair(OutputParams::LYX, "lyx"); + FlavorTranslator f(FLAVOR::LATEX, "latex"); + f.addPair(FLAVOR::DVILUATEX, "dviluatex"); + f.addPair(FLAVOR::LUATEX, "luatex"); + f.addPair(FLAVOR::PDFLATEX, "pdflatex"); + f.addPair(FLAVOR::XETEX, "xetex"); + f.addPair(FLAVOR::DOCBOOK5, "docbook-xml"); + f.addPair(FLAVOR::HTML, "xhtml"); + f.addPair(FLAVOR::TEXT, "text"); + f.addPair(FLAVOR::LYX, "lyx"); return f; } @@ -845,14 +845,14 @@ FlavorTranslator const & flavorTranslator() } // namespace -std::string flavor2format(OutputParams::FLAVOR flavor) +std::string flavor2format(FLAVOR flavor) { return flavorTranslator().find(flavor); } /* Not currently needed, but I'll leave the code in case it is. -OutputParams::FLAVOR format2flavor(std::string fmt) +FLAVOR format2flavor(std::string fmt) { return flavorTranslator().find(fmt); } */ diff --git a/src/Format.h b/src/Format.h index 75a60fe3d5..b4cc9f4fc4 100644 --- a/src/Format.h +++ b/src/Format.h @@ -12,8 +12,6 @@ #ifndef FORMAT_H #define FORMAT_H -#include "OutputParams.h" - #include "support/strfwd.h" #include "support/trivstring.h" @@ -25,6 +23,8 @@ namespace support { class FileName; } class Buffer; +enum class FLAVOR : int; + class Format { public: /// Flags for some format properties @@ -219,9 +219,9 @@ private: }; /// -std::string flavor2format(OutputParams::FLAVOR flavor); +std::string flavor2format(FLAVOR flavor); // Not currently used. -// OutputParams::FLAVOR format2flavor(std::string fmt); +// FLAVOR format2flavor(std::string fmt); /// The global instance. /// Implementation is in LyX.cpp. diff --git a/src/LaTeXFeatures.cpp b/src/LaTeXFeatures.cpp index 4da0e3b598..8a515a1405 100644 --- a/src/LaTeXFeatures.cpp +++ b/src/LaTeXFeatures.cpp @@ -1263,8 +1263,8 @@ string const LaTeXFeatures::getPackages() const if (mustProvide("changebar")) { packages << "\\usepackage"; - if (runparams_.flavor == OutputParams::LATEX - || runparams_.flavor == OutputParams::DVILUATEX) + if (runparams_.flavor == FLAVOR::LATEX + || runparams_.flavor == FLAVOR::DVILUATEX) packages << "[dvips]"; packages << "{changebar}\n"; } @@ -1278,8 +1278,8 @@ string const LaTeXFeatures::getPackages() const // [pdf]lscape is used to rotate longtables if (mustProvide("lscape")) { - if (runparams_.flavor == OutputParams::LATEX - || runparams_.flavor == OutputParams::DVILUATEX) + if (runparams_.flavor == FLAVOR::LATEX + || runparams_.flavor == FLAVOR::DVILUATEX) packages << "\\usepackage{lscape}\n"; else packages << "\\usepackage{pdflscape}\n"; @@ -1526,10 +1526,10 @@ TexString LaTeXFeatures::getMacros() const macros << "\\XeTeXdashbreakstate 0" << '\n'; if (mustProvide("papersize")) { - if (runparams_.flavor == OutputParams::LATEX - || runparams_.flavor == OutputParams::DVILUATEX) + if (runparams_.flavor == FLAVOR::LATEX + || runparams_.flavor == FLAVOR::DVILUATEX) macros << papersizedvi_def << '\n'; - else if (runparams_.flavor == OutputParams::LUATEX) + else if (runparams_.flavor == FLAVOR::LUATEX) macros << papersizepdflua_def << '\n'; else macros << papersizepdf_def << '\n'; @@ -1655,13 +1655,13 @@ TexString LaTeXFeatures::getMacros() const if (mustProvide("textquotedbl")) macros << textquotedbl_def << '\n'; if (mustProvide("textquotesinglep")) { - if (runparams_.flavor == OutputParams::XETEX) + if (runparams_.flavor == FLAVOR::XETEX) macros << textquotesinglep_xetex_def << '\n'; else macros << textquotesinglep_luatex_def << '\n'; } if (mustProvide("textquotedblp")) { - if (runparams_.flavor == OutputParams::XETEX) + if (runparams_.flavor == FLAVOR::XETEX) macros << textquotedblp_xetex_def << '\n'; else macros << textquotedblp_luatex_def << '\n'; @@ -1689,7 +1689,7 @@ TexString LaTeXFeatures::getMacros() const if (mustProvide("lyxgreyedout")) { // We need different version for RTL (#8647) if (hasRTLLanguage()) { - if (runparams_.flavor == OutputParams::LUATEX) + if (runparams_.flavor == FLAVOR::LUATEX) if (useBabel()) macros << lyxgreyedout_luartl_babel_def; else diff --git a/src/OutputParams.cpp b/src/OutputParams.cpp index cf32695caa..516db84480 100644 --- a/src/OutputParams.cpp +++ b/src/OutputParams.cpp @@ -36,20 +36,25 @@ OutputParams::~OutputParams() bool OutputParams::isLaTeX() const { - return flavor == LATEX || flavor == LUATEX || flavor == DVILUATEX - || flavor == PDFLATEX || flavor == XETEX; + return flavor == FLAVOR::LATEX + || flavor == FLAVOR::LUATEX + || flavor == FLAVOR::DVILUATEX + || flavor == FLAVOR::PDFLATEX + || flavor == FLAVOR::XETEX; } bool OutputParams::isFullUnicode() const { - return flavor == LUATEX || flavor == DVILUATEX || flavor == XETEX; + return flavor == FLAVOR::LUATEX + || flavor == FLAVOR::DVILUATEX + || flavor == FLAVOR::XETEX; } bool OutputParams::useBidiPackage() const { - return use_polyglossia && flavor == XETEX; + return use_polyglossia && flavor == FLAVOR::XETEX; } } // namespace lyx diff --git a/src/OutputParams.h b/src/OutputParams.h index 1cd16d2ee3..7eb4349767 100644 --- a/src/OutputParams.h +++ b/src/OutputParams.h @@ -28,20 +28,30 @@ class Font; class Language; class InsetArgument; + +enum class FLAVOR : int { + DVILUATEX, + LATEX, + LUATEX, + PDFLATEX, + XETEX, + DOCBOOK5, + HTML, + TEXT, + LYX +}; + +enum class CtObject : int { + Normal, + Object, + DisplayObject, + UDisplayObject, + OmitObject +}; + + class OutputParams { public: - enum FLAVOR { - DVILUATEX, - LATEX, - LUATEX, - PDFLATEX, - XETEX, - DOCBOOK5, - HTML, - TEXT, - LYX - }; - enum MathFlavor { NotApplicable, MathAsMathML, @@ -62,21 +72,13 @@ public: SUBFLOAT }; - enum CtObject { - CT_NORMAL, - CT_OBJECT, - CT_DISPLAYOBJECT, - CT_UDISPLAYOBJECT, - CT_OMITOBJECT - }; - OutputParams(Encoding const *); ~OutputParams(); /** The file that we export depends occasionally on what is to compile the file. */ - FLAVOR flavor = LATEX; + FLAVOR flavor = FLAVOR::LATEX; /// is it some flavor of LaTeX? bool isLaTeX() const; /// does this flavour support full unicode? @@ -307,7 +309,7 @@ public: /** What kind of change tracking object is this? * Relevant for strikeout method in output */ - mutable CtObject ctObject = CT_NORMAL; + mutable CtObject ctObject = CtObject::Normal; /** allow output of only part of the top-level paragraphs * par_begin: beginning paragraph diff --git a/src/PDFOptions.cpp b/src/PDFOptions.cpp index a3dd1f34e5..f758c146b7 100644 --- a/src/PDFOptions.cpp +++ b/src/PDFOptions.cpp @@ -191,7 +191,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, // this if the current input encoding does not support a character. // FIXME: don't use \inputencoding if "inputenc" is not loaded (#9839). if (need_unicode && enc && enc->iconvName() != "UTF-8") { - if (runparams.flavor != OutputParams::XETEX) + if (runparams.flavor != FLAVOR::XETEX) os << "\\inputencoding{utf8}\n"; os << setEncoding("UTF-8"); } @@ -211,7 +211,7 @@ void PDFOptions::writeLaTeX(OutputParams & runparams, otexstream & os, os << from_utf8(opt); if (need_unicode && enc && enc->iconvName() != "UTF-8") { os << setEncoding(enc->iconvName()); - if (runparams.flavor != OutputParams::XETEX) + if (runparams.flavor != FLAVOR::XETEX) os << "\\inputencoding{" << from_ascii(enc->latexName()) << "}\n"; } } diff --git a/src/Paragraph.cpp b/src/Paragraph.cpp index 1e92259158..7db4a3ecca 100644 --- a/src/Paragraph.cpp +++ b/src/Paragraph.cpp @@ -1236,7 +1236,7 @@ void Paragraph::Private::latexSpecialChar(otexstream & os, && !runparams.inIPA // TODO #10961: && not in inset Flex Code // TODO #10961: && not in layout LyXCode - && (!bparams.useNonTeXFonts || runparams.flavor != OutputParams::XETEX)) { + && (!bparams.useNonTeXFonts || runparams.flavor != FLAVOR::XETEX)) { if (c == 0x2013) { // en-dash os << "--"; @@ -1390,7 +1390,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const features.addPreambleSnippet(os.release(), true); } - if (features.runparams().flavor == OutputParams::HTML + if (features.runparams().flavor == FLAVOR::HTML && layout_->htmltitle()) { features.setHTMLTitle(owner_->asString(AS_STR_INSETS | AS_STR_SKIPDELETE)); } @@ -1485,7 +1485,7 @@ void Paragraph::Private::validate(LaTeXFeatures & features) const } else if (!bp.use_dash_ligatures && (c == 0x2013 || c == 0x2014) && bp.useNonTeXFonts - && features.runparams().flavor == OutputParams::XETEX) + && features.runparams().flavor == FLAVOR::XETEX) // XeTeX's dash behaviour is determined via a global setting features.require("xetexdashbreakstate"); BufferEncodings::validate(c, features); @@ -2510,7 +2510,7 @@ void Paragraph::latex(BufferParams const & bparams, if (c == META_INSET && i >= start_pos && (end_pos == -1 || i < end_pos)) { if (isDeleted(i)) - runparams.ctObject = getInset(i)->CtObject(runparams); + runparams.ctObject = getInset(i)->getCtObject(runparams); InsetMath const * im = getInset(i)->asInsetMath(); if (im && im->asHullInset() @@ -2835,14 +2835,14 @@ void Paragraph::latex(BufferParams const & bparams, if (incremented) --parInline; - if (runparams.ctObject == OutputParams::CT_DISPLAYOBJECT - || runparams.ctObject == OutputParams::CT_UDISPLAYOBJECT) { + if (runparams.ctObject == CtObject::DisplayObject + || runparams.ctObject == CtObject::UDisplayObject) { // Close \lyx*deleted and force its // reopening (if needed) os << '}'; column++; runningChange = Change(Change::UNCHANGED); - runparams.ctObject = OutputParams::CT_NORMAL; + runparams.ctObject = CtObject::Normal; } } } else if (i >= start_pos && (end_pos == -1 || i < end_pos)) { diff --git a/src/Undo.cpp b/src/Undo.cpp index 6704490352..c6b7eaa331 100644 --- a/src/Undo.cpp +++ b/src/Undo.cpp @@ -29,7 +29,6 @@ #include "mathed/MathData.h" -#include "insets/Inset.h" #include "insets/InsetText.h" #include "support/debug.h" diff --git a/src/frontends/qt/GuiBox.h b/src/frontends/qt/GuiBox.h index 1df2074a5e..86bfe05c87 100644 --- a/src/frontends/qt/GuiBox.h +++ b/src/frontends/qt/GuiBox.h @@ -13,6 +13,7 @@ #ifndef GUIBOX_H #define GUIBOX_H +#include "ColorCode.h" #include "InsetParamsWidget.h" #include "ui_BoxUi.h" diff --git a/src/frontends/qt/GuiDocument.cpp b/src/frontends/qt/GuiDocument.cpp index ca874f6078..75d960f058 100644 --- a/src/frontends/qt/GuiDocument.cpp +++ b/src/frontends/qt/GuiDocument.cpp @@ -46,7 +46,6 @@ #include "LayoutModuleList.h" #include "LyXRC.h" #include "ModuleList.h" -#include "OutputParams.h" #include "PDFOptions.h" #include "qt_helpers.h" #include "Session.h" diff --git a/src/frontends/qt/GuiPrefs.h b/src/frontends/qt/GuiPrefs.h index 3bc368ac62..5fac6bc5e9 100644 --- a/src/frontends/qt/GuiPrefs.h +++ b/src/frontends/qt/GuiPrefs.h @@ -16,6 +16,7 @@ #include "GuiDialog.h" +#include "ColorCode.h" #include "Converter.h" #include "Format.h" #include "KeyMap.h" diff --git a/src/graphics/PreviewLoader.cpp b/src/graphics/PreviewLoader.cpp index de3f4a3616..7371ea68ff 100644 --- a/src/graphics/PreviewLoader.cpp +++ b/src/graphics/PreviewLoader.cpp @@ -190,7 +190,7 @@ private: /// Called by the ForkedCall process that generated the bitmap files. void finishedGenerating(pid_t, int); /// - void dumpPreamble(otexstream &, OutputParams::FLAVOR) const; + void dumpPreamble(otexstream &, FLAVOR) const; /// void dumpData(odocstream &, BitmapFile const &) const; @@ -637,37 +637,37 @@ void PreviewLoader::Impl::startLoading(bool wait) && buffer_.params().default_output_format != "default"; // Use LATEX flavor if the document does not specify a specific // output format (see bug 9371). - OutputParams::FLAVOR flavor = docformat + FLAVOR flavor = docformat ? buffer_.params().getOutputFlavor() - : OutputParams::LATEX; + : FLAVOR::LATEX; if (buffer_.params().encoding().package() == Encoding::japanese) { latexparam = " --latex=platex"; - flavor = OutputParams::LATEX; + flavor = FLAVOR::LATEX; } else if (buffer_.params().useNonTeXFonts) { - if (flavor == OutputParams::LUATEX) + if (flavor == FLAVOR::LUATEX) latexparam = " --latex=lualatex"; else { - flavor = OutputParams::XETEX; + flavor = FLAVOR::XETEX; latexparam = " --latex=xelatex"; } } else { switch (flavor) { - case OutputParams::PDFLATEX: + case FLAVOR::PDFLATEX: latexparam = " --latex=pdflatex"; break; - case OutputParams::XETEX: + case FLAVOR::XETEX: latexparam = " --latex=xelatex"; break; - case OutputParams::LUATEX: + case FLAVOR::LUATEX: latexparam = " --latex=lualatex"; break; - case OutputParams::DVILUATEX: + case FLAVOR::DVILUATEX: latexparam = " --latex=dvilualatex"; break; default: - flavor = OutputParams::LATEX; + flavor = FLAVOR::LATEX; } } dumpPreamble(os, flavor); @@ -811,10 +811,10 @@ void PreviewLoader::Impl::finishedGenerating(pid_t pid, int retval) } -void PreviewLoader::Impl::dumpPreamble(otexstream & os, OutputParams::FLAVOR flavor) const +void PreviewLoader::Impl::dumpPreamble(otexstream & os, FLAVOR flavor) const { // Dump the preamble only. - LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << flavor); + LYXERR(Debug::LATEX, "dumpPreamble, flavor == " << static_cast(flavor)); OutputParams runparams(&buffer_.params().encoding()); runparams.flavor = flavor; runparams.nice = true; diff --git a/src/insets/Inset.cpp b/src/insets/Inset.cpp index 9fa53ba455..a5077edda3 100644 --- a/src/insets/Inset.cpp +++ b/src/insets/Inset.cpp @@ -594,6 +594,12 @@ bool Inset::undefined() const } +CtObject Inset::getCtObject(OutputParams const &) const +{ + return CtObject::Normal; +} + + void Inset::dump() const { write(lyxerr); diff --git a/src/insets/Inset.h b/src/insets/Inset.h index bdf66eb98c..8b47a05aa1 100644 --- a/src/insets/Inset.h +++ b/src/insets/Inset.h @@ -55,7 +55,6 @@ class LaTeXFeatures; class Lexer; class MathAtom; class MetricsInfo; -class OutputParams; class PainterInfo; class ParIterator; class Text; @@ -470,7 +469,7 @@ public: /// does this inset try to use all available space (like \\hfill does)? virtual bool isHfill() const { return false; } - virtual OutputParams::CtObject CtObject(OutputParams const &) const { return OutputParams::CT_NORMAL; } + virtual CtObject getCtObject(OutputParams const &) const; enum RowFlags { Inline = 0, diff --git a/src/insets/InsetArgument.cpp b/src/insets/InsetArgument.cpp index 2ae80ca9cf..8382d9542f 100644 --- a/src/insets/InsetArgument.cpp +++ b/src/insets/InsetArgument.cpp @@ -22,7 +22,6 @@ #include "Language.h" #include "Layout.h" #include "Lexer.h" -#include "OutputParams.h" #include "ParIterator.h" #include "TexRow.h" #include "texstream.h" diff --git a/src/insets/InsetBibitem.cpp b/src/insets/InsetBibitem.cpp index b16687e7d7..82d8185200 100644 --- a/src/insets/InsetBibitem.cpp +++ b/src/insets/InsetBibitem.cpp @@ -28,7 +28,6 @@ #include "Language.h" #include "Lexer.h" #include "output_xhtml.h" -#include "OutputParams.h" #include "Paragraph.h" #include "ParagraphList.h" #include "ParIterator.h" diff --git a/src/insets/InsetBibtex.cpp b/src/insets/InsetBibtex.cpp index ef7d29f0e8..d0caa0f8d0 100644 --- a/src/insets/InsetBibtex.cpp +++ b/src/insets/InsetBibtex.cpp @@ -28,7 +28,6 @@ #include "LaTeXFeatures.h" #include "output_latex.h" #include "xml.h" -#include "OutputParams.h" #include "PDFOptions.h" #include "texstream.h" #include "TextClass.h" @@ -907,7 +906,7 @@ void InsetBibtex::validate(LaTeXFeatures & features) const // FIXME XHTML // It'd be better to be able to get this from an InsetLayout, but at present // InsetLayouts do not seem really to work for things that aren't InsetTexts. - if (features.runparams().flavor == OutputParams::HTML) + if (features.runparams().flavor == FLAVOR::HTML) features.addCSSSnippet("div.bibtexentry { margin-left: 2em; text-indent: -2em; }\n" "span.bibtexlabel:before{ content: \"[\"; }\n" "span.bibtexlabel:after{ content: \"] \"; }"); diff --git a/src/insets/InsetBranch.cpp b/src/insets/InsetBranch.cpp index a70ff27463..bb1a090621 100644 --- a/src/insets/InsetBranch.cpp +++ b/src/insets/InsetBranch.cpp @@ -23,7 +23,6 @@ #include "FuncStatus.h" #include "Lexer.h" #include "LyX.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "TextClass.h" diff --git a/src/insets/InsetCaption.cpp b/src/insets/InsetCaption.cpp index 8297c6fcde..58242a100a 100644 --- a/src/insets/InsetCaption.cpp +++ b/src/insets/InsetCaption.cpp @@ -30,7 +30,6 @@ #include "xml.h" #include "output_latex.h" #include "output_xhtml.h" -#include "OutputParams.h" #include "Paragraph.h" #include "ParIterator.h" #include "TexRow.h" diff --git a/src/insets/InsetCitation.h b/src/insets/InsetCitation.h index 3be20013cb..3d97bbf058 100644 --- a/src/insets/InsetCitation.h +++ b/src/insets/InsetCitation.h @@ -17,6 +17,7 @@ namespace lyx { +class BufferParams; class CitationStyle; ///////////////////////////////////////////////////////////////////////// diff --git a/src/insets/InsetCollapsible.cpp b/src/insets/InsetCollapsible.cpp index 62a830b064..9c095c937a 100644 --- a/src/insets/InsetCollapsible.cpp +++ b/src/insets/InsetCollapsible.cpp @@ -26,7 +26,6 @@ #include "InsetLayout.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "TextClass.h" #include "TocBackend.h" diff --git a/src/insets/InsetCommandParams.cpp b/src/insets/InsetCommandParams.cpp index 2ee1934e06..c3df45a36a 100644 --- a/src/insets/InsetCommandParams.cpp +++ b/src/insets/InsetCommandParams.cpp @@ -31,7 +31,6 @@ #include "Buffer.h" #include "Encoding.h" #include "Lexer.h" -#include "OutputParams.h" #include "frontends/alert.h" diff --git a/src/insets/InsetCounter.cpp b/src/insets/InsetCounter.cpp index 4a2cda02e9..9c27979cf7 100644 --- a/src/insets/InsetCounter.cpp +++ b/src/insets/InsetCounter.cpp @@ -15,7 +15,6 @@ #include "BufferParams.h" #include "Counters.h" #include "LaTeXFeatures.h" -#include "OutputParams.h" #include "output_xhtml.h" #include "xml.h" #include "texstream.h" diff --git a/src/insets/InsetERT.cpp b/src/insets/InsetERT.cpp index 79ab024de5..113b31b155 100644 --- a/src/insets/InsetERT.cpp +++ b/src/insets/InsetERT.cpp @@ -18,7 +18,6 @@ #include "FuncStatus.h" #include "Language.h" #include "Lexer.h" -#include "OutputParams.h" #include "xml.h" #include "ParagraphParameters.h" #include "Paragraph.h" diff --git a/src/insets/InsetExternal.cpp b/src/insets/InsetExternal.cpp index a2f7216eaa..1915a5e084 100644 --- a/src/insets/InsetExternal.cpp +++ b/src/insets/InsetExternal.cpp @@ -29,7 +29,6 @@ #include "LyX.h" // use_gui #include "LyXRC.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_latex.h" #include "output_xhtml.h" #include "texstream.h" @@ -570,7 +569,7 @@ static docstring latexString(InsetExternal const & inset) // We don't need to set runparams.encoding since it is not used by // latex(). OutputParams runparams(0); - runparams.flavor = OutputParams::LATEX; + runparams.flavor = FLAVOR::LATEX; inset.latex(os, runparams); return ods.str(); } @@ -713,7 +712,7 @@ void InsetExternal::latex(otexstream & os, OutputParams const & runparams) const // If the template has specified a PDFLaTeX output, then we try and // use that. - if (runparams.flavor == OutputParams::PDFLATEX) { + if (runparams.flavor == FLAVOR::PDFLATEX) { external::Template const * const et_ptr = external::getTemplatePtr(params_); if (!et_ptr) @@ -816,25 +815,25 @@ void InsetExternal::validate(LaTeXFeatures & features) const string format; switch (features.runparams().flavor) { - case OutputParams::LATEX: - case OutputParams::DVILUATEX: + case FLAVOR::LATEX: + case FLAVOR::DVILUATEX: format = "LaTeX"; break; - case OutputParams::LUATEX: - case OutputParams::PDFLATEX: - case OutputParams::XETEX: + case FLAVOR::LUATEX: + case FLAVOR::PDFLATEX: + case FLAVOR::XETEX: format = "PDFLaTeX"; break; - case OutputParams::DOCBOOK5: + case FLAVOR::DOCBOOK5: format = "DocBook"; break; - case OutputParams::HTML: + case FLAVOR::HTML: format = "html"; break; - case OutputParams::TEXT: + case FLAVOR::TEXT: format = "text"; break; - case OutputParams::LYX: + case FLAVOR::LYX: format = "lyx"; break; } diff --git a/src/insets/InsetFloat.cpp b/src/insets/InsetFloat.cpp index 6500d5883b..7068b0ab07 100644 --- a/src/insets/InsetFloat.cpp +++ b/src/insets/InsetFloat.cpp @@ -256,6 +256,12 @@ string InsetFloat::getAlignment() const } +CtObject InsetFloat::getCtObject(OutputParams const &) const +{ + return CtObject::OmitObject; +} + + LyXAlignment InsetFloat::contentAlignment() const { LyXAlignment align = LYX_ALIGN_NONE; @@ -457,8 +463,8 @@ void InsetFloat::latex(otexstream & os, OutputParams const & runparams_in) const if (runparams.inDeletedInset) { // This has to be done manually since we need it inside the float - OutputParams::CtObject ctobject = runparams.ctObject; - runparams.ctObject = OutputParams::CT_DISPLAYOBJECT; + CtObject ctobject = runparams.ctObject; + runparams.ctObject = CtObject::DisplayObject; Changes::latexMarkChange(os, buffer().params(), Change(Change::UNCHANGED), Change(Change::DELETED), runparams); runparams.ctObject = ctobject; diff --git a/src/insets/InsetFloat.h b/src/insets/InsetFloat.h index bb9b645191..0fc0fba398 100644 --- a/src/insets/InsetFloat.h +++ b/src/insets/InsetFloat.h @@ -123,7 +123,7 @@ private: /// std::string getAlignment() const; /// - OutputParams::CtObject CtObject(OutputParams const &) const override { return OutputParams::CT_OMITOBJECT; } + CtObject getCtObject(OutputParams const &) const override; InsetFloatParams params_; }; diff --git a/src/insets/InsetFoot.cpp b/src/insets/InsetFoot.cpp index 3a2f5b377d..eebbeb4f46 100644 --- a/src/insets/InsetFoot.cpp +++ b/src/insets/InsetFoot.cpp @@ -20,7 +20,6 @@ #include "Language.h" #include "LaTeXFeatures.h" #include "Layout.h" -#include "OutputParams.h" #include "output_docbook.h" #include "ParIterator.h" #include "TextClass.h" diff --git a/src/insets/InsetGraphics.cpp b/src/insets/InsetGraphics.cpp index cc8937b497..433c6cca52 100644 --- a/src/insets/InsetGraphics.cpp +++ b/src/insets/InsetGraphics.cpp @@ -65,7 +65,6 @@ TODO #include "Lexer.h" #include "MetricsInfo.h" #include "Mover.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "xml.h" @@ -112,9 +111,9 @@ namespace { string findTargetFormat(string const & format, OutputParams const & runparams) { // Are we latexing to DVI or PDF? - if (runparams.flavor == OutputParams::PDFLATEX - || runparams.flavor == OutputParams::XETEX - || runparams.flavor == OutputParams::LUATEX) { + if (runparams.flavor == FLAVOR::PDFLATEX + || runparams.flavor == FLAVOR::XETEX + || runparams.flavor == FLAVOR::LUATEX) { LYXERR(Debug::GRAPHICS, "findTargetFormat: PDF mode"); Format const * const f = theFormats().getFormat(format); // Convert vector graphics to pdf @@ -128,7 +127,7 @@ string findTargetFormat(string const & format, OutputParams const & runparams) } // for HTML and DocBook, we leave the known formats and otherwise convert to png - if (runparams.flavor == OutputParams::HTML || runparams.flavor == OutputParams::DOCBOOK5) { + if (runparams.flavor == FLAVOR::HTML || runparams.flavor == FLAVOR::DOCBOOK5) { Format const * const f = theFormats().getFormat(format); // Convert vector graphics to svg if (f && f->vectorFormat() && theConverters().isReachable(format, "svg")) @@ -697,7 +696,7 @@ string InsetGraphics::prepareFile(OutputParams const & runparams) const } // only show DVI-specific warning when export format is plain latex if (!isValidDVIFileName(output_file) - && runparams.flavor == OutputParams::LATEX) { + && runparams.flavor == FLAVOR::LATEX) { frontend::Alert::warning(_("Problematic filename for DVI"), _("The following filename can cause troubles " "when running the exported file through LaTeX " @@ -845,8 +844,8 @@ void InsetGraphics::latex(otexstream & os, string after; // Write the options if there are any. - bool const ps = runparams.flavor == OutputParams::LATEX - || runparams.flavor == OutputParams::DVILUATEX; + bool const ps = runparams.flavor == FLAVOR::LATEX + || runparams.flavor == FLAVOR::DVILUATEX; string const opts = createLatexOptions(ps); LYXERR(Debug::GRAPHICS, "\tOpts = " << opts); @@ -1041,6 +1040,12 @@ string InsetGraphics::prepareHTMLFile(OutputParams const & runparams) const } +CtObject InsetGraphics::getCtObject(OutputParams const &) const +{ + return CtObject::Object; +} + + docstring InsetGraphics::xhtml(XMLStream & xs, OutputParams const & op) const { string const output_file = op.dryrun ? string() : prepareHTMLFile(op); diff --git a/src/insets/InsetGraphics.h b/src/insets/InsetGraphics.h index c68356569d..2f0156dfc9 100644 --- a/src/insets/InsetGraphics.h +++ b/src/insets/InsetGraphics.h @@ -141,7 +141,7 @@ public: /// or an empty string on error. std::string prepareHTMLFile(OutputParams const & runparams) const; /// - OutputParams::CtObject CtObject(OutputParams const &) const override { return OutputParams::CT_OBJECT; } + CtObject getCtObject(OutputParams const &) const override; private: /// diff --git a/src/insets/InsetHyperlink.cpp b/src/insets/InsetHyperlink.cpp index 66bfa6d184..3801f4de90 100644 --- a/src/insets/InsetHyperlink.cpp +++ b/src/insets/InsetHyperlink.cpp @@ -17,7 +17,6 @@ #include "FuncRequest.h" #include "FuncStatus.h" #include "LaTeXFeatures.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "xml.h" diff --git a/src/insets/InsetIPA.cpp b/src/insets/InsetIPA.cpp index 1597d0d423..7745b8d946 100644 --- a/src/insets/InsetIPA.cpp +++ b/src/insets/InsetIPA.cpp @@ -21,7 +21,6 @@ #include "LaTeXFeatures.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "RenderPreview.h" #include "texstream.h" diff --git a/src/insets/InsetInclude.cpp b/src/insets/InsetInclude.cpp index 60cfed21d9..a610c3c063 100644 --- a/src/insets/InsetInclude.cpp +++ b/src/insets/InsetInclude.cpp @@ -32,7 +32,6 @@ #include "MetricsInfo.h" #include "output_plaintext.h" #include "output_xhtml.h" -#include "OutputParams.h" #include "texstream.h" #include "TextClass.h" #include "TocBackend.h" @@ -1291,7 +1290,7 @@ docstring latexString(InsetInclude const & inset) // We don't need to set runparams.encoding since this will be done // by latex() anyway. OutputParams runparams(nullptr); - runparams.flavor = OutputParams::LATEX; + runparams.flavor = FLAVOR::LATEX; runparams.for_preview = true; inset.latex(os, runparams); diff --git a/src/insets/InsetInfo.cpp b/src/insets/InsetInfo.cpp index 2c72d9044a..96c3062ebf 100644 --- a/src/insets/InsetInfo.cpp +++ b/src/insets/InsetInfo.cpp @@ -15,6 +15,7 @@ #include "Buffer.h" #include "BufferParams.h" #include "BufferView.h" +#include "Changes.h" #include "Cursor.h" #include "CutAndPaste.h" #include "Font.h" diff --git a/src/insets/InsetLine.cpp b/src/insets/InsetLine.cpp index 8d6a4ada2f..cb0a074738 100644 --- a/src/insets/InsetLine.cpp +++ b/src/insets/InsetLine.cpp @@ -22,7 +22,6 @@ #include "FuncStatus.h" #include "LaTeXFeatures.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "texstream.h" diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp index 366b22b0c7..25743b909c 100644 --- a/src/insets/InsetListings.cpp +++ b/src/insets/InsetListings.cpp @@ -30,7 +30,6 @@ #include "output_latex.h" #include "output_docbook.h" #include "output_xhtml.h" -#include "OutputParams.h" #include "TextClass.h" #include "TexRow.h" #include "texstream.h" diff --git a/src/insets/InsetMarginal.cpp b/src/insets/InsetMarginal.cpp index 3a5296d089..a0b74c64ed 100644 --- a/src/insets/InsetMarginal.cpp +++ b/src/insets/InsetMarginal.cpp @@ -15,7 +15,6 @@ #include "Buffer.h" #include "BufferParams.h" -#include "OutputParams.h" #include "output_docbook.h" #include "TocBackend.h" diff --git a/src/insets/InsetNewline.cpp b/src/insets/InsetNewline.cpp index 0e07af13f7..f5fcd42ac6 100644 --- a/src/insets/InsetNewline.cpp +++ b/src/insets/InsetNewline.cpp @@ -19,7 +19,6 @@ #include "FuncStatus.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "texstream.h" diff --git a/src/insets/InsetNewpage.cpp b/src/insets/InsetNewpage.cpp index 7acd3a01a0..f4eba12cf8 100644 --- a/src/insets/InsetNewpage.cpp +++ b/src/insets/InsetNewpage.cpp @@ -18,7 +18,6 @@ #include "FuncStatus.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "xml.h" #include "texstream.h" #include "Text.h" diff --git a/src/insets/InsetNomencl.cpp b/src/insets/InsetNomencl.cpp index 804fd122e8..e30131cadd 100644 --- a/src/insets/InsetNomencl.cpp +++ b/src/insets/InsetNomencl.cpp @@ -26,7 +26,6 @@ #include "Language.h" #include "LaTeXFeatures.h" #include "LyX.h" -#include "OutputParams.h" #include "xml.h" #include "texstream.h" #include "TocBackend.h" diff --git a/src/insets/InsetNote.cpp b/src/insets/InsetNote.cpp index 0f5f64cb2f..90fed5757a 100644 --- a/src/insets/InsetNote.cpp +++ b/src/insets/InsetNote.cpp @@ -26,7 +26,6 @@ #include "LaTeXFeatures.h" #include "Lexer.h" #include "LyXRC.h" -#include "OutputParams.h" #include "output_docbook.h" #include "TextClass.h" #include "TocBackend.h" @@ -297,7 +296,7 @@ void InsetNote::validate(LaTeXFeatures & features) const { switch (params_.type) { case InsetNoteParams::Comment: - if (features.runparams().flavor == OutputParams::HTML) + if (features.runparams().flavor == FLAVOR::HTML) // we do output this but set display to "none" by default, // but people might want to use it. InsetCollapsible::validate(features); diff --git a/src/insets/InsetPhantom.cpp b/src/insets/InsetPhantom.cpp index eac2bd0e06..d1a25f6a70 100644 --- a/src/insets/InsetPhantom.cpp +++ b/src/insets/InsetPhantom.cpp @@ -24,7 +24,6 @@ #include "LaTeXFeatures.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "texstream.h" #include "TextClass.h" diff --git a/src/insets/InsetPreview.cpp b/src/insets/InsetPreview.cpp index 7fe92e8cfe..d1a0343fbc 100644 --- a/src/insets/InsetPreview.cpp +++ b/src/insets/InsetPreview.cpp @@ -17,7 +17,6 @@ #include "Cursor.h" #include "Dimension.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "RenderPreview.h" #include "texstream.h" diff --git a/src/insets/InsetQuotes.cpp b/src/insets/InsetQuotes.cpp index f221dd04e2..5315e39e11 100644 --- a/src/insets/InsetQuotes.cpp +++ b/src/insets/InsetQuotes.cpp @@ -27,7 +27,6 @@ #include "Lexer.h" #include "LyXRC.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "Paragraph.h" #include "ParIterator.h" #include "texstream.h" @@ -913,8 +912,8 @@ void InsetQuotes::latex(otexstream & os, OutputParams const & runparams) const // LuaTeX does not respect {} as ligature breaker by design, // see https://tex.stackexchange.com/q/349725/19291 docstring const nolig = - (runparams.flavor == OutputParams::LUATEX - || runparams.flavor == OutputParams::DVILUATEX) ? + (runparams.flavor == FLAVOR::LUATEX + || runparams.flavor == FLAVOR::DVILUATEX) ? from_ascii("\\/") : from_ascii("{}"); // !` ?` => !{}` ?{}` if (prefixIs(qstr, from_ascii("`")) diff --git a/src/insets/InsetRef.cpp b/src/insets/InsetRef.cpp index 063691b154..200f5e5b72 100644 --- a/src/insets/InsetRef.cpp +++ b/src/insets/InsetRef.cpp @@ -20,7 +20,6 @@ #include "Language.h" #include "LaTeXFeatures.h" #include "LyX.h" -#include "OutputParams.h" #include "output_xhtml.h" #include "Paragraph.h" #include "ParIterator.h" diff --git a/src/insets/InsetScript.cpp b/src/insets/InsetScript.cpp index eccf3c3029..c1f8da1e82 100644 --- a/src/insets/InsetScript.cpp +++ b/src/insets/InsetScript.cpp @@ -25,7 +25,6 @@ #include "Lexer.h" #include "LyXAction.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "TextClass.h" diff --git a/src/insets/InsetSeparator.cpp b/src/insets/InsetSeparator.cpp index 16f7cdcbdf..218172c87a 100644 --- a/src/insets/InsetSeparator.cpp +++ b/src/insets/InsetSeparator.cpp @@ -18,7 +18,6 @@ #include "FuncStatus.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "output_docbook.h" #include "output_xhtml.h" #include "texstream.h" diff --git a/src/insets/InsetSpace.cpp b/src/insets/InsetSpace.cpp index d4cb7361b4..60db460aa2 100644 --- a/src/insets/InsetSpace.cpp +++ b/src/insets/InsetSpace.cpp @@ -24,7 +24,6 @@ #include "LaTeXFeatures.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "texstream.h" #include "xml.h" diff --git a/src/insets/InsetTOC.cpp b/src/insets/InsetTOC.cpp index af19e53fd4..a429d2d5bc 100644 --- a/src/insets/InsetTOC.cpp +++ b/src/insets/InsetTOC.cpp @@ -21,7 +21,6 @@ #include "FuncRequest.h" #include "Language.h" #include "LaTeXFeatures.h" -#include "OutputParams.h" #include "output_xhtml.h" #include "Paragraph.h" #include "ParagraphParameters.h" diff --git a/src/insets/InsetTabular.cpp b/src/insets/InsetTabular.cpp index 21947f46a5..53d9ac1ae5 100644 --- a/src/insets/InsetTabular.cpp +++ b/src/insets/InsetTabular.cpp @@ -42,7 +42,6 @@ #include "LyX.h" #include "LyXRC.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "xml.h" #include "output_xhtml.h" #include "Paragraph.h" diff --git a/src/insets/InsetTabular.h b/src/insets/InsetTabular.h index 19e9a13092..52d654c4b1 100644 --- a/src/insets/InsetTabular.h +++ b/src/insets/InsetTabular.h @@ -24,6 +24,7 @@ #ifndef INSET_TABULAR_H #define INSET_TABULAR_H +#include "Changes.h" #include "InsetText.h" #include "support/Length.h" diff --git a/src/insets/InsetText.cpp b/src/insets/InsetText.cpp index 78e389cadb..8be79896ca 100644 --- a/src/insets/InsetText.cpp +++ b/src/insets/InsetText.cpp @@ -40,7 +40,6 @@ #include "output_latex.h" #include "output_plaintext.h" #include "output_xhtml.h" -#include "OutputParams.h" #include "Paragraph.h" #include "ParagraphParameters.h" #include "ParIterator.h" diff --git a/src/insets/InsetVSpace.cpp b/src/insets/InsetVSpace.cpp index 03a272e650..c774e98b85 100644 --- a/src/insets/InsetVSpace.cpp +++ b/src/insets/InsetVSpace.cpp @@ -22,7 +22,6 @@ #include "FuncStatus.h" #include "Lexer.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "xml.h" #include "texstream.h" #include "Text.h" diff --git a/src/lyxfind.cpp b/src/lyxfind.cpp index 1fff078670..95dcf19674 100644 --- a/src/lyxfind.cpp +++ b/src/lyxfind.cpp @@ -905,7 +905,7 @@ static docstring buffer_to_latex(Buffer & buffer) odocstringstream ods; otexstream os(ods); runparams.nice = true; - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -928,7 +928,7 @@ static docstring stringifySearchBuffer(Buffer & buffer, FindAndReplaceOptions co // OutputParams runparams(&buffer.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = true; - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; runparams.dryrun = true; runparams.for_search = true; @@ -3119,7 +3119,7 @@ docstring stringifyFromCursor(DocIterator const & cur, int len) // OutputParams runparams(&cur.buffer()->params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = true; - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; runparams.linelen = 10000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -3165,7 +3165,7 @@ docstring latexifyFromCursor(DocIterator const & cur, int len) //OutputParams runparams(&buf.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = false; - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; runparams.linelen = 8000; //lyxrc.plaintext_linelen; // No side effect of file copying and image conversion runparams.dryrun = true; @@ -3641,7 +3641,7 @@ static int findAdvReplace(BufferView * bv, FindAndReplaceOptions const & opt, Ma // OutputParams runparams(&repl_buffer.params().encoding()); OutputParams runparams(encodings.fromLyXName("utf8")); runparams.nice = false; - runparams.flavor = OutputParams::XETEX; + runparams.flavor = FLAVOR::XETEX; runparams.linelen = 8000; //lyxrc.plaintext_linelen; runparams.dryrun = true; TeXOnePar(repl_buffer, repl_buffer.text(), 0, os, runparams); diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp index 9a91b6f841..f0df1d90fd 100644 --- a/src/mathed/InsetMathHull.cpp +++ b/src/mathed/InsetMathHull.cpp @@ -1091,9 +1091,9 @@ void InsetMathHull::validate(LaTeXFeatures & features) const } -OutputParams::CtObject InsetMathHull::CtObject(OutputParams const & runparams) const +CtObject InsetMathHull::getCtObject(OutputParams const & runparams) const { - OutputParams::CtObject res = OutputParams::CT_NORMAL; + CtObject res = CtObject::Normal; switch(type_) { case hullNone: case hullSimple: @@ -1112,9 +1112,9 @@ OutputParams::CtObject InsetMathHull::CtObject(OutputParams const & runparams) c case hullMultline: { if (runparams.inulemcmd && (!runparams.local_font || runparams.local_font->fontInfo().strikeout() != FONT_ON)) - res = OutputParams::CT_UDISPLAYOBJECT; + res = CtObject::UDisplayObject; else - res = OutputParams::CT_DISPLAYOBJECT; + res = CtObject::DisplayObject; break; } } diff --git a/src/mathed/InsetMathHull.h b/src/mathed/InsetMathHull.h index 0b085a11f9..d34f7fc6e4 100644 --- a/src/mathed/InsetMathHull.h +++ b/src/mathed/InsetMathHull.h @@ -88,7 +88,7 @@ public: /// bool outerDisplay() const; /// - OutputParams::CtObject CtObject(OutputParams const &) const override; + CtObject getCtObject(OutputParams const &) const override; /// void validate(LaTeXFeatures & features) const override; /// identifies HullInset diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp index 409f00c646..8974d2c985 100644 --- a/src/mathed/InsetMathNest.cpp +++ b/src/mathed/InsetMathNest.cpp @@ -51,7 +51,6 @@ #include "LyX.h" #include "LyXRC.h" #include "MetricsInfo.h" -#include "OutputParams.h" #include "TexRow.h" #include "Text.h" diff --git a/src/mathed/InsetMathRef.cpp b/src/mathed/InsetMathRef.cpp index 99058d776f..9efd865ea7 100644 --- a/src/mathed/InsetMathRef.cpp +++ b/src/mathed/InsetMathRef.cpp @@ -22,7 +22,6 @@ #include "MathData.h" #include "MathFactory.h" #include "MathSupport.h" -#include "OutputParams.h" #include "ParIterator.h" #include "xml.h" diff --git a/src/mathed/MathFactory.cpp b/src/mathed/MathFactory.cpp index 20720f1fce..28ed3df317 100644 --- a/src/mathed/MathFactory.cpp +++ b/src/mathed/MathFactory.cpp @@ -72,7 +72,6 @@ #include "BufferParams.h" #include "Encoding.h" #include "LyX.h" // use_gui -#include "OutputParams.h" #include diff --git a/src/output_xhtml.cpp b/src/output_xhtml.cpp index a4aced68b0..60be35c9a1 100644 --- a/src/output_xhtml.cpp +++ b/src/output_xhtml.cpp @@ -19,7 +19,6 @@ #include "Counters.h" #include "Font.h" #include "Layout.h" -#include "OutputParams.h" #include "Paragraph.h" #include "ParagraphList.h" #include "ParagraphParameters.h" diff --git a/src/xml.cpp b/src/xml.cpp index e479eadeec..2f54feb3a3 100644 --- a/src/xml.cpp +++ b/src/xml.cpp @@ -17,7 +17,6 @@ #include "BufferParams.h" #include "Counters.h" #include "Layout.h" -#include "OutputParams.h" #include "Paragraph.h" #include "Text.h" #include "TextClass.h"