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"
21 * Small helper struct that holds font properties.
22 * The names are in LyX language, not LaTeX.
23 * We don't use LyXFont, because it pulls in a lot of dependencies and has
24 * more strings than needed (e.g. font family error1 etc.).
25 * If more font related stuff is needed, it might be good to change to
48 /// Output changed font parameters if \p oldfont and \p newfont differ
49 void output_font_change(std::ostream & os, Font const & oldfont,
50 Font const & newfont);
56 Context(bool need_layout_,
57 LyXTextClass const & textclass_,
58 LyXLayout_ptr layout_ = LyXLayout_ptr(),
59 LyXLayout_ptr parent_layout_= LyXLayout_ptr(),
62 /// Output a \\begin_layout if requested
63 void check_layout(std::ostream & os);
65 /// Output a \\end_layout if needed
66 void check_end_layout(std::ostream & os);
68 /// Output a \\begin_deeper if needed
69 void check_deeper(std::ostream & os);
71 /// Output a \\end_deeper if needed
72 void check_end_deeper(std::ostream & os);
74 /// dump content on stream (for debugging purpose), with
75 /// description \c desc.
76 void dump(std::ostream &, std::string const & desc = "context") const;
78 /// Are we just beginning a new paragraph?
79 bool atParagraphStart() const { return need_layout; }
81 /// Begin an item in a list environment
84 /// Start a new paragraph
85 void new_paragraph(std::ostream & os);
87 /// Add extra stuff if not already there
88 void add_extra_stuff(std::string const &);
90 /// Do we need to output some \\begin_layout command before the
93 /// Do we need to output some \\end_layout command
95 /// We may need to add something after this \\begin_layout command
96 std::string extra_stuff;
97 /// If there has been an \\begin_deeper, we'll need a matching
100 /// If we are in an itemize-like environment, we need an \\item
101 /// for each paragraph, otherwise this has to be a deeper
104 /// we are handling a standard paragraph in an itemize-like
106 bool deeper_paragraph;
108 /// The textclass of the document. Could actually be a global variable
109 LyXTextClass const & textclass;
110 /// The layout of the current paragraph
111 LyXLayout_ptr layout;
112 /// The layout of the outer paragraph (for environment layouts)
113 LyXLayout_ptr parent_layout;
114 /// font attributes of this context
116 /// font attributes of normal text
117 static Font normalfont;