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 InsetButton, boost::noncopyable {
29 /// the type of inclusion
42 Params(InsetCommandParams const & cp = InsetCommandParams(),
45 string const & name = string())
46 : cparams(cp), flag(f), noload(nl),
47 masterFilename_(name) {}
48 InsetCommandParams cparams;
51 string masterFilename_;
54 bool operator==(Params const &) const;
56 bool operator!=(Params const &) const;
60 InsetInclude(Params const &);
62 InsetInclude(InsetCommandParams const &, Buffer const &);
66 /// get the parameters
67 Params const & params(void) const;
68 /// set the parameters
69 void set(Params const & params);
72 virtual Inset * clone(Buffer const &, bool same_id = false) const;
74 Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; }
75 /// This returns the list of labels on the child buffer
76 std::vector<string> const getLabelList() const;
77 /// This returns the list of bibkeys on the child buffer
78 std::vector< std::pair<string,string> > const getKeys() const;
80 void edit(BufferView *, int x, int y, unsigned int button);
82 void edit(BufferView * bv, bool front = true);
84 EDITABLE editable() const
88 /// With lyx3 we won't overload these 3 methods
89 void write(Buffer const *, std::ostream &) const;
91 void read(Buffer const *, LyXLex &);
93 int latex(Buffer const *, std::ostream &,
94 bool fragile, bool free_spc) const;
96 int ascii(Buffer const *, std::ostream &, int linelen) const;
98 int linuxdoc(Buffer const *, std::ostream &) const;
100 int docBook(Buffer const *, std::ostream &) const;
102 void validate(LaTeXFeatures &) const;
104 /** Input inserts anything inside a paragraph.
105 Display can give some visual feedback
107 bool display() const;
109 /// return the filename stub of the included file
110 string const getRelFileBaseName() const;
112 /// return true if the included file is not loaded
113 bool isIncludeOnly() const;
115 /// return true if the file is or got loaded.
116 bool loadIfNeeded() const;
118 /// hide a dialog if about
119 SigC::Signal0<void> hideDialog;
121 /// get the text displayed on the button
122 string const getScreenLabel() const;
123 /// is this a verbatim include ?
124 bool isVerbatim() const;
125 /// get the filename of the master buffer
126 string const getMasterFilename() const;
127 /// get the included file name
128 string const getFileName() const;
133 string include_label;
137 inline bool InsetInclude::isVerbatim() const
139 return params_.flag == VERB || params_.flag == VERBAST;
143 inline bool InsetInclude::isIncludeOnly() const
145 return params_.flag == INCLUDE && params_.noload;