]> git.lyx.org Git - lyx.git/blob - src/Buffer.h
installer: further preparation
[lyx.git] / src / Buffer.h
1 // -*- C++ -*-
2 /**
3  * \file Buffer.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author Lars Gullik Bjønnes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef BUFFER_H
13 #define BUFFER_H
14
15 #include "OutputEnums.h"
16 #include "OutputParams.h"
17
18 #include "support/strfwd.h"
19 #include "support/types.h"
20
21 #include <map>
22 #include <list>
23 #include <set>
24 #include <string>
25 #include <vector>
26
27
28 namespace lyx {
29
30 class BiblioInfo;
31 class BibTeXInfo;
32 class BufferParams;
33 class DispatchResult;
34 class DocIterator;
35 class docstring_list;
36 class ErrorList;
37 class FuncRequest;
38 class FuncStatus;
39 class Inset;
40 class InsetLabel;
41 class InsetRef;
42 class Font;
43 class Format;
44 class Lexer;
45 class Text;
46 class LyXVC;
47 class LaTeXFeatures;
48 class Language;
49 class MacroData;
50 class MacroNameSet;
51 class MacroSet;
52 class OutputParams;
53 class Paragraph;
54 class ParConstIterator;
55 class ParIterator;
56 class ParagraphList;
57 class TeXErrors;
58 class TexRow;
59 class TocBackend;
60 class Undo;
61 class WordLangTuple;
62
63 namespace frontend {
64 class GuiBufferDelegate;
65 class WorkAreaManager;
66 }
67
68 namespace support {
69 class FileName;
70 class FileNameList;
71 }
72
73 namespace graphics {
74 class PreviewLoader;
75 }
76
77
78 class Buffer;
79 typedef std::list<Buffer *> ListOfBuffers;
80 /// a list of Buffers we cloned
81 typedef std::set<Buffer *> CloneList;
82
83
84 /** The buffer object.
85  * This is the buffer object. It contains all the information about
86  * a document loaded into LyX.
87  * The buffer object owns the Text (wrapped in an InsetText), which
88  * contains the individual paragraphs of the document.
89  *
90  *
91  * I am not sure if the class is complete or
92  * minimal, probably not.
93  * \author Lars Gullik Bjønnes
94  */
95
96 class MarkAsExporting;
97
98 class Buffer {
99 public:
100         /// What type of log will \c getLogName() return?
101         enum LogType {
102                 latexlog, ///< LaTeX log
103                 buildlog  ///< Literate build log
104         };
105
106         /// Result of \c readFile()
107         enum ReadStatus {
108                 ReadSuccess,
109                 ReadCancel,
110                 // failures
111                 ReadFailure,
112                 ReadWrongVersion,
113                 ReadFileNotFound,
114                 ReadVCError,
115                 ReadAutosaveFailure,
116                 ReadEmergencyFailure,
117                 ReadNoLyXFormat,
118                 ReadDocumentFailure,
119                 // lyx2lyx
120                 LyX2LyXNoTempFile,
121                 LyX2LyXNotFound,
122                 LyX2LyXOlderFormat,
123                 LyX2LyXNewerFormat,
124                 // other
125                 ReadOriginal
126         };
127
128         enum ExportStatus {
129                 // export
130                 ExportSuccess,
131                 ExportCancel,
132                 ExportError,
133                 ExportNoPathToFormat,
134                 ExportTexPathHasSpaces,
135                 ExportConverterError,
136                 // preview
137                 PreviewSuccess,
138                 PreviewError
139         };
140
141         /// Method to check if a file is externally modified, used by
142         /// isExternallyModified()
143         /**
144          * timestamp is fast but inaccurate. For example, the granularity
145          * of timestamp on a FAT filesystem is 2 seconds. Also, various operations
146          * may touch the timestamp of a file even when its content is unchanged.
147          *
148          * checksum is accurate but slow, which can be a problem when it is
149          * frequently used, or used for a large file on a slow (network) file
150          * system.
151          *
152          * FIXME: replace this method with support/FileMonitor.
153          */
154         enum CheckMethod {
155                 checksum_method, ///< Use file checksum
156                 timestamp_method ///< Use timestamp, and checksum if timestamp has changed
157         };
158
159         ///
160         enum UpdateScope {
161                 UpdateMaster,
162                 UpdateChildOnly
163         };
164
165         /// Constructor
166         explicit Buffer(std::string const & file, bool readonly = false,
167                 Buffer const * cloned_buffer = 0);
168
169         /// Destructor
170         ~Buffer();
171
172         /// Clones the entire structure of which this Buffer is part, starting
173         /// with the master and cloning all the children, too.
174         Buffer * cloneFromMaster() const;
175         /// Just clones this single Buffer. For autosave.
176         Buffer * cloneBufferOnly() const;
177         ///
178         bool isClone() const;
179
180         /** High-level interface to buffer functionality.
181             This function parses a command string and executes it.
182         */
183         void dispatch(std::string const & command, DispatchResult & result);
184
185         /// Maybe we know the function already by number...
186         void dispatch(FuncRequest const & func, DispatchResult & result);
187
188         /// Can this function be exectued?
189         /// \return true if we made a decision
190         bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
191
192         ///
193         DocIterator getParFromID(int id) const;
194         /// do we have a paragraph with this id?
195         bool hasParWithID(int id) const;
196
197         ///
198         frontend::WorkAreaManager & workAreaManager() const;
199
200         /** Save file.
201             Takes care of auto-save files and backup file if requested.
202             Returns \c true if the save is successful, \c false otherwise.
203         */
204         bool save() const;
205         /// Renames and saves the buffer
206         bool saveAs(support::FileName const & fn);
207
208         /// Write document to stream. Returns \c false if unsuccessful.
209         bool write(std::ostream &) const;
210         /// Write file. Returns \c false if unsuccessful.
211         bool writeFile(support::FileName const &) const;
212
213         /// \name Functions involved in reading files/strings.
214         //@{
215         /// Loads the LyX file into the buffer. This function
216         /// tries to extract the file from version control if it
217         /// cannot be found. If it can be found, it will try to
218         /// read an emergency save file or an autosave file.
219         /// \sa loadThisLyXFile
220         ReadStatus loadLyXFile();
221         /// Loads the LyX file \c fn into the buffer. If you want
222         /// to check for files in a version control container,
223         /// emergency or autosave files, one should use \c loadLyXFile.
224         /// /sa loadLyXFile
225         ReadStatus loadThisLyXFile(support::FileName const & fn);
226         /// import a new document from a string
227         bool importString(std::string const &, docstring const &, ErrorList &);
228         /// import a new file
229         bool importFile(std::string const &, support::FileName const &, ErrorList &);
230         /// read a new document from a string
231         bool readString(std::string const &);
232         /// Reloads the LyX file
233         /// \param clearUndo if false, leave alone the undo stack.
234         ReadStatus reload(bool clearUndo = true);
235 //FIXME: The following function should be private
236 //private:
237         /// read the header, returns number of unknown tokens
238         int readHeader(Lexer & lex);
239
240 private:
241         ///
242         typedef std::map<Buffer const *, Buffer *> BufferMap;
243         ///
244         void cloneWithChildren(BufferMap &, CloneList *) const;
245         /// save timestamp and checksum of the given file.
246         void saveCheckSum() const;
247         /// read a new file
248         ReadStatus readFile(support::FileName const & fn);
249         /// Reads a file without header.
250         /// \param par if != 0 insert the file.
251         /// \return \c true if file is not completely read.
252         bool readDocument(Lexer &);
253         /// Try to extract the file from a version control container
254         /// before reading if the file cannot be found.
255         /// \sa LyXVC::file_not_found_hook
256         ReadStatus extractFromVC();
257         /// Reads the first tag of a LyX File and
258         /// returns the file format number.
259         ReadStatus parseLyXFormat(Lexer & lex, support::FileName const & fn,
260                 int & file_format) const;
261         /// Convert the LyX file to the LYX_FORMAT using
262         /// the lyx2lyx script and returns the filename
263         /// of the temporary file to be read
264         ReadStatus convertLyXFormat(support::FileName const & fn,
265                 support::FileName & tmpfile, int from_format);
266         //@}
267
268 public:
269         /// \name Functions involved in autosave and emergency files.
270         //@{
271         /// Save an autosave file to #filename.lyx#
272         bool autoSave() const;
273         /// save emergency file
274         /// \return a status message towards the user.
275         docstring emergencyWrite();
276
277 //FIXME:The following function should be private
278 //private:
279         ///
280         void removeAutosaveFile() const;
281
282 private:
283         /// Try to load an autosave file associated to \c fn.
284         ReadStatus loadAutosave();
285         /// Try to load an emergency file associated to \c fn.
286         ReadStatus loadEmergency();
287         /// Get the filename of the emergency file associated with the Buffer
288         support::FileName getEmergencyFileName() const;
289         /// Get the filename of the autosave file associated with the Buffer
290         support::FileName getAutosaveFileName() const;
291         ///
292         void moveAutosaveFile(support::FileName const & old) const;
293         //@}
294
295 public:
296         /// Fill in the ErrorList with the TeXErrors
297         void bufferErrors(TeXErrors const &, ErrorList &) const;
298
299         enum OutputWhat {
300                 FullSource,
301                 OnlyBody,
302                 IncludedFile,
303                 OnlyPreamble,
304                 CurrentParagraph
305         };
306
307         /// Just a wrapper for writeLaTeXSource, first creating the ofstream.
308         bool makeLaTeXFile(support::FileName const & filename,
309                            std::string const & original_path,
310                            OutputParams const &,
311                            OutputWhat output = FullSource) const;
312         /** Export the buffer to LaTeX.
313             If \p os is a file stream, and params().inputenc is "auto" or
314             "default", and the buffer contains text in different languages
315             with more than one encoding, then this method will change the
316             encoding associated to \p os. Therefore you must not call this
317             method with a string stream if the output is supposed to go to a
318             file. \code
319             ofdocstream ofs;
320             otexstream os(ofs, texrow);
321             ofs.open("test.tex");
322             writeLaTeXSource(os, ...);
323             ofs.close();
324             \endcode is NOT equivalent to \code
325             odocstringstream oss;
326             otexstream os(oss, texrow);
327             writeLaTeXSource(os, ...);
328             ofdocstream ofs;
329             ofs.open("test.tex");
330             ofs << oss.str();
331             ofs.close();
332             \endcode
333          */
334         void writeLaTeXSource(otexstream & os,
335                            std::string const & original_path,
336                            OutputParams const &,
337                            OutputWhat output = FullSource) const;
338         ///
339         void makeDocBookFile(support::FileName const & filename,
340                              OutputParams const & runparams_in,
341                              OutputWhat output = FullSource) const;
342         ///
343         void writeDocBookSource(odocstream & os, std::string const & filename,
344                              OutputParams const & runparams_in,
345                              OutputWhat output = FullSource) const;
346         ///
347         void makeLyXHTMLFile(support::FileName const & filename,
348                              OutputParams const & runparams_in) const;
349         ///
350         void writeLyXHTMLSource(odocstream & os,
351                              OutputParams const & runparams_in,
352                              OutputWhat output = FullSource) const;
353         /// returns the main language for the buffer (document)
354         Language const * language() const;
355         /// get l10n translated to the buffers language
356         docstring const B_(std::string const & l10n) const;
357
358         ///
359         int runChktex();
360         /// return true if the main lyx file does not need saving
361         bool isClean() const;
362         ///
363         bool isDepClean(std::string const & name) const;
364
365         /// whether or not disk file has been externally modified
366         bool isExternallyModified(CheckMethod method) const;
367
368         /// mark the main lyx file as not needing saving
369         void markClean() const;
370
371         ///
372         void markDepClean(std::string const & name);
373
374         ///
375         void setUnnamed(bool flag = true);
376
377         /// Whether or not a filename has been assigned to this buffer
378         bool isUnnamed() const;
379
380         /// Whether or not this buffer is internal.
381         ///
382         /// An internal buffer does not contain a real document, but some auxiliary text segment.
383         /// It is not associated with a filename, it is never saved, thus it does not need to be
384         /// automatically saved, nor it needs to trigger any "do you want to save ?" question.
385         bool isInternal() const;
386
387         void setInternal(bool flag);
388
389         /// Mark this buffer as dirty.
390         void markDirty();
391
392         /// Returns the buffer's filename. It is always an absolute path.
393         support::FileName fileName() const;
394
395         /// Returns the buffer's filename. It is always an absolute path.
396         std::string absFileName() const;
397
398         /// Returns the path where the buffer lives.
399         /// It is always an absolute path.
400         std::string filePath() const;
401
402         /** A transformed version of the file name, adequate for LaTeX.
403             \param no_path optional if \c true then the path is stripped.
404         */
405         std::string latexName(bool no_path = true) const;
406
407         /// Get the name and type of the log.
408         std::string logName(LogType * type = 0) const;
409
410         /// Set document's parent Buffer.
411         void setParent(Buffer const *);
412         Buffer const * parent() const;
413
414         /** Get the document's master (or \c this if this is not a
415             child document)
416          */
417         Buffer const * masterBuffer() const;
418
419         /// \return true if \p child is a child of this \c Buffer.
420         bool isChild(Buffer * child) const;
421
422         /// \return true if this \c Buffer has children
423         bool hasChildren() const;
424
425         /// \return a list of the direct children of this Buffer.
426         /// this list has no duplicates and is in the order in which
427         /// the children appear.
428         ListOfBuffers getChildren() const;
429
430         /// \return a list of all descendents of this Buffer (children,
431         /// grandchildren, etc). this list has no duplicates and is in
432         /// the order in which the children appear.
433         ListOfBuffers getDescendents() const;
434
435         /// Collect all relative buffers, in the order in which they appear.
436         /// I.e., the "root" Buffer is first, then its first child, then any
437         /// of its children, etc. However, there are no duplicates in this
438         /// list.
439         /// This is "stable", too, in the sense that it returns the same
440         /// thing from whichever Buffer it is called.
441         ListOfBuffers allRelatives() const;
442
443         /// Is buffer read-only?
444         bool isReadonly() const;
445
446         /// Set buffer read-only flag
447         void setReadonly(bool flag = true);
448
449         /** Validate a buffer for LaTeX.
450             This validates the buffer, and returns a struct for use by
451             #makeLaTeX# and others. Its main use is to figure out what
452             commands and packages need to be included in the LaTeX file.
453             It (should) also check that the needed constructs are there
454             (i.e. that the \refs points to coresponding \labels). It
455             should perhaps inset "error" insets to help the user correct
456             obvious mistakes.
457         */
458         void validate(LaTeXFeatures &) const;
459
460         /// Reference information is cached in the Buffer, so we do not
461         /// have to check or read things over and over.
462         ///
463         /// There are two caches.
464         ///
465         /// One is a cache of the BibTeX files from which reference info is
466         /// being gathered. This cache is PER BUFFER, and the cache for the
467         /// master essentially includes the cache for its children. This gets
468         /// invalidated when an InsetBibtex is created, deleted, or modified.
469         ///
470         /// The other is a cache of the reference information itself. This
471         /// exists only in the master buffer, and when it needs to be updated,
472         /// the children add their information to the master's cache.
473
474         /// Calling this method invalidates the cache and so requires a
475         /// re-read.
476         void invalidateBibinfoCache() const;
477         /// This invalidates the cache of files we need to check.
478         void invalidateBibfileCache() const;
479         /// Updates the cached bibliography information, checking first to see
480         /// whether the cache is valid. If so, we do nothing. If not, then we
481         /// reload all the BibTeX info.
482         /// Note that this operates on the master document.
483         void reloadBibInfoCache() const;
484         /// \return the bibliography information for this buffer's master,
485         /// or just for it, if it isn't a child.
486         BiblioInfo const & masterBibInfo() const;
487         /// collect bibliography info from the various insets in this buffer.
488         void collectBibKeys() const;
489         /// add some BiblioInfo to our cache
490         void addBiblioInfo(BiblioInfo const & bi) const;
491         /// add a single piece of bibliography info to our cache
492         void addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const;
493         ///
494         void makeCitationLabels() const;
495         ///
496         bool citeLabelsValid() const;
497         ///
498         void getLabelList(std::vector<docstring> &) const;
499
500         /// This removes the .aux and .bbl files from the temp dir.
501         void removeBiblioTempFiles() const;
502
503         ///
504         void changeLanguage(Language const * from, Language const * to);
505
506         ///
507         bool isMultiLingual() const;
508         ///
509         std::set<Language const *> getLanguages() const;
510
511         ///
512         BufferParams & params();
513         BufferParams const & params() const;
514
515         /** The list of paragraphs.
516             This is a linked list of paragraph, this list holds the
517             whole contents of the document.
518          */
519         ParagraphList & paragraphs();
520         ParagraphList const & paragraphs() const;
521
522         /// LyX version control object.
523         LyXVC & lyxvc();
524         LyXVC const & lyxvc() const;
525
526         /// Where to put temporary files.
527         std::string const temppath() const;
528
529         /// Used when typesetting to place errorboxes.
530         TexRow const & texrow() const;
531         TexRow & texrow();
532
533         ///
534         ParIterator par_iterator_begin();
535         ///
536         ParConstIterator par_iterator_begin() const;
537         ///
538         ParIterator par_iterator_end();
539         ///
540         ParConstIterator par_iterator_end() const;
541
542         // Position of the child buffer where it appears first in the master.
543         DocIterator firstChildPosition(Buffer const * child);
544
545         /** \returns true only when the file is fully loaded.
546          *  Used to prevent the premature generation of previews
547          *  and by the citation inset.
548          */
549         bool isFullyLoaded() const;
550         /// Set by buffer_funcs' newFile.
551         void setFullyLoaded(bool);
552
553         /// FIXME: Needed by RenderPreview.
554         graphics::PreviewLoader * loader() const;
555         /// Update the LaTeX preview snippets associated with this buffer
556         void updatePreviews() const;
557         /// Remove any previewed LaTeX snippets associated with this buffer
558         void removePreviews() const;
559
560         /// Our main text (inside the top InsetText)
561         Text & text() const;
562
563         /// Our top InsetText
564         Inset & inset() const;
565
566         //
567         // Macro handling
568         //
569         /// Collect macro definitions in paragraphs
570         void updateMacros() const;
571         /// Iterate through the whole buffer and try to resolve macros
572         void updateMacroInstances(UpdateType) const;
573
574         /// List macro names of this buffer, the parent and the children
575         void listMacroNames(MacroNameSet & macros) const;
576         /// Collect macros of the parent and its children in front of this buffer.
577         void listParentMacros(MacroSet & macros, LaTeXFeatures & features) const;
578
579         /// Return macro defined before pos (or in the master buffer)
580         MacroData const * getMacro(docstring const & name, DocIterator const & pos, bool global = true) const;
581         /// Return macro defined anywhere in the buffer (or in the master buffer)
582         MacroData const * getMacro(docstring const & name, bool global = true) const;
583         /// Return macro defined before the inclusion of the child
584         MacroData const * getMacro(docstring const & name, Buffer const & child, bool global = true) const;
585
586         /// Collect user macro names at loading time
587         typedef std::set<docstring> UserMacroSet;
588         mutable UserMacroSet usermacros;
589
590         /// Replace the inset contents for insets which InsetCode is equal
591         /// to the passed \p inset_code.
592         void changeRefsIfUnique(docstring const & from, docstring const & to);
593
594         /// get source code (latex/docbook) for some paragraphs, or all paragraphs
595         /// including preamble
596         void getSourceCode(odocstream & os, std::string const format,
597                            pit_type par_begin, pit_type par_end, OutputWhat output,
598                            bool master) const;
599
600         /// Access to error list.
601         /// This method is used only for GUI visualisation of Buffer related
602         /// errors (like parsing or LateX compilation). This method is const
603         /// because modifying the returned ErrorList does not touch the document
604         /// contents.
605         ErrorList & errorList(std::string const & type) const;
606
607         /// The Toc backend.
608         /// This is useful only for screen visualisation of the Buffer. This
609         /// method is const because modifying this backend does not touch
610         /// the document contents.
611         TocBackend & tocBackend() const;
612
613         ///
614         Undo & undo();
615
616         /// This function is called when the buffer is changed.
617         void changed(bool update_metrics) const;
618         ///
619         void setChild(DocIterator const & dit, Buffer * child);
620         ///
621         void updateTocItem(std::string const &, DocIterator const &) const;
622         /// This function is called when the buffer structure is changed.
623         void structureChanged() const;
624         /// This function is called when some parsing error shows up.
625         void errors(std::string const & err, bool from_master = false) const;
626         /// This function is called when the buffer busy status change.
627         void setBusy(bool on) const;
628         /// Update window titles of all users.
629         void updateTitles() const;
630         /// Reset autosave timers for all users.
631         void resetAutosaveTimers() const;
632         ///
633         void message(docstring const & msg) const;
634
635         ///
636         void setGuiDelegate(frontend::GuiBufferDelegate * gui);
637         ///
638         bool hasGuiDelegate() const;
639
640         ///
641         ExportStatus doExport(std::string const & target, bool put_in_tempdir) const;
642         ///
643         ExportStatus doExport(std::string const & target, bool put_in_tempdir,
644                 std::string & result_file) const;
645         ///
646         ExportStatus preview(std::string const & format) const;
647
648 private:
649         /// target is a format name optionally followed by a space
650         /// and a destination file-name
651         ExportStatus doExport(std::string const & target, bool put_in_tempdir,
652                 bool includeall, std::string & result_file) const;
653         ///
654         ExportStatus doExport(std::string const & target, bool put_in_tempdir,
655                 bool includeall) const;
656         ///
657         ExportStatus preview(std::string const & format, bool includeall = false) const;
658         ///
659         void setMathFlavor(OutputParams & op) const;
660
661 public:
662         ///
663         bool isExporting() const;
664
665         ///
666         typedef std::vector<std::pair<Inset *, ParIterator> > References;
667         ///
668         References const & references(docstring const & label) const;
669         ///
670         void addReference(docstring const & label, Inset * inset, ParIterator it);
671         ///
672         void clearReferenceCache() const;
673         ///
674         void setInsetLabel(docstring const & label, InsetLabel const * il);
675         ///
676         InsetLabel const * insetLabel(docstring const & label) const;
677
678         /// return a list of all used branches (also in children)
679         void getUsedBranches(std::list<docstring> &, bool const from_master = false) const;
680
681         /// sets the buffer_ member for every inset in this buffer.
682         // FIXME This really shouldn't be needed, but at the moment it's not
683         // clear how to do it just for the individual pieces we need.
684         void setBuffersForInsets() const;
685         /// Updates screen labels and some other information associated with
686         /// insets and paragraphs. Actually, it's more like a general "recurse
687         /// through the Buffer" routine, that visits all the insets and paragraphs.
688         void updateBuffer() const { updateBuffer(UpdateMaster, InternalUpdate); }
689         /// \param scope: whether to start with the master document or just
690         /// do this one.
691         /// \param output: whether we are preparing for output.
692         void updateBuffer(UpdateScope scope, UpdateType utype) const;
693         ///
694         void updateBuffer(ParIterator & parit, UpdateType utype) const;
695
696         /// Spellcheck starting from \p from.
697         /// \p from initial position, will then points to the next misspelled
698         ///    word.
699         /// \p to will points to the end of the next misspelled word.
700         /// \p word_lang will contain the found misspelled word.
701         /// \return progress if a new word was found.
702         int spellCheck(DocIterator & from, DocIterator & to,
703                 WordLangTuple & word_lang, docstring_list & suggestions) const;
704         ///
705         void checkChildBuffers();
706         ///
707         void checkMasterBuffer();
708
709         /// compute statistics between \p from and \p to
710         /// \p from initial position
711         /// \p to points to the end position
712         /// \p skipNoOutput if notes etc. should be ignored
713         void updateStatistics(DocIterator & from, DocIterator & to,
714                                                   bool skipNoOutput = true) const;
715         /// statistics accessor functions
716         int wordCount() const;
717         int charCount(bool with_blanks) const;
718
719 private:
720         friend class MarkAsExporting;
721         /// mark the buffer as busy exporting something, or not
722         void setExportStatus(bool e) const;
723
724         ///
725         References & getReferenceCache(docstring const & label);
726         /// Change name of buffer. Updates "read-only" flag.
727         void setFileName(support::FileName const & fname);
728         ///
729         void getLanguages(std::set<Language const *> &) const;
730         /// Checks whether any of the referenced bibfiles have changed since the
731         /// last time we loaded the cache. Note that this does NOT update the
732         /// cached information.
733         void checkIfBibInfoCacheIsValid() const;
734         /// Update the list of all bibfiles in use (including bibfiles
735         /// of loaded child documents).
736         void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
737         /// Return the list with all bibfiles in use (including bibfiles
738         /// of loaded child documents).
739         support::FileNameList const &
740                 getBibfilesCache(UpdateScope scope = UpdateMaster) const;
741         ///
742         void collectChildren(ListOfBuffers & children, bool grand_children) const;
743
744         /// noncopyable
745         Buffer(Buffer const &);
746         void operator=(Buffer const &);
747
748         /// Use the Pimpl idiom to hide the internals.
749         class Impl;
750         /// The pointer never changes although *pimpl_'s contents may.
751         Impl * const d;
752 };
753
754
755 /// Helper class, to guarantee that the export status
756 /// gets reset properly. To use, simply create a local variable:
757 ///    MarkAsExporting mex(bufptr);
758 /// and leave the rest to us.
759 class MarkAsExporting {
760 public:
761         MarkAsExporting(Buffer const * buf) : buf_(buf)
762         {
763                 buf_->setExportStatus(true);
764         }
765         ~MarkAsExporting()
766         {
767                 buf_->setExportStatus(false);
768         }
769 private:
770         Buffer const * const buf_;
771 };
772
773
774 } // namespace lyx
775
776 #endif