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