]> git.lyx.org Git - lyx.git/blobdiff - src/tex2lyx/context.h
some tabular fixes for the problems reported by Helge
[lyx.git] / src / tex2lyx / context.h
index 1b0b72bf851cbdba7764bd7c54d8e6cc25c0bd65..29be22ffb2bdbcf91360ecfa97b389229fb49370 100644 (file)
@@ -6,7 +6,7 @@
  *
  * \author Jean-Marc Lasgouttes
  *
- * Full author contact details are available in file CREDITS
+ * Full author contact details are available in file CREDITS.
  */
 
 #ifndef CONTEXT_H
 
 #include "lyxtextclass.h"
 
+
+/*!
+ * Small helper struct that holds font properties.
+ * The names are in LyX language, not LaTeX.
+ * We don't use LyXFont, because it pulls in a lot of dependencies and has
+ * more strings than needed (e.g. font family error1 etc.).
+ * If more font related stuff is needed, it might be good to change to
+ * LyXFont.
+ */
+class Font {
+public:
+       Font()
+       {
+               init();
+       }
+       void init()
+       {
+               size = "normal";
+               family = "default";
+               series = "default";
+               shape = "default";
+       }
+       std::string size;
+       std::string family;
+       std::string series;
+       std::string shape;
+};
+
+
 // A helper struct
-struct Context {
+class Context {
+public:
        Context(bool need_layout_,
                LyXTextClass const & textclass_,
                LyXLayout_ptr layout_ = LyXLayout_ptr(),
-               LyXLayout_ptr parent_layout_= LyXLayout_ptr());
+               LyXLayout_ptr parent_layout_= LyXLayout_ptr(),
+               Font font_ = Font());
 
        // Output a \begin_layout is requested
        void check_layout(std::ostream & os);
@@ -32,11 +63,23 @@ struct Context {
 
        // Output a \end_deeper if needed
        void check_end_deeper(std::ostream & os);
-       
+
        // dump content on stream (for debugging purpose), with
        // description \c desc.
        void dump(std::ostream &, std::string const & desc = "context") const;
 
+       /// Are we just beginning a new paragraph?
+       bool atParagraphStart() const { return need_layout; }
+
+       /// Begin an item in a list environment
+       void set_item();
+
+       /// Start a new paragraph
+       void new_paragraph(std::ostream & os);
+
+       /// Add extra stuff if not already there
+       void add_extra_stuff(std::string const &);
+
        // Do we need to output some \begin_layout command before the
        // next characters?
        bool need_layout;
@@ -54,14 +97,15 @@ struct Context {
        // we are handling a standard paragraph in an itemize-like
        // environment
        bool deeper_paragraph;
-       
+
        // The textclass of the document. Could actually be a global variable
        LyXTextClass const & textclass;
        // The layout of the current paragraph
        LyXLayout_ptr layout;
        // The layout of the outer paragraph (for environment layouts)
        LyXLayout_ptr parent_layout;
+       /// font attributes of this context
+       Font font;
 };
-       
 
 #endif