3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
9 * Full author contact details are available in file CREDITS.
14 #ifndef LYX_PREAMBLE_H
15 #define LYX_PREAMBLE_H
30 class TeX2LyXDocClass;
38 std::string inputencoding() const { return h_inputencoding; }
40 std::string notefontcolor() const { return h_notefontcolor; }
41 /// The document language
42 std::string docLanguage() const { return h_language; }
43 /// The language of text which is not explicitly marked
44 std::string defaultLanguage() const { return default_language; }
46 std::string use_indices() const { return h_use_indices; }
48 std::string polyglossia2lyx(std::string const & language);
50 bool indentParagraphs() const;
52 bool isPackageUsed(std::string const & package) const;
54 std::vector<std::string>
55 getPackageOptions(std::string const & package) const;
56 /// Tell that \p package will be loaded automatically by LyX.
57 /// This has only an effect if \p package is prepared for
58 /// autoloading in parse().
59 void registerAutomaticallyLoadedPackage(std::string const & package);
61 void addModule(std::string const & module);
63 void suppressDate(bool suppress);
65 std::string citeEngine() const { return h_cite_engine; }
67 void citeEngine(std::string const & e) { h_cite_engine = e; }
69 bool titleLayoutFound() const { return title_layout_found; }
71 void titleLayoutFound(bool found) { title_layout_found = found; }
72 /// Register an author named \p name in the author list
73 void registerAuthor(std::string const & name);
74 /// Get author named \p name (must be registered first)
75 Author const & getAuthor(std::string const & name) const;
77 /// Parses the LaTeX preamble into internal data
78 void parse(Parser & p, std::string const & forceclass,
79 TeX2LyXDocClass & tc);
80 /// Writes the LyX file header from internal data
81 bool writeLyXHeader(std::ostream & os, bool subdoc);
83 /// known polyglossia language names (including variants)
84 static const char * const polyglossia_languages[];
85 /// the same as polyglossia_languages with .lyx names
86 static const char * const coded_polyglossia_languages[];
90 std::map<std::string, std::vector<std::string> > used_packages;
91 /// Packages that will be loaded automatically by LyX
92 std::set<std::string> auto_packages;
94 std::vector<std::string> used_modules;
96 /// needed to handle encodings with babel
98 /// the main non-CJK language
99 std::string default_language;
101 /// was at least one title layout found?
102 bool title_layout_found;
104 std::ostringstream h_preamble;
105 std::string h_backgroundcolor;
106 std::string h_biblio_style;
107 std::string h_bibtex_command;
108 std::string h_boxbgcolor;
109 std::string h_cite_engine;
110 std::string h_cite_engine_type;
112 std::string h_defskip;
113 std::string h_float_placement;
114 std::string h_fontcolor;
115 std::string h_fontencoding;
116 std::string h_font_math;
117 std::string h_font_roman;
118 std::string h_font_sans;
119 std::string h_font_typewriter;
120 std::string h_font_default_family;
121 std::string h_use_non_tex_fonts;
122 std::string h_font_sc;
123 std::string h_font_osf;
124 std::string h_font_sf_scale;
125 std::string h_font_tt_scale;
126 std::string h_graphics;
127 std::string h_default_output_format;
128 std::string h_html_be_strict;
129 std::string h_html_css_as_file;
130 std::string h_html_math_output;
132 std::string h_index_command;
133 std::string h_inputencoding;
134 std::string h_justification;
135 std::string h_language;
136 std::string h_language_package;
137 std::string h_listings_params;
138 std::string h_maintain_unincluded_children;
139 std::string h_margins;
140 std::string h_notefontcolor;
141 std::string h_options;
142 std::string h_output_changes;
143 std::string h_output_sync;
144 std::string h_output_sync_macro;
145 std::string h_papercolumns;
146 std::string h_paperfontsize;
147 std::string h_paperorientation;
148 std::string h_paperpagestyle;
149 std::string h_papersides;
150 std::string h_papersize;
151 std::string h_paragraph_indentation;
152 /// necessary to set the separation when \setlength is parsed
153 std::string h_paragraph_separation;
154 std::string h_pdf_title;
155 std::string h_pdf_author;
156 std::string h_pdf_subject;
157 std::string h_pdf_keywords;
158 std::string h_pdf_bookmarks;
159 std::string h_pdf_bookmarksnumbered;
160 std::string h_pdf_bookmarksopen;
161 std::string h_pdf_bookmarksopenlevel;
162 std::string h_pdf_breaklinks;
163 std::string h_pdf_pdfborder;
164 std::string h_pdf_colorlinks;
165 std::string h_pdf_backref;
166 std::string h_pdf_pdfusetitle;
167 std::string h_pdf_pagemode;
168 std::string h_pdf_quoted_options;
169 std::string h_quotes_language;
170 std::string h_secnumdepth;
171 std::string h_shortcut;
172 std::string h_spacing;
173 std::string h_suppress_date;
174 std::string h_textclass;
175 std::string h_tocdepth;
176 std::string h_tracking_changes;
177 std::string h_use_bibtopic;
178 std::string h_use_indices;
179 std::string h_use_geometry;
180 std::map<std::string, std::string> h_use_packages;
181 std::string h_use_default_options;
182 std::string h_use_hyperref;
183 std::string h_use_refstyle;
186 * Add package \p name with options \p options to used_packages.
187 * Remove options from \p options that we don't want to output.
189 void add_package(std::string const & name,
190 std::vector<std::string> & options);
192 void handle_hyperref(std::vector<std::string> & options);
194 void handle_geometry(std::vector<std::string> & options);
196 void handle_package(Parser &p, std::string const & name,
197 std::string const & opts, bool in_lyx_preamble);
199 void handle_if(Parser & p, bool in_lyx_preamble);
205 extern Preamble preamble;