]> git.lyx.org Git - lyx.git/blob - src/tex2lyx/context.h
make nesting work in tex2lyx
[lyx.git] / src / tex2lyx / context.h
1 // -*- C++ -*-
2 #ifndef CONTEXT_H
3 #define CONTEXT_H
4
5 #include "lyxtextclass.h"
6
7 // A helper struct
8 struct Context {
9         Context(bool need_layout_,
10                 LyXTextClass const & textclass_,
11                 LyXLayout_ptr layout_ = LyXLayout_ptr(),
12                 LyXLayout_ptr parent_layout_= LyXLayout_ptr());
13
14         // Output a \begin_layout is requested
15         void check_layout(std::ostream & os);
16
17         // Output a \end_layout if needed
18         void check_end_layout(std::ostream & os);
19
20         // Output a \begin_deeper if needed
21         void check_deeper(ostream & os);
22
23         // Output a \end_deeper if needed
24         void check_end_deeper(ostream & os);
25         
26         // dump content on stream (for debugging purpose), with
27         // description \c desc.
28         void dump(std::ostream &, std::string const & desc = "context") const;
29
30         // Do we need to output some \begin_layout command before the
31         // next characters?
32         bool need_layout;
33         // Do we need to output some \end_layout command
34         bool need_end_layout;
35         // We may need to add something after this \begin_layout command
36         std::string extra_stuff;
37         // If there has been an \begin_deeper, we'll need a matching
38         // \end_deeper
39         bool need_end_deeper;
40
41         // The textclass of the document. Could actually be a global variable
42         LyXTextClass const & textclass;
43         // The layout of the current paragraph
44         LyXLayout_ptr layout;
45         // The layout of the outer paragraph (for environment layouts)
46         LyXLayout_ptr parent_layout;
47 };
48         
49
50 #endif