]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/text.C
Add a Buffer::fully_loaded member function, returning true only when
[lyx.git] / src / tex2lyx / text.C
index 657bd243d8070b67f9d0103b0b7522b7c0383ce7..b716a5f93b2f0cf8fdc1772934fadc8c7e9d2f55 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file text.C
+ * \file tex2lyx/text.C
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
@@ -26,6 +26,7 @@
 
 using std::cerr;
 using std::endl;
+
 using std::map;
 using std::ostream;
 using std::ostringstream;
@@ -135,7 +136,7 @@ string translate_len(string const & len)
                return len;
 }
 
-               
+
 void begin_inset(ostream & os, string const & name)
 {
        os << "\n\\begin_inset " << name;
@@ -189,7 +190,7 @@ private:
 
 
 LyXLayout_ptr findLayout(LyXTextClass const & textclass,
-                        string const & name) 
+                        string const & name)
 {
        LyXTextClass::const_iterator it  = textclass.begin();
        LyXTextClass::const_iterator end = textclass.end();
@@ -208,7 +209,7 @@ void output_command_layout(ostream & os, Parser & p, bool outer,
        context.check_deeper(os);
        context.check_layout(os);
        if (context.layout->optionalargs > 0) {
-               string s; 
+               string s;
                if (p.next_token().character() == '[') {
                        p.get_token(); // eat '['
                        begin_inset(os, "OptArg\n");
@@ -277,7 +278,7 @@ void parse_environment(Parser & p, ostream & os, bool outer,
                        }
                        if (p.next_token().asInput() == "[") {
                                height = translate_len(p.getArg('[', ']'));
-                       
+
                                if (p.next_token().asInput() == "[") {
                                        switch(p.getArg('[', ']')[0]) {
                                        case 't': inner_pos = "0"; break;
@@ -369,7 +370,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        flags |= FLAG_LEAVE;
                }
 
-               if (t.character() == ']' && (flags & FLAG_BRACK_LAST)) 
+               if (t.character() == ']' && (flags & FLAG_BRACK_LAST))
                        return;
 
                //
@@ -403,7 +404,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                // extended to other quotes, but is not so easy (a
                // left english quote is the same as a right german
                // quote...)
-               else if (t.asInput() == "`" 
+               else if (t.asInput() == "`"
                         && p.next_token().asInput() == "`") {
                        context.check_layout(os);
                        begin_inset(os, "Quotes ");
@@ -411,8 +412,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        end_inset(os);
                        p.get_token();
                        skip_braces(p);
-               }       
-               else if (t.asInput() == "'" 
+               }
+               else if (t.asInput() == "'"
                         && p.next_token().asInput() == "'") {
                        context.check_layout(os);
                        begin_inset(os, "Quotes ");
@@ -420,7 +421,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        end_inset(os);
                        p.get_token();
                        skip_braces(p);
-               }       
+               }
 
 
                else if (t.cat() == catLetter ||
@@ -449,14 +450,14 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        if (t.character() == '~') {
                                if (context.layout->free_spacing)
                                        os << ' ';
-                               else 
+                               else
                                        os << "\\InsetSpace ~\n";
                        } else
                                os << t.character();
                }
 
                else if (t.cat() == catBegin) {
-// FIXME??? 
+// FIXME???
                        // special handling of size changes
                        context.check_layout(os);
                        bool const is_size = is_known(p.next_token().cs(), known_sizes);
@@ -528,7 +529,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                else if (t.cs() == "item") {
                        // should be done automatically by Parser::tokenize
                        //p.skip_spaces();
-                       string s; 
+                       string s;
                        if (p.next_token().character() == '[') {
                                p.get_token(); // eat '['
                                Context newcontext(false, context.textclass);
@@ -582,7 +583,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                else if (t.cs() == "includegraphics") {
                        map<string, string> opts = split_map(p.getArg('[', ']'));
                        string name = p.verbatim_item();
-                       
+
                        context.check_layout(os);
                        begin_inset(os, "Graphics ");
                        os << "\n\tfilename " << name << '\n';
@@ -594,7 +595,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                   << translate_len(opts["height"]) << '\n';
                        end_inset(os);
                }
-               
+
                else if (t.cs() == "footnote") {
                        context.check_layout(os);
                        begin_inset(os, "Foot\n");
@@ -660,7 +661,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                os << name << "\n";
                                end_inset(os);
                                p.get_token(); // swallow second arg
-                       } else 
+                       } else
                                handle_ert(os, "\\listof{" + name + "}", context);
                }
 
@@ -744,7 +745,7 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        os << "\n\\size " << known_coded_sizes[where - known_sizes] << "\n";
                }
 
-               else if (t.cs() == "LyX" || t.cs() == "TeX" 
+               else if (t.cs() == "LyX" || t.cs() == "TeX"
                         || t.cs() == "LaTeX") {
                        context.check_layout(os);
                        os << t.cs();
@@ -810,8 +811,8 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                        skip_braces(p);
                }
 
-               else if (t.cs() == "_" || t.cs() == "&" || t.cs() == "#" 
-                           || t.cs() == "$" || t.cs() == "{" || t.cs() == "}" 
+               else if (t.cs() == "_" || t.cs() == "&" || t.cs() == "#"
+                           || t.cs() == "$" || t.cs() == "{" || t.cs() == "}"
                            || t.cs() == "%") {
                        context.check_layout(os);
                        os << t.cs();
@@ -876,12 +877,12 @@ void parse_text(Parser & p, ostream & os, unsigned flags, bool outer,
                                os << "\n\\newline \n";
                        }
                }
-       
+
                else if (t.cs() == "input" || t.cs() == "include"
                         || t.cs() == "verbatiminput") {
                        string name = '\\' + t.cs();
                        if (t.cs() == "verbatiminput"
-                           && p.next_token().asInput() == "*") 
+                           && p.next_token().asInput() == "*")
                                name += p.get_token().asInput();
                        context.check_layout(os);
                        begin_inset(os, "Include ");