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"
20 #include <boost/signals/signal0.hpp>
25 // Created by AAS 970521
27 /** Used to include files
29 class InsetInclude: public InsetButton, boost::noncopyable {
31 /// the type of inclusion
44 Params(InsetCommandParams const & cp = InsetCommandParams(),
47 string const & name = string())
48 : cparams(cp), flag(f), noload(nl),
49 masterFilename_(name) {}
50 InsetCommandParams cparams;
53 string masterFilename_;
56 bool operator==(Params const &) const;
58 bool operator!=(Params const &) const;
62 InsetInclude(Params const &);
64 InsetInclude(InsetCommandParams const &, Buffer const &);
68 /// get the parameters
69 Params const & params(void) const;
70 /// set the parameters
71 void set(Params const & params);
74 virtual Inset * clone(Buffer const &, bool same_id = false) const;
76 Inset::Code lyxCode() const { return Inset::INCLUDE_CODE; }
77 /// This returns the list of labels on the child buffer
78 std::vector<string> const getLabelList() const;
79 /// This returns the list of bibkeys on the child buffer
80 std::vector< std::pair<string,string> > const getKeys() const;
82 void edit(BufferView *, int x, int y, mouse_button::state button);
84 void edit(BufferView * bv, bool front = true);
86 EDITABLE editable() const
90 /// With lyx3 we won't overload these 3 methods
91 void write(Buffer const *, std::ostream &) const;
93 void read(Buffer const *, LyXLex &);
95 int latex(Buffer const *, std::ostream &,
96 bool fragile, bool free_spc) const;
98 int ascii(Buffer const *, std::ostream &, int linelen) const;
100 int linuxdoc(Buffer const *, std::ostream &) const;
102 int docbook(Buffer const *, std::ostream &, bool mixcont) const;
104 void validate(LaTeXFeatures &) const;
106 /** Input inserts anything inside a paragraph.
107 Display can give some visual feedback
109 bool display() const;
111 /// return the filename stub of the included file
112 string const getRelFileBaseName() const;
114 /// return true if the included file is not loaded
115 bool isIncludeOnly() const;
117 /// return true if the file is or got loaded.
118 bool loadIfNeeded() const;
120 /// hide a dialog if about
121 boost::signal0<void> hideDialog;
123 /// get the text displayed on the button
124 string const getScreenLabel(Buffer const *) const;
125 /// is this a verbatim include ?
126 bool isVerbatim() const;
127 /// get the filename of the master buffer
128 string const getMasterFilename() const;
129 /// get the included file name
130 string const getFileName() const;
134 /// holds the entity name that defines the file location (SGML)
135 string const include_label;
139 inline bool InsetInclude::isVerbatim() const
141 return params_.flag == VERB || params_.flag == VERBAST;
145 inline bool InsetInclude::isIncludeOnly() const
147 return params_.flag == INCLUDE && params_.noload;