]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/context.h
latest patch from Georg: support a syntax table for unsupported commands
[lyx.git] / src / tex2lyx / context.h
1 // -*- C++ -*-
2 /**
3  * \file context.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Jean-Marc Lasgouttes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef CONTEXT_H
13 #define CONTEXT_H
14
15 #include "lyxtextclass.h"
16
17 // A helper struct
18 struct Context {
19         Context(bool need_layout_,
20                 LyXTextClass const & textclass_,
21                 LyXLayout_ptr layout_ = LyXLayout_ptr(),
22                 LyXLayout_ptr parent_layout_= LyXLayout_ptr());
23
24         // Output a \begin_layout is requested
25         void check_layout(std::ostream & os);
26
27         // Output a \end_layout if needed
28         void check_end_layout(std::ostream & os);
29
30         // Output a \begin_deeper if needed
31         void check_deeper(std::ostream & os);
32
33         // Output a \end_deeper if needed
34         void check_end_deeper(std::ostream & os);
35
36         // dump content on stream (for debugging purpose), with
37         // description \c desc.
38         void dump(std::ostream &, std::string const & desc = "context") const;
39
40         /// Are we just beginning a new paragraph?
41         bool atParagraphStart() const { return need_layout; }
42
43         /// Begin an item in a list environment
44         void set_item();
45
46         /// Start a new paragraph
47         void new_paragraph(std::ostream & os);
48
49         // Do we need to output some \begin_layout command before the
50         // next characters?
51         bool need_layout;
52         // Do we need to output some \end_layout command
53         bool need_end_layout;
54         // We may need to add something after this \begin_layout command
55         std::string extra_stuff;
56         // If there has been an \begin_deeper, we'll need a matching
57         // \end_deeper
58         bool need_end_deeper;
59         // If we are in an itemize-like environment, we need an \item
60         // for each paragraph, otherwise this has to be a deeper
61         // paragraph.
62         bool has_item;
63         // we are handling a standard paragraph in an itemize-like
64         // environment
65         bool deeper_paragraph;
66
67         // The textclass of the document. Could actually be a global variable
68         LyXTextClass const & textclass;
69         // The layout of the current paragraph
70         LyXLayout_ptr layout;
71         // The layout of the outer paragraph (for environment layouts)
72         LyXLayout_ptr parent_layout;
73 };
74
75
76 #endif