}
-// Quote times
-typedef Translator<int, InsetQuotes::quote_times> QuotesTimesTranslator;
-
-
-QuotesTimesTranslator const init_quotestimestranslator()
-{
- QuotesTimesTranslator translator(1, InsetQuotes::SingleQ);
- translator.addPair(2, InsetQuotes::DoubleQ);
- return translator;
-}
-
-
-QuotesTimesTranslator const & quotestimestranslator()
-{
- static QuotesTimesTranslator translator = init_quotestimestranslator();
- return translator;
-}
-
-
// Paper size
typedef Translator<std::string, PAPER_SIZE> PaperSizeTranslator;
}
-// Paper packages
-typedef Translator<string, PAPER_PACKAGES> PaperPackagesTranslator;
-
-
-PaperPackagesTranslator const init_paperpackagestranslator()
-{
- PaperPackagesTranslator translator(string_paperpackages[0], PACKAGE_NONE);
- translator.addPair(string_paperpackages[1], PACKAGE_A4);
- translator.addPair(string_paperpackages[2], PACKAGE_A4WIDE);
- translator.addPair(string_paperpackages[3], PACKAGE_WIDEMARGINSA4);
- return translator;
-}
-
-
-PaperPackagesTranslator const & paperpackagestranslator()
-{
- static PaperPackagesTranslator translator = init_paperpackagestranslator();
- return translator;
-}
-
-
// Paper orientation
typedef Translator<string, PAPER_ORIENTATION> PaperOrientationTranslator;
// true in the returned pair, then `second' is the textclass
// number; if it is false, second is 0. In both cases, second
// is what we want.
- textclass(textclasslist.NumberOfClass("article").second),
+ textclass(textclasslist.numberOfClass("article").second),
pimpl_(new Impl)
{
paragraph_separation = PARSEP_INDENT;
quotes_language = InsetQuotes::EnglishQ;
- quotes_times = InsetQuotes::DoubleQ;
fontsize = "default";
/* PaperLayout */
papersize = PAPER_DEFAULT;
- paperpackage = PACKAGE_NONE;
orientation = ORIENTATION_PORTRAIT;
use_geometry = false;
use_amsmath = AMS_AUTO;
lex.next();
string const classname = lex.getString();
pair<bool, lyx::textclass_type> pp =
- textclasslist.NumberOfClass(classname);
+ textclasslist.numberOfClass(classname);
if (pp.first) {
textclass = pp.second;
} else {
- textclass = 0;
- return classname;
+ // if text class does not exist, try to load it from filepath
+ pp = textclasslist.addTextClass(classname, filepath);
+ if (pp.first) {
+ textclass = pp.second;
+ } else {
+ textclass = 0;
+ return classname;
+ }
}
+ // FIXME: isTeXClassAvailable will try to load the layout file, but will
+ // fail because of the lack of path info. Warnings will be given although
+ // the layout file will be correctly loaded later.
if (!getLyXTextClass().isTeXClassAvailable()) {
string const msg =
bformat(_("The document uses a missing "
"TeX class \"%1$s\".\n"), classname);
Alert::warning(_("Document class not available"),
- msg + _("LyX will not be able to produce output."));
+ msg + _("LyX will not be able to produce output."));
}
} else if (token == "\\begin_preamble") {
readPreamble(lex);
string quotes_lang;
lex >> quotes_lang;
quotes_language = quoteslangtranslator().find(quotes_lang);
- } else if (token == "\\quotes_times") {
- int qtimes;
- lex >> qtimes;
- quotes_times = quotestimestranslator().find(qtimes);
} else if (token == "\\papersize") {
string ppsize;
lex >> ppsize;
papersize = papersizetranslator().find(ppsize);
- } else if (token == "\\paperpackage") {
- string ppackage;
- lex >> ppackage;
- paperpackage = paperpackagestranslator().find(ppackage);
} else if (token == "\\use_geometry") {
lex >> use_geometry;
} else if (token == "\\use_amsmath") {
spacing().writeFile(os);
os << "\\papersize " << string_papersize[papersize]
- << "\n\\paperpackage " << string_paperpackages[paperpackage]
<< "\n\\use_geometry " << convert<string>(use_geometry)
<< "\n\\use_amsmath " << use_amsmath
<< "\n\\cite_engine " << citeenginetranslator().find(cite_engine)
<< "\n\\paperorientation " << string_orientation[orientation]
<< '\n';
- std::list<Branch>::const_iterator it = branchlist().begin();
- std::list<Branch>::const_iterator end = branchlist().end();
+ BranchList::const_iterator it = branchlist().begin();
+ BranchList::const_iterator end = branchlist().end();
for (; it != end; ++it) {
os << "\\branch " << it->getBranch()
<< "\n\\selected " << it->getSelected()
- << "\n\\color " << it->getColor()
+ << "\n\\color " << lyx::X11hexname(it->getColor())
<< "\n\\end_branch"
<< "\n";
}
<< string_paragraph_separation[paragraph_separation]
<< "\n\\defskip " << getDefSkip().asLyXCommand()
<< "\n\\quotes_language "
- << string_quotes_language[quotes_language] << '\n'
- << "\\quotes_times "
- << quotestimestranslator().find(quotes_times)
+ << string_quotes_language[quotes_language]
<< "\n\\papercolumns " << columns
<< "\n\\papersides " << sides
<< "\n\\paperpagestyle " << pagestyle << '\n';
(papersize == PAPER_A3) ||
(papersize == PAPER_CUSTOM);
- if (!use_geometry && (paperpackage == PACKAGE_NONE)) {
+ if (!use_geometry) {
switch (papersize) {
case PAPER_A4:
clsoptions << "a4paper,";
if (inputenc == "auto") {
string const doc_encoding =
- language->encoding()->LatexName();
+ language->encoding()->latexName();
// Create a list with all the input encodings used
// in the document
texrow.newline();
}
- // At the very beginning the text parameters.
- if (paperpackage != PACKAGE_NONE) {
- switch (paperpackage) {
- case PACKAGE_NONE:
- break;
- case PACKAGE_A4:
- os << "\\usepackage{a4}\n";
- texrow.newline();
- break;
- case PACKAGE_A4WIDE:
- os << "\\usepackage{a4wide}\n";
- texrow.newline();
- break;
- case PACKAGE_WIDEMARGINSA4:
- os << "\\usepackage[widemargins]{a4}\n";
- texrow.newline();
- break;
- }
- }
-
if (use_geometry || nonstandard_papersize) {
os << "\\usepackage{geometry}\n";
texrow.newline();
texrow.newline();
}
- if (secnumdepth != tclass.secnumdepth()) {
- os << "\\setcounter{secnumdepth}{"
- << secnumdepth
- << "}\n";
- texrow.newline();
- }
- if (tocdepth != tclass.tocdepth()) {
- os << "\\setcounter{tocdepth}{"
- << tocdepth
- << "}\n";
- texrow.newline();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ if (secnumdepth != tclass.secnumdepth()) {
+ os << "\\setcounter{secnumdepth}{"
+ << secnumdepth
+ << "}\n";
+ texrow.newline();
+ }
+ if (tocdepth != tclass.tocdepth()) {
+ os << "\\setcounter{tocdepth}{"
+ << tocdepth
+ << "}\n";
+ texrow.newline();
+ }
}
if (paragraph_separation) {
if (user_defined_bullet(i) != ITEMIZE_DEFAULTS[i]) {
if (bullets_def.empty())
bullets_def="\\AtBeginDocument{\n";
- bullets_def += " \\renewcommand{\\labelitemi";
+ bullets_def += " \\def\\labelitemi";
switch (i) {
// `i' is one less than the item to modify
case 0:
bullets_def += 'v';
break;
}
- bullets_def += "}{" +
+ bullets_def += '{' +
user_defined_bullet(i).getText()
+ "}\n";
}
columns = tclass.columns();
pagestyle = tclass.pagestyle();
options = tclass.options();
- secnumdepth = tclass.secnumdepth();
- tocdepth = tclass.tocdepth();
+ // Only if class has a ToC hierarchy
+ if (tclass.hasTocLevels()) {
+ secnumdepth = tclass.secnumdepth();
+ tocdepth = tclass.tocdepth();
+ }
}
}
+LyXFont const BufferParams::getFont() const
+{
+ LyXFont f = getLyXTextClass().defaultfont();
+ f.setLanguage(language);
+ return f;
+}
+
+
void BufferParams::readPreamble(LyXLex & lex)
{
if (lex.getString() != "\\begin_preamble")