]> git.lyx.org Git - lyx.git/blob - src/ImportLaTeX.C
white-space changes, removed definitions.h several enum changes because of this,...
[lyx.git] / src / ImportLaTeX.C
1 /* This file is part of
2  * ====================================================== 
3  * 
4  *           LyX, The Document Processor         
5  *           Copyright 1995 Matthias Ettrich
6  *           Copyright 1995-1999 The LyX Team.
7  *
8  *           This file is Copyright 1998
9  *           Asger Alstrup
10  *
11  * ====================================================== 
12  */
13
14 #include <config.h>
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "ImportLaTeX.h"
21 #include "lyxrc.h"
22 #include "support/syscall.h"
23 #include "support/filetools.h"
24 #include "bufferlist.h"
25
26 extern LyXRC * lyxrc;
27 extern BufferList bufferlist;
28
29 /*
30  * CLASS ImportLaTeX
31  */
32
33 ImportLaTeX::ImportLaTeX(string const & file)
34                 : file(file)
35 {
36 }
37
38
39 Buffer * ImportLaTeX::run()
40 {
41         // run reLyX
42         string tmp = lyxrc->relyx_command + " -f " + file;
43         Systemcalls one;
44         Buffer * buf = 0;
45         int result = one.startscript(Systemcalls::System, tmp);
46         if (result == 0) {
47                 string filename = ChangeExtension(file, ".lyx", false);
48                 // File was generated without problems. Load it.
49                 buf = bufferlist.loadLyXFile(filename);
50         }
51         return buf;
52 }