2 /* This file is part of*
3 * ======================================================
5 * LyX, The Document Processor
7 * Copyright 1997 LyX Team (this file was created this year)
9 * ====================================================== */
11 #ifndef INSET_INCLUDE_H
12 #define INSET_INCLUDE_H
18 #include "insetcommand.h"
23 // Created by AAS 970521
25 /** Used to include files
27 class InsetInclude: public InsetCommand {
30 InsetInclude(InsetCommandParams const &, Buffer *);
34 Inset * Clone() const;
36 Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
37 /// This returns the list of labels on the child buffer
38 std::vector<string> const getLabelList() const;
39 /// This returns the list of bibkeys on the child buffer
40 std::vector< std::pair<string,string> > const getKeys() const;
42 void Edit(BufferView *, int x, int y, unsigned int button);
44 EDITABLE Editable() const
48 /// With lyx3 we won't overload these 3 methods
49 void Write(Buffer const *, std::ostream &) const;
51 void Read(Buffer const *, LyXLex &);
53 int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
55 int Linuxdoc(Buffer const *, std::ostream &) const;
57 int DocBook(Buffer const *, std::ostream &) const;
59 void Validate(LaTeXFeatures &) const;
61 /** Input inserts anything inside a paragraph.
62 Display can give some visual feedback
66 string const getScreenLabel() const;
68 string const getMasterFilename() const;
70 string const getFileName() const;
72 /// In "input" mode uses \input instead of \include.
73 bool isInput() const { return flag == InsetInclude::INPUT; }
74 /// If this is true, the child file shouldn't be loaded by lyx
75 bool isNoLoad() const { return noload; }
77 /** A verbatim file shouldn't be loaded by LyX
78 * No need to generate LaTeX code of a verbatim file
82 bool isVerbVisibleSpace() const {
83 return flag == InsetInclude::VERBAST;
86 bool isInclude() const { return flag == InsetInclude::INCLUDE;}
96 void setVisibleSpace(bool b);
97 /// return true if the file is or got loaded.
98 bool loadIfNeeded() const;
119 string include_label;
124 bool InsetInclude::isVerb() const
126 return flag == InsetInclude::VERB || flag == InsetInclude::VERBAST;
131 void InsetInclude::setInput()
134 flag = InsetInclude::INPUT;
141 void InsetInclude::setNoLoad(bool b)
148 void InsetInclude::setInclude()
151 flag = InsetInclude::INCLUDE;
152 setCmdName("include");
158 void InsetInclude::setVerb()
161 flag = InsetInclude::VERB;
162 setCmdName("verbatiminput");
168 void InsetInclude::setVisibleSpace(bool b)
170 if (b && flag == InsetInclude::VERB) {
171 setCmdName("verbatiminput*");
172 flag = InsetInclude::VERBAST;
173 } else if (!b && flag == InsetInclude::VERBAST) {
174 setCmdName("verbatiminput");
175 flag = InsetInclude::VERB;