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 EDITABLE editable() const
86 /// With lyx3 we won't overload these 3 methods
87 void write(Buffer const *, std::ostream &) const;
89 void read(Buffer const *, LyXLex &);
91 int latex(Buffer const *, std::ostream &,
92 bool fragile, bool free_spc) const;
94 int ascii(Buffer const *, std::ostream &, int linelen) const;
96 int linuxdoc(Buffer const *, std::ostream &) const;
98 int docBook(Buffer const *, std::ostream &) const;
100 void validate(LaTeXFeatures &) const;
102 /** Input inserts anything inside a paragraph.
103 Display can give some visual feedback
105 bool display() const;
107 /// return the filename stub of the included file
108 string const getRelFileBaseName() const;
110 /// return true if the included file is not loaded
111 bool isIncludeOnly() const;
113 /// return true if the file is or got loaded.
114 bool loadIfNeeded() const;
116 /// hide a dialog if about
117 SigC::Signal0<void> hideDialog;
119 /// get the text displayed on the button
120 string const getScreenLabel() const;
121 /// is this a verbatim include ?
122 bool isVerbatim() const;
123 /// get the filename of the master buffer
124 string const getMasterFilename() const;
125 /// get the included file name
126 string const getFileName() const;
131 string include_label;
135 inline bool InsetInclude::isVerbatim() const
137 return params_.flag == VERB || params_.flag == VERBAST;
141 inline bool InsetInclude::isIncludeOnly() const
143 return params_.flag == INCLUDE && params_.noload;