4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Jean-Marc Lasgouttes
9 * Full author contact details are available in file CREDITS.
15 #include "lyxtextclass.h"
19 * Small helper struct that holds font properties.
20 * The names are in LyX language, not LaTeX.
21 * We don't use LyXFont, because it pulls in a lot of dependencies and has
22 * more strings than needed (e.g. font family error1 etc.).
23 * If more font related stuff is needed, it might be good to change to
47 Context(bool need_layout_,
48 LyXTextClass const & textclass_,
49 LyXLayout_ptr layout_ = LyXLayout_ptr(),
50 LyXLayout_ptr parent_layout_= LyXLayout_ptr(),
53 // Output a \begin_layout is requested
54 void check_layout(std::ostream & os);
56 // Output a \end_layout if needed
57 void check_end_layout(std::ostream & os);
59 // Output a \begin_deeper if needed
60 void check_deeper(std::ostream & os);
62 // Output a \end_deeper if needed
63 void check_end_deeper(std::ostream & os);
65 // dump content on stream (for debugging purpose), with
66 // description \c desc.
67 void dump(std::ostream &, std::string const & desc = "context") const;
69 /// Are we just beginning a new paragraph?
70 bool atParagraphStart() const { return need_layout; }
72 /// Begin an item in a list environment
75 /// Start a new paragraph
76 void new_paragraph(std::ostream & os);
78 /// Add extra stuff if not already there
79 void add_extra_stuff(std::string const &);
81 // Do we need to output some \begin_layout command before the
84 // Do we need to output some \end_layout command
86 // We may need to add something after this \begin_layout command
87 std::string extra_stuff;
88 // If there has been an \begin_deeper, we'll need a matching
91 // If we are in an itemize-like environment, we need an \item
92 // for each paragraph, otherwise this has to be a deeper
95 // we are handling a standard paragraph in an itemize-like
97 bool deeper_paragraph;
99 // The textclass of the document. Could actually be a global variable
100 LyXTextClass const & textclass;
101 // The layout of the current paragraph
102 LyXLayout_ptr layout;
103 // The layout of the outer paragraph (for environment layouts)
104 LyXLayout_ptr parent_layout;
105 /// font attributes of this context