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"
53 extern RunMode run_mode;
54 extern OverwriteFiles force_overwrite;
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 batch commands if available.
94 /// Load files passed at command-line.
95 /// return true on success false if we encounter an error
97 This method is used only in non-GUI mode.
101 /// initial LyX set up
103 /** Check for the existence of the user's support directory and,
104 * if not present, create it. Exits the program if the directory
106 * \returns true if the user-side configuration script
107 * (lib/configure) should be re-run in this directory.
109 bool queryUserLyXDir(bool explicit_userdir);
110 /// read lyxrc/preferences
111 bool readRcFile(std::string const & name);
112 /// read the given languages file
113 bool readLanguagesFile(std::string const & name);
114 /// read the encodings.
115 /// \param enc_name encodings definition file
116 /// \param symbols_name unicode->LaTeX mapping file
117 bool readEncodingsFile(std::string const & enc_name,
118 std::string const & symbols_name);
119 /// parsing of non-gui LyX options.
120 void easyParse(int & argc, char * argv[]);
121 /// shows up a parsing error on screen
122 void printError(ErrorItem const &);
125 Messages & messages(std::string const & language);
127 /// Use the Pimpl idiom to hide the internals.
128 // Mostly used for singletons.
132 /// has this user started lyx for the first time?
135 friend FuncStatus getStatus(FuncRequest const & action);
136 friend void dispatch(FuncRequest const & action);
137 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
138 friend std::vector<std::string> & theFilesToLoad();
139 friend BufferList & theBufferList();
140 friend Server & theServer();
141 friend ServerSocket & theServerSocket();
142 friend Converters & theConverters();
143 friend Converters & theSystemConverters();
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 graphics::Previews & thePreviews();
153 friend Session & theSession();
154 friend CmdDef & theTopLevelCmdDef();
155 friend SpellChecker * theSpellChecker();
156 friend void setSpellChecker();
157 friend void setRcGuiLanguage();
158 friend void emergencyCleanup();
159 friend void execBatchCommands();
160 friend void lyx_exit(int exit_code);
164 /// in the case of failure
165 void emergencyCleanup();
166 /// Try to exit LyX properly.
167 /// \p exit_code is 0 by default, if a non zero value is passed,
168 /// emergencyCleanup() will be called before exiting.
169 void lyx_exit(int exit_code);
170 /// Set the language defined by the user.
171 void setRcGuiLanguage();
172 /// Execute batch commands if available.
173 void execBatchCommands();
176 FuncStatus getStatus(FuncRequest const & action);
179 void dispatch(FuncRequest const & action);
182 void dispatch(FuncRequest const & action, DispatchResult & dr);