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"
54 extern RunMode run_mode;
55 extern OverwriteFiles force_overwrite;
69 int exec(int & argc, char * argv[]);
74 void operator=(LyX const &);
76 /// Do some cleanup in preparation of an exit.
79 /// Early exit during the initialisation process.
80 void earlyExit(int status);
82 /// Initialise LyX and fills-in the vector of files to be loaded.
84 \return exit code failure if any.
86 int init(int & argc, char * argv[]);
88 /// Execute batch commands if available.
91 /// Load files passed at command-line.
92 /// return true on success false if we encounter an error
94 This method is used only in non-GUI mode.
98 /// initial LyX set up
100 /** Check for the existence of the user's support directory and,
101 * if not present, create it. Exits the program if the directory
103 * \returns true if the user-side configuration script
104 * (lib/configure) should be re-run in this directory.
106 bool queryUserLyXDir(bool explicit_userdir);
107 /// read lyxrc/preferences
108 /// \param check_format: whether to try to convert the format of
109 /// the file, if there is a mismatch.
110 bool readRcFile(std::string const & name, bool check_format = false);
111 /// read the given languages file
112 bool readLanguagesFile(std::string const & name);
113 /// read the encodings.
114 /// \param enc_name encodings definition file
115 /// \param symbols_name unicode->LaTeX mapping file
116 bool readEncodingsFile(std::string const & enc_name,
117 std::string const & symbols_name);
118 /// parsing of non-gui LyX options.
119 void easyParse(int & argc, char * argv[]);
120 /// shows up a parsing error on screen
121 void printError(ErrorItem const &);
124 Messages & messages(std::string const & language);
126 /// Use the Pimpl idiom to hide the internals.
127 // Mostly used for singletons.
131 /// has this user started lyx for the first time?
134 friend FuncStatus getStatus(FuncRequest const & action);
135 friend void dispatch(FuncRequest const & action);
136 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
137 friend std::vector<std::string> & theFilesToLoad();
138 friend BufferList & theBufferList();
139 friend Server & theServer();
140 friend ServerSocket & theServerSocket();
141 friend Converters & theConverters();
142 friend Converters & theSystemConverters();
143 friend Messages const & getMessages(std::string const & language);
144 friend Messages const & getGuiMessages();
145 friend KeyMap & theTopLevelKeymap();
146 friend Movers & theMovers();
147 friend Mover const & getMover(std::string const & fmt);
148 friend void setMover(std::string const & fmt, std::string const & command);
149 friend Movers & theSystemMovers();
150 friend frontend::Application * theApp();
151 friend Session & theSession();
152 friend LaTeXFonts & theLaTeXFonts();
153 friend CmdDef & theTopLevelCmdDef();
154 friend SpellChecker * theSpellChecker();
155 friend void setSpellChecker();
156 friend void emergencyCleanup();
157 friend void execBatchCommands();
158 friend void lyx_exit(int exit_code);
162 /// in the case of failure
163 void emergencyCleanup();
164 /// Try to exit LyX properly.
165 /// \p exit_code is 0 by default, if a non zero value is passed,
166 /// emergencyCleanup() will be called before exiting.
167 void lyx_exit(int exit_code);
168 /// Execute batch commands if available.
169 void execBatchCommands();
172 FuncStatus getStatus(FuncRequest const & action);
175 void dispatch(FuncRequest const & action);
178 void dispatch(FuncRequest const & action, DispatchResult & dr);