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>
24 * The class holds all all open buffers, and handles construction
25 * and deletions of new ones.
27 class BufferList : boost::noncopyable {
32 Loads a LyX file or...
34 \param filename The filename to read from.
35 \param tolastfiles Wether the file should be put in the
36 last opened files list or not.
37 \return The newly loaded LyX file.
39 Buffer * loadLyXFile(string const & filename,
40 bool tolastfiles = true);
42 /// write all buffers, asking the user, returns false if cancelled
45 /// create a new buffer
46 Buffer * newBuffer(string const & s, bool ronly = false);
49 void release(Buffer * b);
51 /// Close all open buffers.
54 /// read the given file
55 Buffer * readFile(string const &, bool ro);
57 /// Make a new file (buffer) using a template
58 Buffer * newFile(string const &, string, bool isNamed = false);
59 /// returns a vector with all the buffers filenames
60 std::vector<string> const getFileNames() const;
63 void updateIncludedTeXfiles(string const &);
65 /// emergency save for all buffers
66 void emergencyWriteAll();
68 /// close buffer. Returns false if cancelled by user
69 bool close(Buffer * buf, bool ask);
71 /// return true if no buffers loaded
74 /// return head of buffer list if any
77 /// returns true if the buffer exists already
78 bool exists(string const &) const;
80 /// returns true if the buffer is loaded
81 bool isLoaded(Buffer const * b) const;
83 /// returns a pointer to the buffer with the given name.
84 Buffer * getBuffer(string const &);
85 /// returns a pointer to the buffer with the given number.
86 Buffer * getBuffer(unsigned int);
88 /// reset current author for all buffers
89 void setCurrentAuthor(string const & name, string const & email);
92 /// ask to save a buffer on quit, returns false if should cancel
93 bool quitWriteBuffer(Buffer * buf);
95 typedef std::vector<Buffer *> BufferStorage;
97 /// storage of all buffers
100 /// save emergency file for the given buffer
101 void emergencyWrite(Buffer * buf);
104 #endif // BUFFERLIST_H