}
-// 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;
// 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 */
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;
<< "\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';
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();
}
- 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")