#include <algorithm>
#include <sstream>
-using std::count;
-using std::endl;
-using std::find;
-using std::string;
-using std::istringstream;
-using std::make_pair;
-using std::ostream;
-using std::ostringstream;
-using std::pair;
-using std::string;
-using lyx::support::FileName;
-using lyx::support::libFileSearch;
-using lyx::support::bformat;
-using lyx::support::rtrim;
-using lyx::support::tokenPos;
-using lyx::support::prefixIs;
+using namespace std;
+using namespace lyx::support;
static char const * const string_paragraph_separation[] = {
// Paper size
-typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
+typedef Translator<string, PAPER_SIZE> PaperSizeTranslator;
PaperSizeTranslator const init_papersizetranslator()
}
+void BufferParams::validate(LaTeXFeatures & features) const
+{
+ if (outputChanges) {
+ bool dvipost = LaTeXFeatures::isAvailable("dvipost");
+ bool xcolorsoul = LaTeXFeatures::isAvailable("soul") &&
+ LaTeXFeatures::isAvailable("xcolor");
+
+ switch (features.runparams().flavor) {
+ case OutputParams::LATEX:
+ if (dvipost) {
+ features.require("ct-dvipost");
+ features.require("dvipost");
+ } else if (xcolorsoul) {
+ features.require("ct-xcolor-soul");
+ features.require("soul");
+ features.require("xcolor");
+ } else {
+ features.require("ct-none");
+ }
+ break;
+ case OutputParams::PDFLATEX:
+ if (xcolorsoul) {
+ features.require("ct-xcolor-soul");
+ features.require("soul");
+ features.require("xcolor");
+ // improves color handling in PDF output
+ features.require("pdfcolmk");
+ } else {
+ features.require("ct-none");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Floats with 'Here definitely' as default setting.
+ if (float_placement.find('H') != string::npos)
+ features.require("float");
+
+ // AMS Style is at document level
+ if (use_amsmath == package_on
+ || getTextClass().provides("amsmath"))
+ features.require("amsmath");
+ if (use_esint == package_on)
+ features.require("esint");
+
+ // the bullet shapes are buffer level not paragraph level
+ // so they are tested here
+ for (int i = 0; i < 4; ++i) {
+ if (user_defined_bullet(i) == ITEMIZE_DEFAULTS[i])
+ continue;
+ int const font = user_defined_bullet(i).getFont();
+ if (font == 0) {
+ int const c = user_defined_bullet(i).getCharacter();
+ if (c == 16
+ || c == 17
+ || c == 25
+ || c == 26
+ || c == 31) {
+ features.require("latexsym");
+ }
+ } else if (font == 1) {
+ features.require("amssymb");
+ } else if (font >= 2 && font <= 5) {
+ features.require("pifont");
+ }
+ }
+}
+
+
bool BufferParams::writeLaTeX(odocstream & os, LaTeXFeatures & features,
TexRow & texrow) const
{
}
-std::vector<string> const & BufferParams::getModules() const {
+vector<string> const & BufferParams::getModules() const {
return layoutModules_;
}
}
-bool BufferParams::addLayoutModules(std::vector<string>modNames)
+bool BufferParams::addLayoutModules(vector<string>modNames)
{
bool retval = true;
- std::vector<string>::const_iterator it = modNames.begin();
- std::vector<string>::const_iterator end = modNames.end();
+ vector<string>::const_iterator it = modNames.begin();
+ vector<string>::const_iterator end = modNames.end();
for (; it != end; ++it)
retval &= addLayoutModule(*it, false);
makeTextClass();
// Create a list with all the input encodings used
// in the document
- std::set<string> encodings =
+ set<string> encodings =
features.getEncodingSet(doc_encoding);
// When the encodings EUC-JP-plain, JIS-plain, or SJIS-plainare used, the
if (!encodings.empty() || package == Encoding::inputenc) {
os << "\\usepackage[";
- std::set<string>::const_iterator it = encodings.begin();
- std::set<string>::const_iterator const end = encodings.end();
+ set<string>::const_iterator it = encodings.begin();
+ set<string>::const_iterator const end = encodings.end();
if (it != end) {
os << from_ascii(*it);
++it;