]> git.lyx.org Git - lyx.git/blob - src/LyXRC.h
Embed: allow the use of embedded layout and class (.cls, .sty) files.
[lyx.git] / src / LyXRC.h
1 // -*- C++ -*-
2 /**
3  * \file LyXRC.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  * \author Jean-Marc Lasgouttes
9  * \author Angus Leeming
10  * \author John Levon
11  * \author André Pönitz
12  * \author Allan Rae
13  * \author Dekel Tsur
14  *
15  * Full author contact details are available in file CREDITS.
16  */
17
18 #ifndef LYXRC_H
19 #define LYXRC_H
20
21 #include "paper.h"
22
23 #include "support/strfwd.h"
24
25 #include <string>
26
27
28 namespace lyx {
29
30 namespace support { class FileName; }
31
32 class Lexer;
33
34 /// This contains the runtime configuration of LyX
35 class LyXRC
36 {
37 public:
38         enum LyXRCTags {
39                 RC_ACCEPT_COMPOUND = 1,
40                 RC_ALT_LANG,
41                 RC_PLAINTEXT_ROFF_COMMAND,
42                 RC_PLAINTEXT_LINELEN,
43                 RC_AUTOREGIONDELETE,
44                 RC_AUTORESET_OPTIONS,
45                 RC_AUTOSAVE,
46                 RC_AUTO_NUMBER,
47                 RC_BACKUPDIR_PATH,
48                 RC_BIBTEX_COMMAND,
49                 RC_BINDFILE,
50                 RC_CHECKLASTFILES,
51                 RC_CHKTEX_COMMAND,
52                 RC_COMPLETION_INLINE_DELAY,
53                 RC_COMPLETION_INLINE_MATH,
54                 RC_COMPLETION_INLINE_TEXT,
55                 RC_COMPLETION_INLINE_DOTS,
56                 RC_COMPLETION_POPUP_DELAY,
57                 RC_COMPLETION_POPUP_MATH,
58                 RC_COMPLETION_POPUP_TEXT,
59                 RC_COMPLETION_POPUP_AFTER_COMPLETE,
60                 RC_CONVERTER,
61                 RC_CONVERTER_CACHE_MAXAGE,
62                 RC_COPIER,
63                 RC_CURSOR_FOLLOWS_SCROLLBAR,
64                 RC_CUSTOM_EXPORT_COMMAND,
65                 RC_CUSTOM_EXPORT_FORMAT,
66                 RC_DATE_INSERT_FORMAT,
67                 RC_DEFFILE,
68                 RC_DEFAULT_LANGUAGE,
69                 RC_DEFAULT_PAPERSIZE,
70                 RC_DIALOGS_ICONIFY_WITH_MAIN,
71                 RC_DISPLAY_GRAPHICS,
72                 RC_DOCUMENTPATH,
73                 RC_ESC_CHARS,
74                 RC_EXAMPLEPATH,
75                 RC_FONT_ENCODING,
76                 RC_FORMAT,
77                 RC_FULL_SCREEN_LIMIT,
78                 RC_FULL_SCREEN_SCROLLBAR,
79                 RC_FULL_SCREEN_TABBAR,
80                 RC_FULL_SCREEN_TOOLBARS,
81                 RC_FULL_SCREEN_WIDTH,
82                 RC_GEOMETRY_SESSION,
83                 RC_GROUP_LAYOUTS,
84                 RC_INDEX_COMMAND,
85                 RC_INPUT,
86                 RC_KBMAP,
87                 RC_KBMAP_PRIMARY,
88                 RC_KBMAP_SECONDARY,
89                 RC_LABEL_INIT_LENGTH,
90                 RC_LANGUAGE_AUTO_BEGIN,
91                 RC_LANGUAGE_AUTO_END,
92                 RC_LANGUAGE_COMMAND_BEGIN,
93                 RC_LANGUAGE_COMMAND_END,
94                 RC_LANGUAGE_COMMAND_LOCAL,
95                 RC_LANGUAGE_GLOBAL_OPTIONS,
96                 RC_LANGUAGE_PACKAGE,
97                 RC_LANGUAGE_USE_BABEL,
98                 RC_LOADSESSION,
99                 RC_MACRO_EDIT_STYLE,
100                 RC_MAKE_BACKUP,
101                 RC_MARK_FOREIGN_LANGUAGE,
102                 RC_MOUSE_WHEEL_SPEED,
103                 RC_NUMLASTFILES,
104                 RC_PATH_PREFIX,
105                 RC_PERS_DICT,
106                 RC_PREVIEW,
107                 RC_PREVIEW_HASHED_LABELS,
108                 RC_PREVIEW_SCALE_FACTOR,
109                 RC_PRINTCOLLCOPIESFLAG,
110                 RC_PRINTCOPIESFLAG,
111                 RC_PRINTER,
112                 RC_PRINTEVENPAGEFLAG,
113                 RC_PRINTEXSTRAOPTIONS,
114                 RC_PRINTFILEEXTENSION,
115                 RC_PRINTLANDSCAPEFLAG,
116                 RC_PRINTODDPAGEFLAG,
117                 RC_PRINTPAGERANGEFLAG,
118                 RC_PRINTPAPERDIMENSIONFLAG,
119                 RC_PRINTPAPERFLAG,
120                 RC_PRINTREVERSEFLAG,
121                 RC_PRINTSPOOL_COMMAND,
122                 RC_PRINTSPOOL_PRINTERPREFIX,
123                 RC_PRINTTOFILE,
124                 RC_PRINTTOPRINTER,
125                 RC_PRINT_ADAPTOUTPUT,
126                 RC_PRINT_COMMAND,
127                 RC_RTL_SUPPORT,
128                 RC_SCREEN_DPI,
129                 RC_SCREEN_FONT_ROMAN,
130                 RC_SCREEN_FONT_ROMAN_FOUNDRY,
131                 RC_SCREEN_FONT_SANS,
132                 RC_SCREEN_FONT_SANS_FOUNDRY,
133                 RC_SCREEN_FONT_SCALABLE,
134                 RC_SCREEN_FONT_SIZES,
135                 RC_SCREEN_FONT_TYPEWRITER,
136                 RC_SCREEN_FONT_TYPEWRITER_FOUNDRY,
137                 RC_SCREEN_ZOOM,
138                 RC_SERVERPIPE,
139                 RC_SET_COLOR,
140                 RC_SHOW_BANNER,
141                 RC_SORT_LAYOUTS,
142                 RC_SPELL_COMMAND,
143                 RC_TEMPDIRPATH,
144                 RC_TEMPLATEPATH,
145                 RC_TEX_ALLOWS_SPACES,
146                 RC_TEX_EXPECTS_WINDOWS_PATHS,
147                 RC_UIFILE,
148                 RC_USELASTFILEPOS,
149                 RC_USER_EMAIL,
150                 RC_USER_NAME,
151                 RC_USETEMPDIR,
152                 RC_USE_ALT_LANG,
153                 RC_USE_CONVERTER_CACHE,
154                 RC_USE_ESC_CHARS,
155                 RC_USE_INP_ENC,
156                 RC_USE_PERS_DICT,
157                 RC_USE_TOOLTIP,
158                 RC_USE_PIXMAP_CACHE,
159                 RC_USE_SPELL_LIB,
160                 RC_VIEWDVI_PAPEROPTION,
161                 RC_VIEWER,
162                 RC_VISUAL_CURSOR,
163                 RC_LAST
164         };
165
166         ///
167         LyXRC();
168         ///
169         void setDefaults();
170         ///
171         int read(support::FileName const & filename);
172         ///
173         int read(std::istream &);
174 private:
175         ///
176         int read(Lexer &);
177 public:
178         ///
179         void write(support::FileName const & filename,
180                    bool ignore_system_lyxrc) const;
181         /// write rc. If a specific tag is given, only output that one.
182         void write(std::ostream & os,
183                    bool ignore_system_lyxrc, 
184                    std::string const & tag = std::string()) const;
185         ///
186         void print() const;
187         // FIXME unused (was used for xforms. Do we still need this?)
188         //static docstring const getDescription(LyXRCTags);
189         ///
190         std::string bind_file;
191         ///
192         std::string def_file;
193         ///
194         std::string ui_file;
195         ///
196         std::string printer;
197         ///
198         std::string print_command;
199         ///
200         std::string print_evenpage_flag;
201         ///
202         std::string print_oddpage_flag;
203         ///
204         std::string print_pagerange_flag;
205         ///
206         std::string print_copies_flag;
207         ///
208         std::string print_collcopies_flag;
209         ///
210         std::string print_reverse_flag;
211         ///
212         std::string print_landscape_flag;
213         ///
214         std::string print_to_printer;
215         ///
216         bool print_adapt_output;
217         ///
218         std::string print_to_file;
219         ///
220         std::string print_file_extension;
221         ///
222         std::string print_extra_options;
223         ///
224         std::string print_spool_command;
225         ///
226         std::string print_spool_printerprefix;
227         ///
228         std::string print_paper_flag;
229         ///
230         std::string print_paper_dimension_flag;
231         ///
232         std::string custom_export_command;
233         ///
234         std::string custom_export_format;
235         /// option for telling the dvi viewer about the paper size
236         std::string view_dvi_paper_option;
237         /// default paper size for local xdvi/dvips/ghostview/whatever
238         PAPER_SIZE default_papersize;
239         /// command to run chktex incl. options
240         std::string chktex_command;
241         /// command to run bibtex incl. options
242         std::string bibtex_command;
243         /// command to run makeindex incl. options or other index programs
244         std::string index_command;
245         ///
246         std::string document_path;
247         ///
248         std::string example_path;
249         ///
250         std::string template_path;
251         ///
252         std::string tempdir_path;
253         ///
254         bool auto_region_delete;
255         /// flag telling whether lastfiles should be checked for existance
256         bool auto_reset_options;
257         ///
258         bool check_lastfiles;
259         /// maximal number of lastfiles
260         unsigned int num_lastfiles;
261         /// whether or not go to saved position when opening a file
262         bool use_lastfilepos;
263         /// load files from last session automatically
264         bool load_session;
265         /// shall a backup file be created
266         bool make_backup;
267         /// A directory for storing backup files
268         std::string backupdir_path;
269         /// Whether or not save/restore session information
270         /// like windows position and geometry.
271         bool allow_geometry_session;
272         /// Scrolling speed of the mouse wheel
273         double mouse_wheel_speed;
274         /// Zoom factor for screen fonts
275         unsigned int zoom;
276         /// Screen font sizes in points for each font size
277         std::string font_sizes[10];
278         /// Allow the use of scalable fonts? Default is yes.
279         bool use_scalable_fonts;
280         /// DPI of monitor
281         unsigned int dpi;
282         ///
283         std::string fontenc;
284         ///
285         std::string roman_font_name;
286         ///
287         std::string sans_font_name;
288         ///
289         std::string typewriter_font_name;
290         ///
291         std::string roman_font_foundry;
292         ///
293         std::string sans_font_foundry;
294         ///
295         std::string typewriter_font_foundry;
296         ///
297         unsigned int autosave;
298         ///
299         std::string plaintext_roff_command;
300         ///
301         unsigned int plaintext_linelen;
302         /// use library instead of process
303         bool use_spell_lib;
304         /// Ispell command
305         std::string isp_command;
306         /// Accept compound words in spellchecker?
307         bool isp_accept_compound;
308         /// Pass input encoding switch to ispell?
309         bool isp_use_input_encoding;
310         /// Use alternate language?
311         bool isp_use_alt_lang;
312         /// Use personal dictionary?
313         bool isp_use_pers_dict;
314         /// Use tooltips?
315         bool use_tooltip;
316         /// Use pixmap cache?
317         bool use_pixmap_cache;
318         /// Use escape chars?
319         bool isp_use_esc_chars;
320         /// Alternate language for ispell
321         std::string isp_alt_lang;
322         /// Alternate personal dictionary file for ispell
323         std::string isp_pers_dict;
324         /// Escape characters
325         std::string isp_esc_chars;
326         ///
327         bool use_kbmap;
328         ///
329         std::string primary_kbmap;
330         ///
331         std::string secondary_kbmap;
332         ///
333         std::string lyxpipes;
334         ///
335         std::string date_insert_format;
336         ///
337         std::string language_package;
338         ///
339         bool language_auto_begin;
340         ///
341         bool language_auto_end;
342         ///
343         std::string language_command_begin;
344         ///
345         std::string language_command_end;
346         ///
347         std::string language_command_local;
348         ///
349         bool language_global_options;
350         ///
351         bool language_use_babel;
352         ///
353         bool rtl_support;
354         /// bidi cursor movement: true = visual, false = logical
355         bool visual_cursor;
356         ///
357         bool auto_number;
358         ///
359         bool mark_foreign_language;
360         ///
361         std::string default_language;
362         ///
363         bool cursor_follows_scrollbar;
364         ///
365         enum MacroEditStyle {
366                 MACRO_EDIT_INLINE_BOX = 0,
367                 MACRO_EDIT_INLINE,
368                 MACRO_EDIT_LIST
369         };
370         ///
371         MacroEditStyle macro_edit_style;
372         ///
373         bool dialogs_iconify_with_main;
374         ///
375         int label_init_length;
376         ///
377         ///graphics::DisplayType
378         int display_graphics;
379         ///
380         bool show_banner;
381         ///
382         enum PreviewStatus {
383                 PREVIEW_OFF,
384                 PREVIEW_NO_MATH,
385                 PREVIEW_ON
386         };
387         ///
388         PreviewStatus preview;
389         ///
390         bool preview_hashed_labels;
391         ///
392         std::string preview_scale_factor;
393         /// user name
394         std::string user_name;
395         /// user email
396         std::string user_email;
397         /// True if the TeX engine cannot handle posix paths
398         bool windows_style_tex_paths;
399         /// True if the TeX engine can handle file names containing spaces
400         bool tex_allows_spaces;
401         /** Prepend paths to the PATH environment variable.
402          *  The string is input, stored and output in native format.
403          */
404         std::string path_prefix;
405         /// Use the cache for file converters?
406         bool use_converter_cache;
407         /// The maximum age of cache files in seconds
408         unsigned int converter_cache_maxage;
409         /// Sort layouts alphabetically
410         bool sort_layouts;
411         /// Group layout by their category
412         bool group_layouts;
413         /// Toggle toolbars in fullscreen mode?
414         bool full_screen_toolbars;
415         /// Toggle scrollbar in fullscreen mode?
416         bool full_screen_scrollbar;
417         /// Toggle tabbar in fullscreen mode?
418         bool full_screen_tabbar;
419         /// Limit the text width?
420         bool full_screen_limit;
421         /// Width of limited screen (in pixels) in fullscreen mode
422         int full_screen_width;
423         ///
424         double completion_inline_delay;
425         ///
426         bool completion_inline_math;
427         ///
428         bool completion_inline_text;
429         ///
430         int completion_inline_dots;
431         ///
432         double completion_popup_delay;
433         ///
434         bool completion_popup_math;
435         ///
436         bool completion_popup_text;
437         ///
438         bool completion_popup_after_complete;
439 };
440
441
442 /** \c LyXRC_PreviewStatus is a wrapper for LyXRC::PreviewStatus.
443  *  It can be forward-declared and passed as a function argument without
444  *  having to expose LyXRC.h.
445  */
446 class LyXRC_PreviewStatus {
447         LyXRC::PreviewStatus val_;
448 public:
449         LyXRC_PreviewStatus(LyXRC::PreviewStatus val) : val_(val) {}
450         operator LyXRC::PreviewStatus() const { return val_; }
451 };
452
453
454 ///
455 extern LyXRC lyxrc;
456 ///
457 extern LyXRC system_lyxrc;
458
459 } // namespace lyx
460
461 #endif