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