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, public boost::noncopyable {
29 /// the type of inclusion
41 struct InsetIncludeParams {
42 InsetIncludeParams(InsetCommandParams const & cp = InsetCommandParams(),
43 IncludeFlags f = INCLUDE, bool nl = false, Buffer const * b = 0)
44 : cparams(cp), flag(f), noload(nl), buffer(b) {}
45 InsetCommandParams cparams;
48 Buffer const * buffer;
52 InsetInclude(InsetIncludeParams const &);
54 InsetInclude(InsetCommandParams const &, Buffer const &);
58 /// get the parameters
59 InsetIncludeParams const & params(void) const;
61 /// set the parameters
62 void setFromParams(InsetIncludeParams const & params);
65 Inset * Clone(Buffer const &) const;
67 Inset::Code LyxCode() const { return Inset::INCLUDE_CODE; }
68 /// This returns the list of labels on the child buffer
69 std::vector<string> const getLabelList() const;
70 /// This returns the list of bibkeys on the child buffer
71 std::vector< std::pair<string,string> > const getKeys() const;
73 void Edit(BufferView *, int x, int y, unsigned int button);
75 EDITABLE Editable() const
79 /// With lyx3 we won't overload these 3 methods
80 void Write(Buffer const *, std::ostream &) const;
82 void Read(Buffer const *, LyXLex &);
84 int Latex(Buffer const *, std::ostream &, bool fragile, bool free_spc) const;
86 int Ascii(Buffer const *, std::ostream &, int linelen) const;
88 int Linuxdoc(Buffer const *, std::ostream &) const;
90 int DocBook(Buffer const *, std::ostream &) const;
92 void Validate(LaTeXFeatures &) const;
94 /** Input inserts anything inside a paragraph.
95 Display can give some visual feedback
99 /// return the filename stub of the included file
100 string const getRelFileBaseName() const;
102 /// return true if the included file is not loaded
103 bool isIncludeOnly() const;
105 /// return true if the file is or got loaded.
106 bool loadIfNeeded() const;
108 /// hide a dialog if about
109 Signal0<void> hideDialog;
111 /// get the text displayed on the button
112 string const getScreenLabel() const;
113 /// is this a verbatim include ?
114 bool isVerbatim() const;
115 /// get the filename of the master buffer
116 string const getMasterFilename() const;
117 /// get the included file name
118 string const getFileName() const;
121 InsetIncludeParams params_;
123 string include_label;
127 inline bool InsetInclude::isVerbatim() const
129 return params_.flag == VERB || params_.flag == VERBAST;
133 inline bool InsetInclude::isIncludeOnly() const
135 return params_.flag == INCLUDE && params_.noload;