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"
44 extern OverwriteFiles force_overwrite;
62 int exec(int & argc, char * argv[]);
67 void operator=(LyX const &);
69 /// Do some cleanup in preparation of an exit.
72 /// Early exit during the initialisation process.
73 void earlyExit(int status);
75 /// Initialise LyX and fills-in the vector of files to be loaded.
77 \return exit code failure if any.
79 int init(int & argc, char * argv[]);
81 /// Execute batch commands if available.
84 /// Load files passed at command-line.
85 /// return true on success false if we encounter an error
87 This method is used only in non-GUI mode.
91 /// initial LyX set up
93 /** Check for the existence of the user's support directory and,
94 * if not present, create it. Exits the program if the directory
96 * \returns true if the user-side configuration script
97 * (lib/configure) should be re-run in this directory.
99 bool queryUserLyXDir(bool explicit_userdir);
100 /// read lyxrc/preferences
101 bool readRcFile(std::string const & name);
102 /// read the given languages file
103 bool readLanguagesFile(std::string const & name);
104 /// read the encodings.
105 /// \param enc_name encodings definition file
106 /// \param symbols_name unicode->LaTeX mapping file
107 bool readEncodingsFile(std::string const & enc_name,
108 std::string const & symbols_name);
109 /// parsing of non-gui LyX options.
110 void easyParse(int & argc, char * argv[]);
111 /// shows up a parsing error on screen
112 void printError(ErrorItem const &);
115 Messages & messages(std::string const & language);
117 /// Use the Pimpl idiom to hide the internals.
118 // Mostly used for singletons.
122 /// has this user started lyx for the first time?
125 friend FuncStatus getStatus(FuncRequest const & action);
126 friend void dispatch(FuncRequest const & action);
127 friend void dispatch(FuncRequest const & action, DispatchResult & dr);
128 friend BufferList & theBufferList();
129 friend Server & theServer();
130 friend ServerSocket & theServerSocket();
131 friend Converters & theConverters();
132 friend Converters & theSystemConverters();
133 friend Messages const & getMessages(std::string const & language);
134 friend Messages const & getGuiMessages();
135 friend KeyMap & theTopLevelKeymap();
136 friend Movers & theMovers();
137 friend Mover const & getMover(std::string const & fmt);
138 friend void setMover(std::string const & fmt, std::string const & command);
139 friend Movers & theSystemMovers();
140 friend frontend::Application * theApp();
141 friend graphics::Previews & thePreviews();
142 friend Session & theSession();
143 friend CmdDef & theTopLevelCmdDef();
144 friend SpellChecker * theSpellChecker();
145 friend void setSpellChecker();
146 friend void setRcGuiLanguage();
147 friend void emergencyCleanup();
148 friend void execBatchCommands();
149 friend void lyx_exit(int exit_code);
153 /// in the case of failure
154 void emergencyCleanup();
155 /// Try to exit LyX properly.
156 /// \p exit_code is 0 by default, if a non zero value is passed,
157 /// emergencyCleanup() will be called before exiting.
158 void lyx_exit(int exit_code);
159 /// Set the language defined by the user.
160 void setRcGuiLanguage();
161 /// Execute batch commands if available.
162 void execBatchCommands();
165 FuncStatus getStatus(FuncRequest const & action);
168 void dispatch(FuncRequest const & action);
171 void dispatch(FuncRequest const & action, DispatchResult & dr);