4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
9 * Full author contact details are available in file CREDITS
17 #include <boost/utility.hpp>
25 * The class holds all all open buffers, and handles construction
26 * and deletions of new ones.
28 class BufferList : boost::noncopyable {
33 Loads a LyX file or...
35 \param filename The filename to read from.
36 \param tolastfiles Wether the file should be put in the
37 last opened files list or not.
38 \return The newly loaded LyX file.
40 Buffer * loadLyXFile(string const & filename,
41 bool tolastfiles = true);
43 /// write all buffers, asking the user, returns false if cancelled
46 /// create a new buffer
47 Buffer * newBuffer(string const & s, bool ronly = false);
50 void release(Buffer * b);
52 /// Close all open buffers.
55 /// read the given file
56 Buffer * readFile(string const &, bool ro);
58 /// Make a new file (buffer) using a template
59 Buffer * newFile(string const &, string, bool isNamed = false);
60 /// returns a vector with all the buffers filenames
61 std::vector<string> const getFileNames() const;
64 void updateIncludedTeXfiles(string const &, LatexRunParams const &);
66 /// emergency save for all buffers
67 void emergencyWriteAll();
69 /// close buffer. Returns false if cancelled by user
70 bool close(Buffer * buf, bool ask);
72 /// return true if no buffers loaded
75 /// return head of buffer list if any
78 /// returns true if the buffer exists already
79 bool exists(string const &) const;
81 /// returns true if the buffer is loaded
82 bool isLoaded(Buffer const * b) const;
84 /// returns a pointer to the buffer with the given name.
85 Buffer * getBuffer(string const &);
86 /// returns a pointer to the buffer with the given number.
87 Buffer * getBuffer(unsigned int);
89 /// reset current author for all buffers
90 void setCurrentAuthor(string const & name, string const & email);
93 /// ask to save a buffer on quit, returns false if should cancel
94 bool quitWriteBuffer(Buffer * buf);
96 typedef std::vector<Buffer *> BufferStorage;
98 /// storage of all buffers
101 /// save emergency file for the given buffer
102 void emergencyWrite(Buffer * buf);
105 #endif // BUFFERLIST_H