mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Refactor OutputParams
Now all Inset hierarchy uses OutputParams.h included in Inset.h. Forward declare some enums to reduce header dependencies.
This commit is contained in:
parent
19f5aa58aa
commit
ecf62a8f21
@ -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<TexRow> 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<TexRow> 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<TexRow> 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<string> 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;
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "Author.h"
|
||||
#include "Buffer.h"
|
||||
#include "BufferParams.h"
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
|
||||
|
@ -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<string> 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<string> backs = backends();
|
||||
@ -3255,8 +3255,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);
|
||||
|
||||
@ -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)
|
||||
|
@ -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<std::string, OutputParams::FLAVOR> DefaultFlavorCache;
|
||||
typedef std::map<std::string, FLAVOR> DefaultFlavorCache;
|
||||
///
|
||||
mutable DefaultFlavorCache default_flavors_;
|
||||
/// the cite engine
|
||||
|
@ -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");
|
||||
|
@ -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);
|
||||
|
@ -13,7 +13,6 @@
|
||||
#define CONVERTER_H
|
||||
|
||||
#include "Graph.h"
|
||||
#include "OutputParams.h"
|
||||
#include "support/trivstring.h"
|
||||
|
||||
#include <vector>
|
||||
@ -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;
|
||||
|
@ -818,20 +818,20 @@ string const Formats::extensions(string const & name) const
|
||||
|
||||
namespace {
|
||||
|
||||
typedef Translator<OutputParams::FLAVOR, string> FlavorTranslator;
|
||||
typedef Translator<FLAVOR, string> 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);
|
||||
} */
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -28,9 +28,8 @@ class Font;
|
||||
class Language;
|
||||
class InsetArgument;
|
||||
|
||||
class OutputParams {
|
||||
public:
|
||||
enum FLAVOR {
|
||||
|
||||
enum class FLAVOR : int {
|
||||
DVILUATEX,
|
||||
LATEX,
|
||||
LUATEX,
|
||||
@ -40,8 +39,19 @@ public:
|
||||
HTML,
|
||||
TEXT,
|
||||
LYX
|
||||
};
|
||||
};
|
||||
|
||||
enum class CtObject : int {
|
||||
Normal,
|
||||
Object,
|
||||
DisplayObject,
|
||||
UDisplayObject,
|
||||
OmitObject
|
||||
};
|
||||
|
||||
|
||||
class OutputParams {
|
||||
public:
|
||||
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
|
||||
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
@ -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)) {
|
||||
|
@ -29,7 +29,6 @@
|
||||
|
||||
#include "mathed/MathData.h"
|
||||
|
||||
#include "insets/Inset.h"
|
||||
#include "insets/InsetText.h"
|
||||
|
||||
#include "support/debug.h"
|
||||
|
@ -13,6 +13,7 @@
|
||||
#ifndef GUIBOX_H
|
||||
#define GUIBOX_H
|
||||
|
||||
#include "ColorCode.h"
|
||||
#include "InsetParamsWidget.h"
|
||||
#include "ui_BoxUi.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -16,6 +16,7 @@
|
||||
|
||||
#include "GuiDialog.h"
|
||||
|
||||
#include "ColorCode.h"
|
||||
#include "Converter.h"
|
||||
#include "Format.h"
|
||||
#include "KeyMap.h"
|
||||
|
@ -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<int>(flavor));
|
||||
OutputParams runparams(&buffer_.params().encoding());
|
||||
runparams.flavor = flavor;
|
||||
runparams.nice = true;
|
||||
|
@ -594,6 +594,12 @@ bool Inset::undefined() const
|
||||
}
|
||||
|
||||
|
||||
CtObject Inset::getCtObject(OutputParams const &) const
|
||||
{
|
||||
return CtObject::Normal;
|
||||
}
|
||||
|
||||
|
||||
void Inset::dump() const
|
||||
{
|
||||
write(lyxerr);
|
||||
|
@ -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,
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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: \"] \"; }");
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -17,6 +17,7 @@
|
||||
|
||||
namespace lyx {
|
||||
|
||||
class BufferParams;
|
||||
class CitationStyle;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "InsetLayout.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "TextClass.h"
|
||||
#include "TocBackend.h"
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
#include "Buffer.h"
|
||||
#include "Encoding.h"
|
||||
#include "Lexer.h"
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include "frontends/alert.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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_;
|
||||
};
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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:
|
||||
///
|
||||
|
@ -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"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "RenderPreview.h"
|
||||
#include "texstream.h"
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
#include "Buffer.h"
|
||||
#include "BufferParams.h"
|
||||
#include "OutputParams.h"
|
||||
#include "output_docbook.h"
|
||||
#include "TocBackend.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "texstream.h"
|
||||
#include "TextClass.h"
|
||||
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Cursor.h"
|
||||
#include "Dimension.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "RenderPreview.h"
|
||||
#include "texstream.h"
|
||||
|
||||
|
@ -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("`"))
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -24,7 +24,6 @@
|
||||
#include "LaTeXFeatures.h"
|
||||
#include "Lexer.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "texstream.h"
|
||||
#include "xml.h"
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -24,6 +24,7 @@
|
||||
#ifndef INSET_TABULAR_H
|
||||
#define INSET_TABULAR_H
|
||||
|
||||
#include "Changes.h"
|
||||
#include "InsetText.h"
|
||||
|
||||
#include "support/Length.h"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -51,7 +51,6 @@
|
||||
#include "LyX.h"
|
||||
#include "LyXRC.h"
|
||||
#include "MetricsInfo.h"
|
||||
#include "OutputParams.h"
|
||||
#include "TexRow.h"
|
||||
#include "Text.h"
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "MathData.h"
|
||||
#include "MathFactory.h"
|
||||
#include "MathSupport.h"
|
||||
#include "OutputParams.h"
|
||||
#include "ParIterator.h"
|
||||
#include "xml.h"
|
||||
|
||||
|
@ -72,7 +72,6 @@
|
||||
#include "BufferParams.h"
|
||||
#include "Encoding.h"
|
||||
#include "LyX.h" // use_gui
|
||||
#include "OutputParams.h"
|
||||
|
||||
#include <iomanip>
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user