+BufferParams::~BufferParams()
+{}
+
+
+AuthorList & BufferParams::authors()
+{
+ return pimpl_->authorlist;
+}
+
+
+AuthorList const & BufferParams::authors() const
+{
+ return pimpl_->authorlist;
+}
+
+
+BranchList & BufferParams::branchlist()
+{
+ return pimpl_->branchlist;
+}
+
+
+BranchList const & BufferParams::branchlist() const
+{
+ return pimpl_->branchlist;
+}
+
+
+Bullet & BufferParams::temp_bullet(lyx::size_type const index)
+{
+ BOOST_ASSERT(index < 4);
+ return pimpl_->temp_bullets[index];
+}
+
+
+Bullet const & BufferParams::temp_bullet(lyx::size_type const index) const
+{
+ BOOST_ASSERT(index < 4);
+ return pimpl_->temp_bullets[index];
+}
+
+
+Bullet & BufferParams::user_defined_bullet(lyx::size_type const index)
+{
+ BOOST_ASSERT(index < 4);
+ return pimpl_->user_defined_bullets[index];
+}
+
+
+Bullet const & BufferParams::user_defined_bullet(lyx::size_type const index) const
+{
+ BOOST_ASSERT(index < 4);
+ return pimpl_->user_defined_bullets[index];
+}
+
+
+Spacing & BufferParams::spacing()
+{
+ return pimpl_->spacing;
+}
+
+
+Spacing const & BufferParams::spacing() const
+{
+ return pimpl_->spacing;
+}
+
+
+VSpace const & BufferParams::getDefSkip() const
+{
+ return pimpl_->defskip;
+}
+
+
+void BufferParams::setDefSkip(VSpace const & vs)
+{
+ pimpl_->defskip = vs;
+}
+
+
+string const BufferParams::readToken(LyXLex & lex, string const & token)
+{
+ if (token == "\\textclass") {
+ lex.next();
+ string const classname = lex.getString();
+ pair<bool, lyx::textclass_type> pp =
+ textclasslist.numberOfClass(classname);
+ if (pp.first) {
+ textclass = pp.second;
+ } else {
+ // 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()) {
+ docstring const msg =
+ bformat(_("The document uses a missing "
+ "TeX class \"%1$s\".\n"), from_utf8(classname));
+ Alert::warning(_("Document class not available"),
+ msg + _("LyX will not be able to produce output."));
+ }
+ } else if (token == "\\begin_preamble") {
+ readPreamble(lex);
+ } else if (token == "\\options") {
+ lex.eatLine();
+ options = lex.getString();
+ } else if (token == "\\language") {
+ readLanguage(lex);
+ } else if (token == "\\inputencoding") {
+ lex >> inputenc;
+ } else if (token == "\\graphics") {
+ readGraphicsDriver(lex);
+ } else if (token == "\\font_roman") {
+ lex >> fontsRoman;
+ } else if (token == "\\font_sans") {
+ lex >> fontsSans;
+ } else if (token == "\\font_typewriter") {
+ lex >> fontsTypewriter;
+ } else if (token == "\\font_default_family") {
+ lex >> fontsDefaultFamily;
+ } else if (token == "\\font_sc") {
+ lex >> fontsSC;
+ } else if (token == "\\font_osf") {
+ lex >> fontsOSF;
+ } else if (token == "\\font_sf_scale") {
+ lex >> fontsSansScale;
+ } else if (token == "\\font_tt_scale") {
+ lex >> fontsTypewriterScale;
+ } else if (token == "\\paragraph_separation") {
+ string parsep;
+ lex >> parsep;
+ paragraph_separation = parseptranslator().find(parsep);
+ } else if (token == "\\defskip") {
+ lex.next();
+ pimpl_->defskip = VSpace(lex.getString());
+ } else if (token == "\\quotes_language") {
+ string quotes_lang;
+ lex >> quotes_lang;
+ quotes_language = quoteslangtranslator().find(quotes_lang);
+ } else if (token == "\\papersize") {
+ string ppsize;
+ lex >> ppsize;
+ papersize = papersizetranslator().find(ppsize);
+ } else if (token == "\\use_geometry") {
+ lex >> use_geometry;
+ } else if (token == "\\use_amsmath") {
+ int use_ams;
+ lex >> use_ams;
+ use_amsmath = packagetranslator().find(use_ams);
+ } else if (token == "\\use_esint") {
+ int useesint;
+ lex >> useesint;
+ use_esint = packagetranslator().find(useesint);
+ } else if (token == "\\cite_engine") {
+ string engine;
+ lex >> engine;
+ cite_engine = citeenginetranslator().find(engine);
+ } else if (token == "\\use_bibtopic") {
+ lex >> use_bibtopic;
+ } else if (token == "\\tracking_changes") {
+ lex >> trackChanges;
+ } else if (token == "\\output_changes") {
+ lex >> outputChanges;
+ } else if (token == "\\branch") {
+ lex.next();
+ docstring branch = lex.getDocString();
+ branchlist().add(branch);
+ while (true) {
+ lex.next();
+ string const tok = lex.getString();
+ if (tok == "\\end_branch")
+ break;
+ Branch * branch_ptr = branchlist().find(branch);
+ if (tok == "\\selected") {
+ lex.next();
+ if (branch_ptr)
+ branch_ptr->setSelected(lex.getInteger());
+ }
+ // not yet operational
+ if (tok == "\\color") {
+ lex.eatLine();
+ string color = lex.getString();
+ if (branch_ptr)
+ branch_ptr->setColor(color);
+ // Update also the LColor table:
+ if (color == "none")
+ color = lcolor.getX11Name(LColor::background);
+ // FIXME UNICODE
+ lcolor.setColor(to_utf8(branch), color);
+
+ }
+ }
+ } else if (token == "\\author") {
+ lex.eatLine();
+ istringstream ss(lex.getString());
+ Author a;
+ ss >> a;
+ author_map.push_back(pimpl_->authorlist.record(a));
+ } else if (token == "\\paperorientation") {
+ string orient;
+ lex >> orient;
+ orientation = paperorientationtranslator().find(orient);
+ } else if (token == "\\paperwidth") {
+ lex >> paperwidth;
+ } else if (token == "\\paperheight") {
+ lex >> paperheight;
+ } else if (token == "\\leftmargin") {
+ lex >> leftmargin;
+ } else if (token == "\\topmargin") {
+ lex >> topmargin;
+ } else if (token == "\\rightmargin") {
+ lex >> rightmargin;
+ } else if (token == "\\bottommargin") {
+ lex >> bottommargin;
+ } else if (token == "\\headheight") {
+ lex >> headheight;
+ } else if (token == "\\headsep") {
+ lex >> headsep;
+ } else if (token == "\\footskip") {
+ lex >> footskip;
+ } else if (token == "\\paperfontsize") {
+ lex >> fontsize;
+ } else if (token == "\\papercolumns") {
+ lex >> columns;
+ } else if (token == "\\papersides") {
+ int psides;
+ lex >> psides;
+ sides = sidestranslator().find(psides);
+ } else if (token == "\\paperpagestyle") {
+ lex >> pagestyle;
+ } else if (token == "\\bullet") {
+ readBullets(lex);
+ } else if (token == "\\bulletLaTeX") {
+ readBulletsLaTeX(lex);
+ } else if (token == "\\secnumdepth") {
+ lex >> secnumdepth;
+ } else if (token == "\\tocdepth") {
+ lex >> tocdepth;
+ } else if (token == "\\spacing") {
+ string nspacing;
+ lex >> nspacing;
+ string tmp_val;
+ if (nspacing == "other") {
+ lex >> tmp_val;
+ }
+ spacing().set(spacetranslator().find(nspacing), tmp_val);
+ } else if (token == "\\float_placement") {
+ lex >> float_placement;
+ } else {
+ return token;
+ }
+
+ return string();
+}
+
+