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