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 const &);
34 Inset * Clone(Buffer const &) 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 Ascii(Buffer const *, std::ostream &, int linelen) const;
57 int Linuxdoc(Buffer const *, std::ostream &) const;
59 int DocBook(Buffer const *, std::ostream &) const;
61 void Validate(LaTeXFeatures &) const;
63 /** Input inserts anything inside a paragraph.
64 Display can give some visual feedback
68 string const getScreenLabel() const;
70 string const getMasterFilename() const;
72 string const getFileName() const;
74 /// In "input" mode uses \input instead of \include.
75 bool isInput() const { return flag == InsetInclude::INPUT; }
76 /// If this is true, the child file shouldn't be loaded by lyx
77 bool isNoLoad() const { return noload; }
79 /** A verbatim file shouldn't be loaded by LyX
80 * No need to generate LaTeX code of a verbatim file
84 bool isVerbVisibleSpace() const {
85 return flag == InsetInclude::VERBAST;
88 bool isInclude() const { return flag == InsetInclude::INCLUDE;}
98 void setVisibleSpace(bool b);
99 /// return true if the file is or got loaded.
100 bool loadIfNeeded() const;
119 Buffer const * master;
121 string include_label;
126 bool InsetInclude::isVerb() const
128 return flag == InsetInclude::VERB || flag == InsetInclude::VERBAST;
133 void InsetInclude::setInput()
136 flag = InsetInclude::INPUT;
143 void InsetInclude::setNoLoad(bool b)
150 void InsetInclude::setInclude()
153 flag = InsetInclude::INCLUDE;
154 setCmdName("include");
160 void InsetInclude::setVerb()
163 flag = InsetInclude::VERB;
164 setCmdName("verbatiminput");
170 void InsetInclude::setVisibleSpace(bool b)
172 if (b && flag == InsetInclude::VERB) {
173 setCmdName("verbatiminput*");
174 flag = InsetInclude::VERBAST;
175 } else if (!b && flag == InsetInclude::VERBAST) {
176 setCmdName("verbatiminput");
177 flag = InsetInclude::VERB;