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;
68 int exec(int & argc, char * argv[]);
73 void operator=(LyX const &);
75 /// Do some cleanup in preparation of an exit.
78 /// Early exit during the initialisation process.
79 void earlyExit(int status);
81 /// Initialise LyX and fills-in the vector of files to be loaded.
83 \return exit code failure if any.
85 int init(int & argc, char * argv[]);
87 /// Execute batch commands if available.
90 /// Load files passed at command-line.
91 /// return true on success false if we encounter an error
93 This method is used only in non-GUI mode.
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 void 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 Messages const & getMessages(std::string const & language);
143 friend Messages const & getGuiMessages();
144 friend KeyMap & theTopLevelKeymap();
145 friend Movers & theMovers();
146 friend Mover const & getMover(std::string const & fmt);
147 friend void setMover(std::string const & fmt, std::string const & command);
148 friend Movers & theSystemMovers();
149 friend frontend::Application * theApp();
150 friend Session & theSession();
151 friend CmdDef & theTopLevelCmdDef();
152 friend SpellChecker * theSpellChecker();
153 friend void setSpellChecker();
154 friend void setRcGuiLanguage();
155 friend void emergencyCleanup();
156 friend void execBatchCommands();
157 friend void lyx_exit(int exit_code);
161 /// in the case of failure
162 void emergencyCleanup();
163 /// Try to exit LyX properly.
164 /// \p exit_code is 0 by default, if a non zero value is passed,
165 /// emergencyCleanup() will be called before exiting.
166 void lyx_exit(int exit_code);
167 /// Set the language defined by the user.
168 void setRcGuiLanguage();
169 /// Execute batch commands if available.
170 void execBatchCommands();
173 FuncStatus getStatus(FuncRequest const & action);
176 void dispatch(FuncRequest const & action);
179 void dispatch(FuncRequest const & action, DispatchResult & dr);