]> git.lyx.org Git - lyx.git/blob - src/insets/insetparent.C
pos=string::npos for regex not found, use handcoded transform in lstring.C, fix the...
[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 extern BufferView * current_view;
29
30
31 InsetParent::InsetParent(string const & fn, Buffer * owner)
32         : InsetCommand("lyxparent")
33 {
34         if (owner)
35                 setContents(MakeAbsPath(fn, OnlyPath(owner->fileName())));
36         else
37                 setContents(fn);
38 }
39
40
41 void InsetParent::Edit(int, int)
42 {    
43         current_view->owner()->getLyXFunc()->Dispatch(LFUN_CHILDOPEN, 
44                                                       getContents().c_str());
45 }
46
47
48 // LaTeX must just ignore this command
49 int InsetParent::Latex(ostream & os, signed char fragile)
50 {
51         os << "%%#{lyx}";
52         InsetCommand::Latex(os, fragile);
53         return 0;
54 }
55
56
57 // LaTeX must just ignore this command
58 int InsetParent::Latex(string & file, signed char fragile)
59 {
60         file += "%%#{lyx}";
61         InsetCommand::Latex(file, fragile);
62         return 0;
63 }