- lex.next();
- tmptok = lex.GetString();
- /* test the different insets */
- if (tmptok == "Quotes") {
- inset = new InsetQuotes;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "\\i") {
- inset = new InsetLatexAccent;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "FormulaMacro") {
- inset = new InsetFormulaMacro;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "Formula") {
- inset = new InsetFormula;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "Figure") {
- inset = new InsetFig(100, 100, this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "Info") {
- inset = new InsetInfo;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "Include") {
- inset = new InsetInclude(string(), this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "ERT") {
- inset = new InsetERT(this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "Text") {
- inset = new InsetText(this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
-#if 0
- } else if (tmptok == "Number") {
- inset = new InsetNumber(this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
-#endif
- } else if (tmptok == "Foot") {
- inset = new InsetFoot(this);
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (tmptok == "GRAPHICS") {
- inset = new InsetGraphics;
- //inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- } else if (tmptok == "LatexCommand") {
- InsetCommand inscmd;
- inscmd.Read(lex);
- if (inscmd.getCmdName() == "cite") {
- inset = new InsetCitation(inscmd.getContents(), inscmd.getOptions());
- } else if (inscmd.getCmdName() == "bibitem") {
- lex.printError("Wrong place for bibitem");
- inset = inscmd.Clone();
- } else if (inscmd.getCmdName() == "BibTeX") {
- inset = new InsetBibtex(inscmd.getContents(), inscmd.getOptions(), this);
- } else if (inscmd.getCmdName() == "index") {
- inset = new InsetIndex(inscmd.getContents());
- } else if (inscmd.getCmdName() == "include") {
- inset = new InsetInclude(inscmd.getContents(), this);
- } else if (inscmd.getCmdName() == "label") {
- inset = new InsetLabel(inscmd.getCommand());
- } else if (inscmd.getCmdName() == "url"
- || inscmd.getCmdName() == "htmlurl") {
- inset = new InsetUrl(inscmd.getCommand());
- } else if (inscmd.getCmdName() == "ref"
- || inscmd.getCmdName() == "pageref") {
- if (!inscmd.getOptions().empty() || !inscmd.getContents().empty()) {
- inset = new InsetRef(inscmd, this);
- }
-#warning Check if this else clause is still needed. (Lgb)
-#if 0
- // This condition comes from a
- // temporary solution to the latexdel
- // ref inset that was transformed to
- // an empty ref inset plus the body
- // surronded by latexdel insets
- else {
- string cont, opt, tmptmptok, cmdname;
- lex.next();
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
- lex.next();
- while(lex.IsOK()) {
- tmptmptok = lex.GetString();
- if(tmptmptok[0] == '\\') {
- if( tmptmptok == "\\backslash")
- opt += '\\';
- else
- break;
- }
- else
- opt += tmptmptok;
- opt += ' ';
- lex.next();
- }
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
- lex.next();
- while(lex.IsOK()) {
- tmptmptok = lex.GetString();
- if(tmptmptok[0] == '\\') {
- if( tmptmptok == "\\backslash")
- cont += '\\';
- else
- break;
- }
- else
- cont += tmptmptok;
- cont += ' ';
- lex.next();
- }
- while(lex.IsOK() && lex.GetString() != "\\end_inset" ) {
- lex.next();
- }
-
- cont = strip(cont);
- opt = strip(opt);
- cmdname = "\\" + inscmd.getCmdName();
- cmdname += "[" + cont + "]";
- cmdname += "{" + opt + "}";
- inset = new InsetRef(cmdname, this);
- }
-#endif
- } else if (inscmd.getCmdName() == "tableofcontents") {
- inset = new InsetTOC(this);
- } else if (inscmd.getCmdName() == "listoffigures") {
- inset = new InsetLOF(this);
- } else if (inscmd.getCmdName() == "listofalgorithms") {
- inset = new InsetLOA(this);
- } else if (inscmd.getCmdName() == "listoftables") {
- inset = new InsetLOT(this);
- } else if (inscmd.getCmdName() == "printindex") {
- inset = new InsetPrintIndex(this);
- } else if (inscmd.getCmdName() == "lyxparent") {
- inset = new InsetParent(inscmd.getContents(), this);
- }
-
- if (inset) {
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- }
- }
- } else if (token == "\\InsetQuotes") {
- inset = new InsetQuotes;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;
- } else if (token == "\\InsetFormula") {
- inset = new InsetFormula;
- inset->Read(lex);
- par->InsertChar(pos, LyXParagraph::META_INSET);
- par->InsertInset(pos, inset);
- par->SetFont(pos, font);
- ++pos;