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 Inset * Clone(Buffer const &) 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 &, bool fragile, bool free_spc) const;
93 int Ascii(Buffer const *, std::ostream &, int linelen) const;
95 int Linuxdoc(Buffer const *, std::ostream &) const;
97 int DocBook(Buffer const *, std::ostream &) const;
99 void Validate(LaTeXFeatures &) const;
101 /** Input inserts anything inside a paragraph.
102 Display can give some visual feedback
104 bool display() const;
106 /// return the filename stub of the included file
107 string const getRelFileBaseName() const;
109 /// return true if the included file is not loaded
110 bool isIncludeOnly() const;
112 /// return true if the file is or got loaded.
113 bool loadIfNeeded() const;
115 /// hide a dialog if about
116 SigC::Signal0<void> hideDialog;
118 /// get the text displayed on the button
119 string const getScreenLabel() const;
120 /// is this a verbatim include ?
121 bool isVerbatim() const;
122 /// get the filename of the master buffer
123 string const getMasterFilename() const;
124 /// get the included file name
125 string const getFileName() const;
130 string include_label;
134 inline bool InsetInclude::isVerbatim() const
136 return params_.flag == VERB || params_.flag == VERBAST;
140 inline bool InsetInclude::isIncludeOnly() const
142 return params_.flag == INCLUDE && params_.noload;