4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
11 * Full author contact details are available in file CREDITS.
17 #include "support/strfwd.h"
56 extern bool ignore_missing_glyphs;
57 extern RunMode run_mode;
58 extern OverwriteFiles force_overwrite;
66 friend class LyXConsoleApp;
72 int exec(int & argc, char * argv[]);
77 void operator=(LyX const &);
79 /// Do some cleanup in preparation of an exit.
82 /// Early exit during the initialisation process.
83 void earlyExit(int status);
85 /// Initialise LyX and fills-in the vector of files to be loaded.
87 \return exit code failure if any.
89 int init(int & argc, char * argv[]);
91 /// Execute commandline commands if no GUI was requested.
92 int execWithoutGui(int & argc, char * argv[]);
94 /// Execute batch commands if available.
97 /// initial LyX set up
99 /** Check for the existence of the user's support directory and,
100 * if not present, create it. Exits the program if the directory
102 * \returns true if the user-side configuration script
103 * (lib/configure) should be re-run in this directory.
105 bool queryUserLyXDir(bool explicit_userdir);
106 /// read lyxrc/preferences
107 /// \param check_format: whether to try to convert the format of
108 /// the file, if there is a mismatch.
109 bool readRcFile(std::string const & name, bool check_format = false);
110 /// read the given languages file
111 bool readLanguagesFile(std::string const & name);
112 /// read the encodings.
113 /// \param enc_name encodings definition file
114 /// \param symbols_name unicode->LaTeX mapping file
115 bool readEncodingsFile(std::string const & enc_name,
116 std::string const & symbols_name);
117 /// parsing of non-gui LyX options.
118 void easyParse(int & argc, char * argv[]);
119 /// shows up a parsing error on screen
120 void printError(ErrorItem const &);
123 Messages & messages(std::string const & language);
125 /// Use the Pimpl idiom to hide the internals.
126 // Mostly used for singletons.
130 /// has this user started lyx for the first time?
133 friend FuncStatus getStatus(FuncRequest const & action);
134 friend DispatchResult const & dispatch(FuncRequest const & action);
135 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
136 friend std::vector<std::string> & theFilesToLoad();
137 friend BufferList & theBufferList();
138 friend Server & theServer();
139 friend ServerSocket & theServerSocket();
140 friend Converters & theConverters();
141 friend Converters & theSystemConverters();
142 friend Formats & theFormats();
143 friend Formats & theSystemFormats();
144 friend Messages const & getMessages(std::string const & language);
145 friend Messages const & getGuiMessages();
146 friend KeyMap & theTopLevelKeymap();
147 friend Movers & theMovers();
148 friend Mover const & getMover(std::string const & fmt);
149 friend void setMover(std::string const & fmt, std::string const & command);
150 friend Movers & theSystemMovers();
151 friend frontend::Application * theApp();
152 friend Session & theSession();
153 friend LaTeXFonts & theLaTeXFonts();
154 friend CmdDef & theTopLevelCmdDef();
155 friend SpellChecker * theSpellChecker();
156 friend void setSpellChecker();
157 friend void emergencyCleanup();
158 friend void execBatchCommands();
159 friend void lyx_exit(int exit_code);
163 /// in the case of failure
164 void emergencyCleanup();
165 /// Try to exit LyX properly.
166 /// \p exit_code is 0 by default, if a non zero value is passed,
167 /// emergencyCleanup() will be called before exiting.
168 void lyx_exit(int exit_code);
169 /// Execute batch commands if available.
170 void execBatchCommands();
173 FuncStatus getStatus(FuncRequest const & action);
176 DispatchResult const & dispatch(FuncRequest const & action);
179 void dispatch(FuncRequest const & action, DispatchResult & dr);