]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
change to use only ostream to write latex from insets
[lyx.git] / src / insets / insetparent.C
1 /* This file is part of*
2  * ====================================================== 
3  *
4  *           LyX, The Document Processor
5  *       
6  *           Copyright (C) 1997-1999 LyX Team
7  * 
8  * ====================================================== */
9
10
11 // Created by asierra 970813
12
13 #include <config.h>
14
15
16 #ifdef __GNUG__
17 #pragma implementation
18 #endif
19
20 #include "insetparent.h"
21 #include "support/filetools.h"
22 #include "BufferView.h"
23 #include "LyXView.h"
24 #include "lyxfunc.h"
25 #include "commandtags.h"
26
27
28 InsetParent::InsetParent(string const & fn, Buffer * owner)
29         : InsetCommand("lyxparent")
30 {
31         if (owner)
32                 setContents(MakeAbsPath(fn, OnlyPath(owner->fileName())));
33         else
34                 setContents(fn);
35 }
36
37
38 void InsetParent::Edit(BufferView * bv, int, int, unsigned int)
39 {    
40         bv->owner()->getLyXFunc()->
41                 Dispatch(LFUN_CHILDOPEN, getContents().c_str());
42 }
43
44
45 // LaTeX must just ignore this command
46 int InsetParent::Latex(ostream & os, signed char fragile) const
47 {
48         os << "%%#{lyx}";
49         InsetCommand::Latex(os, fragile);
50         return 0;
51 }
52
53
54 #ifndef USE_OSTREAM_ONLY
55 // LaTeX must just ignore this command
56 int InsetParent::Latex(string & file, signed char fragile) const
57 {
58         file += "%%#{lyx}";
59         InsetCommand::Latex(file, fragile);
60         return 0;
61 }
62 #endif