+ /// \name Functions involved in reading files/strings.
+ //@{
+ /// Loads the LyX file into the buffer. This function
+ /// tries to extract the file from version control if it
+ /// cannot be found. If it can be found, it will try to
+ /// read an emergency save file or an autosave file.
+ /// \sa loadThisLyXFile
+ ReadStatus loadLyXFile();
+ /// Loads the LyX file \c fn into the buffer. If you want
+ /// to check for files in a version control container,
+ /// emergency or autosave files, one should use \c loadLyXFile.
+ /// /sa loadLyXFile
+ ReadStatus loadThisLyXFile(support::FileName const & fn);
+ /// import a new document from a string
+ bool importString(std::string const &, docstring const &, ErrorList &);
+ /// import a new file
+ bool importFile(std::string const &, support::FileName const &, ErrorList &);
+ /// read a new document from a string
+ bool readString(std::string const &);
+ /// Reloads the LyX file
+ ReadStatus reload();
+//FIXME: The following function should be private
+//private:
+ /// read the header, returns number of unknown tokens
+ int readHeader(Lexer & lex);
+
+ double fontScalingFactor() const;
+
+private:
+ ///
+ typedef std::map<Buffer const *, Buffer *> BufferMap;
+ ///
+ void cloneWithChildren(BufferMap &, CloneList *) const;
+ /// save timestamp and checksum of the given file.
+ void saveCheckSum() const;
+ /// read a new file
+ ReadStatus readFile(support::FileName const & fn);
+ /// Reads a file without header.
+ /// \param par if != 0 insert the file.
+ /// \return \c true if file is not completely read.
+ bool readDocument(Lexer &);
+ /// Try to extract the file from a version control container
+ /// before reading if the file cannot be found.
+ /// \sa LyXVC::file_not_found_hook
+ ReadStatus extractFromVC();
+ /// Reads the first tag of a LyX File and
+ /// returns the file format number.
+ ReadStatus parseLyXFormat(Lexer & lex, support::FileName const & fn,
+ int & file_format) const;
+ /// Convert the LyX file to the LYX_FORMAT using
+ /// the lyx2lyx script and returns the filename
+ /// of the temporary file to be read
+ ReadStatus convertLyXFormat(support::FileName const & fn,
+ support::FileName & tmpfile, int from_format);
+ /// get appropriate name for backing up files from older versions
+ support::FileName getBackupName() const;
+ //@}
+
+public:
+ /// \name Functions involved in autosave and emergency files.
+ //@{
+ /// Save an autosave file to #filename.lyx#
+ bool autoSave() const;
+ /// save emergency file
+ /// \return a status message towards the user.
+ docstring emergencyWrite();
+
+//FIXME:The following function should be private
+//private:
+ ///
+ void removeAutosaveFile() const;
+
+private:
+ /// Try to load an autosave file associated to \c fn.
+ ReadStatus loadAutosave();
+ /// Try to load an emergency file associated to \c fn.
+ ReadStatus loadEmergency();
+ /// Get the filename of the emergency file associated with the Buffer
+ support::FileName getEmergencyFileName() const;
+ /// Get the filename of the autosave file associated with the Buffer
+ support::FileName getAutosaveFileName() const;
+ ///
+ void moveAutosaveFile(support::FileName const & old) const;
+ //@}