#include <sstream>
-namespace support = lyx::support;
-using lyx::docstring;
-using lyx::odocstream;
-using lyx::support::bformat;
-using lyx::support::rtrim;
-using lyx::support::tokenPos;
+namespace lyx {
+
+using support::bformat;
+using support::rtrim;
+using support::tokenPos;
using std::endl;
using std::string;
using std::pair;
namespace Alert = lyx::frontend::Alert;
-namespace biblio = lyx::biblio;
// Local translators
if (!getLyXTextClass().isTeXClassAvailable()) {
docstring const msg =
bformat(_("The document uses a missing "
- "TeX class \"%1$s\".\n"), lyx::from_utf8(classname));
+ "TeX class \"%1$s\".\n"), from_utf8(classname));
Alert::warning(_("Document class not available"),
msg + _("LyX will not be able to produce output."));
}
}
// custom, A3, B3 and B4 paper sizes need geometry
- bool nonstandard_papersize = (papersize == PAPER_B3) ||
- (papersize == PAPER_B4) ||
- (papersize == PAPER_A3) ||
- (papersize == PAPER_CUSTOM);
+ bool nonstandard_papersize = papersize == PAPER_B3
+ || papersize == PAPER_B4
+ || papersize == PAPER_A3
+ || papersize == PAPER_CUSTOM;
if (!use_geometry) {
switch (papersize) {
if (!strOptions.empty()) {
strOptions = rtrim(strOptions, ",");
// FIXME UNICODE
- os << '[' << lyx::from_utf8(strOptions) << ']';
+ os << '[' << from_utf8(strOptions) << ']';
}
- os << '{' << lyx::from_ascii(tclass.latexname()) << "}\n";
+ os << '{' << from_ascii(tclass.latexname()) << "}\n";
texrow.newline();
// end of \documentclass defs
fontsTypewriter, fontsSC, fontsOSF,
fontsSansScale, fontsTypewriterScale);
if (!fonts.empty()) {
- os << lyx::from_ascii(fonts);
+ os << from_ascii(fonts);
texrow.newline();
}
if (fontsDefaultFamily != "default")
os << "\\renewcommand{\\familydefault}{\\"
- << lyx::from_ascii(fontsDefaultFamily) << "}\n";
+ << from_ascii(fontsDefaultFamily) << "}\n";
// this one is not per buffer
if (lyxrc.fontenc != "default") {
- os << "\\usepackage[" << lyx::from_ascii(lyxrc.fontenc)
+ os << "\\usepackage[" << from_ascii(lyxrc.fontenc)
<< "]{fontenc}\n";
texrow.newline();
}
- // TODO: Some people want to support more encodings than UTF-8. They can have a field day around here
- if (true) {
- os << "\\usepackage[utf8]{inputenc}\n";
+ if (inputenc == "auto") {
+ string const doc_encoding =
+ language->encoding()->latexName();
+
+ // Create a list with all the input encodings used
+ // in the document
+ std::set<string> encodings =
+ features.getEncodingSet(doc_encoding);
+
+ os << "\\usepackage[";
+ std::set<string>::const_iterator it = encodings.begin();
+ std::set<string>::const_iterator const end = encodings.end();
+ for (; it != end; ++it)
+ os << from_ascii(*it) << ',';
+ os << from_ascii(doc_encoding) << "]{inputenc}\n";
+ texrow.newline();
+ } else if (inputenc != "default") {
+ os << "\\usepackage[" << from_ascii(inputenc)
+ << "]{inputenc}\n";
texrow.newline();
- } else {
- if (inputenc == "auto") {
- string const doc_encoding =
- language->encoding()->latexName();
-
- // Create a list with all the input encodings used
- // in the document
- std::set<string> encodings =
- features.getEncodingSet(doc_encoding);
-
- os << "\\usepackage[";
- std::set<string>::const_iterator it = encodings.begin();
- std::set<string>::const_iterator const end = encodings.end();
- for (; it != end; ++it)
- os << lyx::from_ascii(*it) << ',';
- os << lyx::from_ascii(doc_encoding) << "]{inputenc}\n";
- texrow.newline();
- } else if (inputenc != "default") {
- os << "\\usepackage[" << lyx::from_ascii(inputenc)
- << "]{inputenc}\n";
- texrow.newline();
- }
}
if (use_geometry || nonstandard_papersize) {
case PAPER_CUSTOM:
if (!paperwidth.empty())
os << ",paperwidth="
- << lyx::from_ascii(paperwidth);
+ << from_ascii(paperwidth);
if (!paperheight.empty())
os << ",paperheight="
- << lyx::from_ascii(paperheight);
+ << from_ascii(paperheight);
break;
case PAPER_USLETTER:
os << ",letterpaper";
}
}
if (!topmargin.empty())
- os << ",tmargin=" << lyx::from_ascii(topmargin);
+ os << ",tmargin=" << from_ascii(topmargin);
if (!bottommargin.empty())
- os << ",bmargin=" << lyx::from_ascii(bottommargin);
+ os << ",bmargin=" << from_ascii(bottommargin);
if (!leftmargin.empty())
- os << ",lmargin=" << lyx::from_ascii(leftmargin);
+ os << ",lmargin=" << from_ascii(leftmargin);
if (!rightmargin.empty())
- os << ",rmargin=" << lyx::from_ascii(rightmargin);
+ os << ",rmargin=" << from_ascii(rightmargin);
if (!headheight.empty())
- os << ",headheight=" << lyx::from_ascii(headheight);
+ os << ",headheight=" << from_ascii(headheight);
if (!headsep.empty())
- os << ",headsep=" << lyx::from_ascii(headsep);
+ os << ",headsep=" << from_ascii(headsep);
if (!footskip.empty())
- os << ",footskip=" << lyx::from_ascii(footskip);
+ os << ",footskip=" << from_ascii(footskip);
os << "}\n";
texrow.newline();
}
os << "\\usepackage{fancyhdr}\n";
texrow.newline();
}
- os << "\\pagestyle{" << lyx::from_ascii(pagestyle) << "}\n";
+ os << "\\pagestyle{" << from_ascii(pagestyle) << "}\n";
texrow.newline();
}
break;
case VSpace::LENGTH:
os << "\\setlength\\parskip{"
- << lyx::from_ascii(getDefSkip().length().asLatexString())
+ << from_utf8(getDefSkip().length().asLatexString())
<< "}\n";
break;
default: // should never happen // Then delete it.
// If we use jurabib, we have to call babel here.
if (use_babel && features.isRequired("jurabib")) {
- os << lyx::from_ascii(babelCall(language_options.str()))
+ os << from_ascii(babelCall(language_options.str()))
<< '\n'
- << lyx::from_ascii(features.getBabelOptions());
+ << from_ascii(features.getBabelOptions());
texrow.newline();
}
}
// FIXME UNICODE
- os << lyx::from_utf8(lyxpreamble);
+ os << from_utf8(lyxpreamble);
return use_babel;
}
return os.str();
}
+
+
+} // namespace lyx