This commit was manufactured by cvs2svn to create tag
[lyx.git] / src / ImportLaTeX.C
blob0a38e96c3ce75164881d4f77960e9b52548f67b1
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  */
14 #include <config.h>
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
20 #include "ImportLaTeX.h"
21 #include "lyxrc.h"
22 #include "support/syscall.h"
23 #include "support/filetools.h"
24 #include "bufferlist.h"
26 extern LyXRC * lyxrc;
27 extern BufferList bufferlist;
30  * CLASS ImportLaTeX
31  */
33 ImportLaTeX::ImportLaTeX(string const & file)
34                 : file(file)
39 Buffer * ImportLaTeX::run()
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;