1 // -*- C++ -*- 2 /** 3 * \file OutputParams.h 4 * This file is part of LyX, the document processor. 5 * Licence details can be found in the file COPYING. 6 * 7 * \author Angus Leeming 8 * 9 * Full author contact details are available in file CREDITS. 10 */ 11 12 #ifndef OUTPUTPARAMS_H 13 #define OUTPUTPARAMS_H 14 15 16 #include "Changes.h" 17 18 #include <memory> 19 20 21 namespace lyx { 22 23 24 class Encoding; 25 class ExportData; 26 class Font; 27 class Language; 28 29 class OutputParams { 30 public: 31 enum FLAVOR { 32 DVILUATEX, 33 LATEX, 34 LUATEX, 35 PDFLATEX, 36 XETEX, 37 XML, 38 HTML, 39 TEXT, 40 LYX 41 }; 42 43 enum MathFlavor { 44 NotApplicable, 45 MathAsMathML, 46 MathAsHTML, 47 MathAsImages, 48 MathAsLaTeX 49 }; 50 51 enum TableCell { 52 NO, 53 PLAIN, 54 ALIGNED 55 }; 56 57 enum Float { 58 NONFLOAT, 59 MAINFLOAT, 60 SUBFLOAT 61 }; 62 63 OutputParams(Encoding const *); 64 ~OutputParams(); 65 66 /** The file that we export depends occasionally on what is to 67 compile the file. 68 */ 69 FLAVOR flavor; 70 /// is it some flavor of LaTeX? 71 bool isLaTeX() const; 72 /// does this flavour support full unicode? 73 bool isFullUnicode() const; 74 75 /// Same, but for math output, which only matter is XHTML output. 76 MathFlavor math_flavor; 77 78 /** Are we to write a 'nice' LaTeX file or not. 79 This esentially seems to mean whether InsetInclude, InsetGraphics 80 and InsetExternal should add the absolute path to any external 81 files or not. 82 Non-nice LaTeX also includes additional safe line breaks in order to 83 increase the precision of forward/reverse search and error reporting. 84 */ 85 bool nice; 86 87 /** Is this a real child (i.e., compiled as a child)? 88 This depends on wherefrom we export the buffer. Even children 89 that have a master can be compiled standalone. 90 */ 91 mutable bool is_child; 92 93 /** moving_arg == true means that the environment in which the inset 94 is typeset is a moving argument. The inset should take care about 95 fragile commands by preceding the latex with \\protect. 96 */ 97 bool moving_arg; 98 99 /** intitle == true means that the environment in which the 100 inset is typeset is part of a title (before a \\maketitle). 101 Footnotes in such environments have moving arguments. 102 */ 103 bool intitle; 104 105 /** inbranch == true means that the environment being typeset 106 is inside an active branch inset. 107 */ 108 bool inbranch; 109 110 /** inulemcmd > 0 means that the environment in which the 111 inset is typeset is part of a ulem command (\uline, \uuline, 112 \uwave, \sout or \xout). Insets that output latex commands relying 113 on local assignments (such as \cite) should enclose such 114 commands in \mbox{} in order to avoid breakage. 115 */ 116 mutable int inulemcmd; 117 118 /** the font at the point where the inset is 119 */ 120 Font const * local_font; 121 122 /** Document language babel name 123 */ 124 std::string document_language; 125 126 /** The master language. Non-null only for child documents. 127 Note that this is not the language of the top level master, but 128 of the direct parent for nested includes. 129 */ 130 mutable Language const * master_language; 131 132 /** Current stream encoding. Only used for LaTeX. 133 This must be set to the document encoding (via the constructor) 134 before output starts. Afterwards it must be kept up to date for 135 each single character (\sa Paragraph::latex). 136 This does also mean that you need to set it back if you use a 137 copy (e.g. in insets): \code 138 int InsetFoo::latex(..., OutputParams const & runparams_in) const 139 { 140 OutputParams runparams(runparams_in); 141 runparams.inComment = true; 142 ... 143 InsetBla::latex(..., runparams); 144 ... 145 runparams_in.encoding = runparams.encoding; 146 } 147 \endcode 148 */ 149 mutable Encoding const * encoding; 150 151 /** free_spacing == true means that the inset is in a free-spacing 152 paragraph. 153 */ 154 bool free_spacing; 155 156 /** This var is set by the return value from BufferParams::writeLaTeX 157 */ 158 bool use_babel; 159 160 /** Do we use polyglossia (instead of babel)? 161 */ 162 bool use_polyglossia; 163 164 /** Are we generating multiple indices? 165 */ 166 bool use_indices; 167 168 /** Are we using japanese (pLaTeX)? 169 */ 170 bool use_japanese; 171 172 /** Customized bibtex_command 173 */ 174 std::string bibtex_command; 175 176 /** Customized index_command 177 */ 178 std::string index_command; 179 180 /** Hyperref driver 181 */ 182 std::string hyperref_driver; 183 184 /** Line length to use with plaintext or LaTeX export. 185 */ 186 size_type linelen; 187 188 /** The depth of the current paragraph, set for plaintext 189 * export and used by InsetTabular 190 */ 191 int depth; 192 193 /** Export data filled in by the latex(), docbook() etc methods. 194 This is a hack: Make it possible to add stuff to constant 195 OutputParams instances. 196 */ 197 std::shared_ptr<ExportData> exportdata; 198 199 /** Whether we are entering a display math inset. 200 * Needed to correctly strike out deleted math in change tracking. 201 */ 202 mutable bool inDisplayMath; 203 204 /** Whether we are leaving a display math inset. 205 * Needed to correctly track nested ulem commands in change tracking. 206 */ 207 mutable bool wasDisplayMath; 208 209 /** Whether we are inside a comment inset. Insets that are including 210 * external files like InsetGraphics, InsetInclude and InsetExternal 211 * may only write the usual output and must not attempt to do 212 * something with the included files (e.g. copying, converting) 213 * if this flag is true, since they may not exist. 214 */ 215 bool inComment; 216 217 /** Whether a btUnit (for multiple biblographies) is open. 218 */ 219 mutable bool openbtUnit; 220 221 /** Process only the children's aux files with BibTeX. 222 * This is necessary with chapterbib. 223 */ 224 bool only_childbibs; 225 226 /** Whether we are in a table cell. 227 * For newline, it matters whether its content is aligned or not. 228 */ 229 TableCell inTableCell; 230 231 /** Whether we are inside a float or subfloat. 232 * Needed for subfloat detection on the command line. 233 */ 234 Float inFloat; 235 236 /** Whether we are inside an index inset. 237 * ERT needs to know this, due to the active chars. 238 */ 239 bool inIndexEntry; 240 241 /** Whether we are inside an IPA inset. 242 * Needed for proper IPA output. 243 */ 244 bool inIPA; 245 246 /** Whether we are inside an inset that is logically deleted. 247 * A value > 0 indicates a deleted inset. 248 */ 249 int inDeletedInset; 250 251 /** The change information of the outermost logically deleted inset. 252 * changeOfDeletedInset shall only be evaluated if inDeletedInset > 0. 253 */ 254 Change changeOfDeletedInset; 255 256 /** allow output of only part of the top-level paragraphs 257 * par_begin: beginning paragraph 258 */ 259 mutable pit_type par_begin; 260 261 /** allow output of only part of the top-level paragraphs 262 * par_end: par_end-1 is the ending paragraph 263 * if par_begin=par_end, output all paragraphs 264 */ 265 mutable pit_type par_end; 266 267 /// Id of the last paragraph before an inset 268 mutable int lastid; 269 270 /// Last position in the last paragraph before an inset 271 mutable pos_type lastpos; 272 273 /// is this the last paragraph in the current buffer/inset? 274 bool isLastPar; 275 276 277 /** whether or not to do actual file copying and image conversion 278 * This mode will be used to preview the source code 279 */ 280 bool dryrun; 281 282 /// whether to display output errors or not 283 bool silent; 284 285 /// Should we output verbatim or escape LaTeX's special chars? 286 bool pass_thru; 287 288 /// Should we output verbatim specific chars? 289 docstring pass_thru_chars; 290 291 /// Should we output captions? 292 bool html_disable_captions; 293 294 /// Are we already in a paragraph? 295 bool html_in_par; 296 297 /// Does the present context even permit paragraphs? 298 bool html_make_pars; 299 300 /// Are we generating this material for inclusion in a TOC-like entity? 301 bool for_toc; 302 303 /// Are we generating this material for inclusion in a tooltip? 304 bool for_tooltip; 305 306 /// Are we generating this material for use by advanced search? 307 bool for_search; 308 309 /// Are we generating this material for instant preview? 310 bool for_preview; 311 312 /// Include all children notwithstanding the use of \includeonly 313 bool includeall; 314 315 /// Explicit output folder, if any is desired 316 std::string export_folder; 317 }; 318 319 320 } // namespace lyx 321 322 #endif // NOT OUTPUTPARAMS_H 323