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 {
31 InsetInclude(): InsetCommand("include")
33 flag = InsetInclude::INCLUDE;
37 InsetInclude(string const &, Buffer *);
41 Inset * Clone() const;
43 Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
44 /// This returns the list of labels on the child buffer
45 std::vector<string> getLabelList() const;
46 /// This returns the list of bibkeys on the child buffer
47 std::vector< std::pair<string,string> > getKeys() const;
49 void Edit(BufferView *, int x, int y, unsigned int button);
51 EDITABLE Editable() const
55 /// With lyx3 we won't overload these 3 methods
56 void Write(Buffer const *, std::ostream &) const;
58 void Read(Buffer const *, LyXLex &);
60 int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
62 int Linuxdoc(Buffer const *, std::ostream &) const;
64 int DocBook(Buffer const *, std::ostream &) const;
66 void Validate(LaTeXFeatures &) const;
68 /** Input inserts anything inside a paragraph.
69 Display can give some visual feedback
73 string getScreenLabel() const;
75 string getMasterFilename() const;
77 string getFileName() const;
79 /// In "input" mode uses \input instead of \include.
80 bool isInput() const { return flag == InsetInclude::INPUT; }
81 /// If this is true, the child file shouldn't be loaded by lyx
82 bool isNoLoad() const { return noload; }
84 /** A verbatim file shouldn't be loaded by LyX
85 * No need to generate LaTeX code of a verbatim file
89 bool isVerbVisibleSpace() const {
90 return flag == InsetInclude::VERBAST;
93 bool isInclude() const { return flag == InsetInclude::INCLUDE;}
103 void setVisibleSpace(bool b);
104 /// return true if the file is or got loaded.
105 bool loadIfNeeded() const;
126 mutable string include_label;
131 bool InsetInclude::isVerb() const
133 return flag == InsetInclude::VERB || flag == InsetInclude::VERBAST;
138 void InsetInclude::setInput()
141 flag = InsetInclude::INPUT;
148 void InsetInclude::setNoLoad(bool b)
155 void InsetInclude::setInclude()
158 flag = InsetInclude::INCLUDE;
159 setCmdName("include");
165 void InsetInclude::setVerb()
168 flag = InsetInclude::VERB;
169 setCmdName("verbatiminput");
175 void InsetInclude::setVisibleSpace(bool b)
177 if (b && flag == InsetInclude::VERB) {
178 setCmdName("verbatiminput*");
179 flag = InsetInclude::VERBAST;
180 } else if (!b && flag == InsetInclude::VERBAST) {
181 setCmdName("verbatiminput");
182 flag = InsetInclude::VERB;