]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/tex2lyx.h
The roundtrip of the math manual produces a compilable document now:
[lyx.git] / src / tex2lyx / tex2lyx.h
index a2ef8395425f2fb105b27f40b87692750eb4dc91..da3ee8015e9a5ae0f9a3e11957590090cfd0dc08 100644 (file)
@@ -4,7 +4,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author André Pönitz
+ * \author André Pönitz
  * \author Jean-Marc Lasgouttes
  *
  * Full author contact details are available in file CREDITS.
 #ifndef TEX2LYX_H
 #define TEX2LYX_H
 
-#include "texparser.h"
-#include "lyxtextclass.h"
+#include "Parser.h"
+#include "TextClass.h"
 
 #include <iosfwd>
 #include <string>
 #include <vector>
 #include <map>
 
+
+namespace lyx {
+
+namespace support { class FileName; }
+
+/// Simple support for frontend::Alert::warning().
+namespace frontend { 
+namespace Alert {
+       void warning(docstring const & title, docstring const & message,
+                                bool const &);
+}
+}
+
 class Context;
 
-/// in preamble.C
-LyXTextClass const parse_preamble(Parser & p, std::ostream & os, std::string const & forceclass);
+/// A trivial subclass, just to give us a public default constructor
+class TeX2LyXDocClass : public DocumentClass
+{};
+
+/// in preamble.cpp
+void parse_preamble(Parser & p, std::ostream & os, 
+       std::string const & forceclass, TeX2LyXDocClass & tc);
+/// Translate babel language name to LyX language name
+extern std::string babel2lyx(std::string const & language);
 
 /// used packages with options
 extern std::map<std::string, std::vector<std::string> > used_packages;
 
+/// in text.cpp
+std::string translate_len(std::string const &);
 
-/// in text.C
 void parse_text(Parser & p, std::ostream & os, unsigned flags, bool outer,
                Context & context);
 
@@ -42,19 +63,20 @@ void parse_text(Parser & p, std::ostream & os, unsigned flags, bool outer,
  * Therefore this may only be used to parse text in insets or table cells.
  */
 void parse_text_in_inset(Parser & p, std::ostream & os, unsigned flags,
-                        bool outer, Context const & context);
+                         bool outer, Context const & context,
+                         InsetLayout const * layout = 0);
 
 
-/// in math.C
+/// in math.cpp
 void parse_math(Parser & p, std::ostream & os, unsigned flags, mode_type mode);
 
 
-/// in table.C
+/// in table.cpp
 void handle_tabular(Parser & p, std::ostream & os, bool is_long_tabular,
-                    Context & context);
+                   Context & context);
 
 
-/// in tex2lyx.C
+/// in tex2lyx.cpp
 std::string const trim(std::string const & a, char const * p = " \t\n\r");
 
 void split(std::string const & s, std::vector<std::string> & result,
@@ -72,7 +94,7 @@ char const * const * is_known(std::string const &, char const * const *);
  * \param o2 wether \newcommand had a second optional parameter
  */
 void add_known_command(std::string const & command, std::string const & o1,
-                       bool o2);
+                      bool o2);
 
 // Access to environment stack
 extern std::vector<std::string> active_environments;
@@ -81,6 +103,7 @@ std::string active_environment();
 enum ArgumentType {
        required,
        verbatim,
+       item,
        optional
 };
 
@@ -92,6 +115,12 @@ extern CommandMap known_commands;
 extern CommandMap known_environments;
 /// Known TeX math environments with arguments that get parsed into LyX mathed.
 extern CommandMap known_math_environments;
+///
+extern bool noweb_mode;
+/// Did we recognize any pdflatex-only construct?
+extern bool pdflatex;
+/// LyX format that is created by tex2lyx
+int const LYX_FORMAT = 345;
 
 /// path of the master .tex file
 extern std::string getMasterFilePath();
@@ -101,12 +130,18 @@ extern std::string getParentFilePath();
 
 /*!
  *  Reads tex input from \a infilename and writes lyx output to \a outfilename.
+ *  The (latex) encoding can be provided as \a encoding.
  *  Uses some common settings for the preamble, so this should only
  *  be used more than once for included documents.
  *  Caution: Overwrites the existing preamble settings if the new document
  *  contains a preamble.
  *  \return true if the conversion was successful, else false.
  */
-bool tex2lyx(std::string const & infilename, std::string const & outfilename);
+bool tex2lyx(std::string const & infilename, 
+            support::FileName const & outfilename, 
+            std::string const & encoding);
+
+
+} // namespace lyx
 
 #endif