1999-09-27 18:44:28 +00:00
|
|
|
// -*- C++ -*-
|
2003-05-22 18:59:10 +00:00
|
|
|
/**
|
2007-04-26 04:41:58 +00:00
|
|
|
* \file Buffer.h
|
2003-05-22 18:59:10 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 16:55:34 +00:00
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2000-02-04 09:38:32 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-05-22 18:59:10 +00:00
|
|
|
*/
|
2002-03-21 16:55:34 +00:00
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
#ifndef BUFFER_H
|
|
|
|
#define BUFFER_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2010-01-20 19:42:12 +00:00
|
|
|
#include "OutputEnums.h"
|
2010-12-07 08:36:42 +00:00
|
|
|
#include "OutputParams.h"
|
2009-04-06 12:12:06 +00:00
|
|
|
|
2007-10-13 09:11:10 +00:00
|
|
|
#include "insets/InsetCode.h"
|
|
|
|
|
2007-11-01 22:17:22 +00:00
|
|
|
#include "support/strfwd.h"
|
2007-10-19 14:32:33 +00:00
|
|
|
#include "support/types.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
2010-12-07 08:36:42 +00:00
|
|
|
#include <map>
|
2009-07-09 09:48:34 +00:00
|
|
|
#include <list>
|
2009-11-08 18:47:33 +00:00
|
|
|
#include <set>
|
2006-04-15 11:46:17 +00:00
|
|
|
#include <string>
|
2003-09-06 18:38:02 +00:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
namespace lyx {
|
|
|
|
|
2008-04-25 20:03:03 +00:00
|
|
|
class BiblioInfo;
|
2010-12-03 20:08:04 +00:00
|
|
|
class BibTeXInfo;
|
2003-09-09 11:24:33 +00:00
|
|
|
class BufferParams;
|
2009-04-06 12:12:06 +00:00
|
|
|
class DispatchResult;
|
2007-12-21 20:42:46 +00:00
|
|
|
class DocIterator;
|
2009-04-04 16:40:47 +00:00
|
|
|
class docstring_list;
|
2007-06-15 13:13:49 +00:00
|
|
|
class ErrorList;
|
2003-09-21 23:00:47 +00:00
|
|
|
class FuncRequest;
|
2009-04-06 12:12:06 +00:00
|
|
|
class FuncStatus;
|
2007-04-29 13:39:47 +00:00
|
|
|
class Inset;
|
2008-03-02 15:27:35 +00:00
|
|
|
class InsetLabel;
|
2010-03-31 20:06:16 +00:00
|
|
|
class InsetRef;
|
2007-04-29 18:17:15 +00:00
|
|
|
class Font;
|
2007-10-20 10:51:13 +00:00
|
|
|
class Format;
|
2007-04-26 11:30:54 +00:00
|
|
|
class Lexer;
|
2007-04-29 23:33:02 +00:00
|
|
|
class Text;
|
2003-09-09 11:24:33 +00:00
|
|
|
class LyXVC;
|
1999-09-27 18:44:28 +00:00
|
|
|
class LaTeXFeatures;
|
2000-10-10 12:36:36 +00:00
|
|
|
class Language;
|
2004-04-13 06:27:29 +00:00
|
|
|
class MacroData;
|
2008-02-23 18:11:35 +00:00
|
|
|
class MacroNameSet;
|
2008-03-26 12:55:36 +00:00
|
|
|
class MacroSet;
|
2004-01-26 10:13:15 +00:00
|
|
|
class OutputParams;
|
2007-11-01 11:13:07 +00:00
|
|
|
class Paragraph;
|
2002-11-08 01:08:27 +00:00
|
|
|
class ParConstIterator;
|
2004-03-25 09:16:36 +00:00
|
|
|
class ParIterator;
|
2007-04-26 08:30:11 +00:00
|
|
|
class ParagraphList;
|
2003-09-04 03:54:04 +00:00
|
|
|
class TeXErrors;
|
2003-09-09 11:24:33 +00:00
|
|
|
class TexRow;
|
2006-11-11 00:35:14 +00:00
|
|
|
class TocBackend;
|
2003-09-06 18:38:02 +00:00
|
|
|
class Undo;
|
2009-04-04 16:40:47 +00:00
|
|
|
class WordLangTuple;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-10-02 09:00:08 +00:00
|
|
|
namespace frontend {
|
2007-10-02 18:27:20 +00:00
|
|
|
class GuiBufferDelegate;
|
2007-10-02 09:00:08 +00:00
|
|
|
class WorkAreaManager;
|
|
|
|
}
|
2001-08-03 18:28:11 +00:00
|
|
|
|
2007-12-05 10:32:49 +00:00
|
|
|
namespace support {
|
|
|
|
class FileName;
|
2008-04-19 15:52:35 +00:00
|
|
|
class FileNameList;
|
2007-12-05 10:32:49 +00:00
|
|
|
}
|
|
|
|
|
2011-07-12 12:43:11 +00:00
|
|
|
namespace graphics {
|
|
|
|
class PreviewLoader;
|
|
|
|
}
|
|
|
|
|
2010-09-29 11:55:10 +00:00
|
|
|
|
|
|
|
class Buffer;
|
2010-09-29 12:19:23 +00:00
|
|
|
typedef std::list<Buffer *> ListOfBuffers;
|
2011-11-20 18:49:05 +00:00
|
|
|
/// a list of Buffers we cloned
|
|
|
|
typedef std::set<Buffer *> CloneList;
|
2010-09-29 11:55:10 +00:00
|
|
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/** The buffer object.
|
2005-01-31 16:29:48 +00:00
|
|
|
* This is the buffer object. It contains all the informations about
|
|
|
|
* a document loaded into LyX.
|
2007-04-29 23:33:02 +00:00
|
|
|
* The buffer object owns the Text (wrapped in an InsetText), which
|
2005-01-31 16:29:48 +00:00
|
|
|
* contains the individual paragraphs of the document.
|
|
|
|
*
|
2005-04-26 11:12:20 +00:00
|
|
|
*
|
2005-01-31 16:29:48 +00:00
|
|
|
* I am not sure if the class is complete or
|
|
|
|
* minimal, probably not.
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjønnes
|
2007-10-02 18:27:20 +00:00
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
class Buffer {
|
|
|
|
public:
|
2001-02-16 09:25:43 +00:00
|
|
|
/// What type of log will \c getLogName() return?
|
2001-02-09 15:54:30 +00:00
|
|
|
enum LogType {
|
2001-02-16 09:25:43 +00:00
|
|
|
latexlog, ///< LaTeX log
|
|
|
|
buildlog ///< Literate build log
|
2001-02-09 15:54:30 +00:00
|
|
|
};
|
|
|
|
|
2007-01-13 18:29:50 +00:00
|
|
|
/// Result of \c readFile()
|
|
|
|
enum ReadStatus {
|
2010-10-25 10:18:42 +00:00
|
|
|
ReadSuccess,
|
|
|
|
ReadCancel,
|
2010-10-25 11:57:56 +00:00
|
|
|
// failures
|
2010-10-25 10:18:42 +00:00
|
|
|
ReadFailure,
|
2010-10-25 11:57:56 +00:00
|
|
|
ReadWrongVersion,
|
|
|
|
ReadFileNotFound,
|
|
|
|
ReadVCError,
|
2011-12-03 22:15:11 +00:00
|
|
|
ReadAutosaveFailure,
|
2010-10-25 11:57:56 +00:00
|
|
|
ReadEmergencyFailure,
|
2010-10-25 13:55:39 +00:00
|
|
|
ReadNoLyXFormat,
|
|
|
|
ReadDocumentFailure,
|
|
|
|
// lyx2lyx
|
|
|
|
LyX2LyXNoTempFile,
|
|
|
|
LyX2LyXNotFound,
|
|
|
|
LyX2LyXOlderFormat,
|
|
|
|
LyX2LyXNewerFormat,
|
2010-10-25 11:57:56 +00:00
|
|
|
// other
|
|
|
|
ReadOriginal
|
2007-01-13 18:29:50 +00:00
|
|
|
};
|
|
|
|
|
2011-10-27 20:00:06 +00:00
|
|
|
enum ExportStatus {
|
2011-10-27 20:00:08 +00:00
|
|
|
// export
|
2011-10-27 20:00:06 +00:00
|
|
|
ExportSuccess,
|
2011-10-30 19:52:27 +00:00
|
|
|
ExportCancel,
|
2011-10-27 20:00:06 +00:00
|
|
|
ExportError,
|
|
|
|
ExportNoPathToFormat,
|
|
|
|
ExportTexPathHasSpaces,
|
2011-10-27 20:00:08 +00:00
|
|
|
ExportConverterError,
|
|
|
|
// preview
|
|
|
|
PreviewSuccess,
|
|
|
|
PreviewError
|
2011-10-27 20:00:06 +00:00
|
|
|
};
|
2007-11-30 09:49:35 +00:00
|
|
|
|
2008-10-13 11:25:37 +00:00
|
|
|
/// Method to check if a file is externally modified, used by
|
2007-08-09 20:46:22 +00:00
|
|
|
/// isExternallyModified()
|
|
|
|
/**
|
|
|
|
* timestamp is fast but inaccurate. For example, the granularity
|
|
|
|
* of timestamp on a FAT filesystem is 2 second. Also, various operations
|
|
|
|
* may touch the timestamp of a file even when its content is unchanged.
|
|
|
|
*
|
2008-10-13 11:25:37 +00:00
|
|
|
* checksum is accurate but slow, which can be a problem when it is
|
2007-08-09 20:46:22 +00:00
|
|
|
* frequently used, or used for a large file on a slow (network) file
|
|
|
|
* system.
|
2007-11-30 09:49:35 +00:00
|
|
|
*
|
|
|
|
* FIXME: replace this method with support/FileMonitor.
|
2007-08-09 20:46:22 +00:00
|
|
|
*/
|
|
|
|
enum CheckMethod {
|
2010-12-17 19:56:51 +00:00
|
|
|
checksum_method, ///< Use file checksum
|
|
|
|
timestamp_method ///< Use timestamp, and checksum if timestamp has changed
|
2007-08-09 20:46:22 +00:00
|
|
|
};
|
2008-10-13 11:25:37 +00:00
|
|
|
|
2009-03-26 00:48:32 +00:00
|
|
|
///
|
|
|
|
enum UpdateScope {
|
|
|
|
UpdateMaster,
|
|
|
|
UpdateChildOnly
|
|
|
|
};
|
|
|
|
|
2008-11-17 11:46:07 +00:00
|
|
|
/// Constructor
|
2009-12-18 22:51:06 +00:00
|
|
|
explicit Buffer(std::string const & file, bool readonly = false,
|
|
|
|
Buffer const * cloned_buffer = 0);
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
/// Destructor
|
1999-09-27 18:44:28 +00:00
|
|
|
~Buffer();
|
|
|
|
|
2011-12-03 23:20:18 +00:00
|
|
|
/// Clones the entire structure of which this Buffer is part, starting
|
|
|
|
/// with the master and cloning all the children, too.
|
|
|
|
Buffer * cloneFromMaster() const;
|
|
|
|
/// Just clones this single Buffer. For autosave.
|
|
|
|
Buffer * cloneBufferOnly() const;
|
2009-12-18 22:59:59 +00:00
|
|
|
///
|
|
|
|
bool isClone() const;
|
2009-12-13 21:00:46 +00:00
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
/** High-level interface to buffer functionality.
|
2009-04-06 12:12:06 +00:00
|
|
|
This function parses a command string and executes it.
|
1999-12-16 06:43:25 +00:00
|
|
|
*/
|
2009-04-06 12:12:06 +00:00
|
|
|
void dispatch(std::string const & command, DispatchResult & result);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
/// Maybe we know the function already by number...
|
2009-04-06 12:12:06 +00:00
|
|
|
void dispatch(FuncRequest const & func, DispatchResult & result);
|
|
|
|
|
|
|
|
/// Can this function be exectued?
|
|
|
|
/// \return true if we made a decision
|
|
|
|
bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
2001-07-09 09:16:00 +00:00
|
|
|
///
|
2008-02-09 15:23:05 +00:00
|
|
|
DocIterator getParFromID(int id) const;
|
2003-05-05 17:28:21 +00:00
|
|
|
/// do we have a paragraph with this id?
|
|
|
|
bool hasParWithID(int id) const;
|
2003-03-12 05:46:35 +00:00
|
|
|
|
2007-10-02 09:00:08 +00:00
|
|
|
///
|
2007-10-02 14:39:48 +00:00
|
|
|
frontend::WorkAreaManager & workAreaManager() const;
|
2007-10-02 09:00:08 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/** Save file.
|
2000-02-22 00:36:17 +00:00
|
|
|
Takes care of auto-save files and backup file if requested.
|
2001-02-16 09:25:43 +00:00
|
|
|
Returns \c true if the save is successful, \c false otherwise.
|
2000-02-22 00:36:17 +00:00
|
|
|
*/
|
2000-03-20 14:49:54 +00:00
|
|
|
bool save() const;
|
2010-11-07 21:26:02 +00:00
|
|
|
/// Renames and saves the buffer
|
|
|
|
bool saveAs(support::FileName const & fn);
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2010-12-29 16:57:04 +00:00
|
|
|
/// Write document to stream. Returns \c false if unsuccessful.
|
2007-01-13 18:29:50 +00:00
|
|
|
bool write(std::ostream &) const;
|
2010-12-29 16:57:04 +00:00
|
|
|
/// Write file. Returns \c false if unsuccessful.
|
2006-11-30 16:59:50 +00:00
|
|
|
bool writeFile(support::FileName const &) const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2010-10-26 12:54:31 +00:00
|
|
|
/// \name Functions involved in reading files/strings.
|
|
|
|
//@{
|
2010-11-05 21:21:01 +00:00
|
|
|
/// Loads the LyX file into the buffer. This function
|
2010-10-25 11:57:56 +00:00
|
|
|
/// 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.
|
2010-10-26 13:17:10 +00:00
|
|
|
/// \sa loadThisLyXFile
|
2010-11-05 21:21:01 +00:00
|
|
|
ReadStatus loadLyXFile();
|
|
|
|
/// Loads the LyX file \c fn into the buffer. If you want
|
2010-10-26 13:17:10 +00:00
|
|
|
/// 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);
|
2010-10-26 12:54:31 +00:00
|
|
|
/// read a new document from a string
|
|
|
|
bool readString(std::string const &);
|
|
|
|
/// Reloads the LyX file
|
2010-10-29 16:26:32 +00:00
|
|
|
ReadStatus reload();
|
2010-11-25 16:53:56 +00:00
|
|
|
//FIXME: The following function should be private
|
2010-10-26 12:54:31 +00:00
|
|
|
//private:
|
|
|
|
/// read the header, returns number of unknown tokens
|
|
|
|
int readHeader(Lexer & lex);
|
2010-10-29 23:51:13 +00:00
|
|
|
|
2010-10-26 12:54:31 +00:00
|
|
|
private:
|
2011-05-26 13:20:11 +00:00
|
|
|
///
|
|
|
|
typedef std::map<Buffer const *, Buffer *> BufferMap;
|
|
|
|
///
|
2011-12-03 23:20:18 +00:00
|
|
|
void cloneWithChildren(BufferMap &, CloneList *) const;
|
2010-11-18 18:37:17 +00:00
|
|
|
/// save timestamp and checksum of the given file.
|
2011-12-03 22:15:11 +00:00
|
|
|
void saveCheckSum() const;
|
2010-10-26 13:17:10 +00:00
|
|
|
/// read a new file
|
|
|
|
ReadStatus readFile(support::FileName const & fn);
|
2010-10-26 12:54:31 +00:00
|
|
|
/// Reads a file without header.
|
|
|
|
/// \param par if != 0 insert the file.
|
|
|
|
/// \return \c true if file is not completely read.
|
|
|
|
bool readDocument(Lexer &);
|
2010-10-25 11:57:56 +00:00
|
|
|
/// Try to extract the file from a version control container
|
|
|
|
/// before reading if the file cannot be found. This is only
|
|
|
|
/// implemented for RCS.
|
|
|
|
/// \sa LyXVC::file_not_found_hook
|
2010-11-05 21:21:01 +00:00
|
|
|
ReadStatus extractFromVC();
|
2011-12-03 22:15:11 +00:00
|
|
|
/// Reads the first tag of a LyX File and
|
2010-10-26 12:54:31 +00:00
|
|
|
/// 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
|
2011-12-03 22:15:11 +00:00
|
|
|
ReadStatus convertLyXFormat(support::FileName const & fn,
|
2010-10-26 12:54:31 +00:00
|
|
|
support::FileName & tmpfile, int from_format);
|
|
|
|
//@}
|
|
|
|
|
|
|
|
public:
|
|
|
|
/// \name Functions involved in autosave and emergency files.
|
|
|
|
//@{
|
2010-11-17 02:18:12 +00:00
|
|
|
/// Save an autosave file to #filename.lyx#
|
2011-12-03 22:15:11 +00:00
|
|
|
bool autoSave() const;
|
2010-10-26 12:54:31 +00:00
|
|
|
/// save emergency file
|
|
|
|
/// \return a status message towards the user.
|
|
|
|
docstring emergencyWrite();
|
|
|
|
|
2010-11-17 03:47:14 +00:00
|
|
|
//FIXME:The following function should be private
|
2010-10-26 12:54:31 +00:00
|
|
|
//private:
|
|
|
|
///
|
|
|
|
void removeAutosaveFile() const;
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2010-10-26 12:54:31 +00:00
|
|
|
private:
|
2010-10-26 13:27:06 +00:00
|
|
|
/// Try to load an autosave file associated to \c fn.
|
2010-11-05 21:21:01 +00:00
|
|
|
ReadStatus loadAutosave();
|
2011-12-03 22:15:11 +00:00
|
|
|
/// Try to load an emergency file associated to \c fn.
|
2010-11-05 21:21:01 +00:00
|
|
|
ReadStatus loadEmergency();
|
2010-10-26 12:54:31 +00:00
|
|
|
/// Get the filename of the emergency file associated with the Buffer
|
|
|
|
support::FileName getEmergencyFileName() const;
|
2010-11-17 02:25:12 +00:00
|
|
|
/// Get the filename of the autosave file associated with the Buffer
|
|
|
|
support::FileName getAutosaveFileName() const;
|
2010-11-17 03:47:14 +00:00
|
|
|
///
|
|
|
|
void moveAutosaveFile(support::FileName const & old) const;
|
2010-10-26 12:54:31 +00:00
|
|
|
//@}
|
2007-10-21 10:50:56 +00:00
|
|
|
|
2010-10-26 12:54:31 +00:00
|
|
|
public:
|
2007-10-21 10:50:56 +00:00
|
|
|
/// Fill in the ErrorList with the TeXErrors
|
|
|
|
void bufferErrors(TeXErrors const &, ErrorList &) const;
|
|
|
|
|
2011-10-29 20:14:48 +00:00
|
|
|
enum OutputWhat {
|
|
|
|
FullSource,
|
|
|
|
OnlyBody,
|
2011-10-29 21:00:23 +00:00
|
|
|
OnlyPreamble,
|
|
|
|
CurrentParagraph
|
2011-10-29 20:14:48 +00:00
|
|
|
};
|
|
|
|
|
2007-01-09 19:25:40 +00:00
|
|
|
/// Just a wrapper for writeLaTeXSource, first creating the ofstream.
|
2006-12-04 15:46:57 +00:00
|
|
|
bool makeLaTeXFile(support::FileName const & filename,
|
2011-10-22 15:10:43 +00:00
|
|
|
std::string const & original_path,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const &,
|
2011-10-29 20:14:48 +00:00
|
|
|
OutputWhat output = FullSource) const;
|
2007-01-09 19:25:40 +00:00
|
|
|
/** Export the buffer to LaTeX.
|
2007-01-13 14:36:54 +00:00
|
|
|
If \p os is a file stream, and params().inputenc is "auto" or
|
|
|
|
"default", and the buffer contains text in different languages
|
|
|
|
with more than one encoding, then this method will change the
|
|
|
|
encoding associated to \p os. Therefore you must not call this
|
|
|
|
method with a string stream if the output is supposed to go to a
|
|
|
|
file. \code
|
2008-11-16 12:21:29 +00:00
|
|
|
ofdocstream ofs;
|
2011-02-13 21:41:44 +00:00
|
|
|
otexstream os(ofs, texrow);
|
2007-01-09 19:25:40 +00:00
|
|
|
ofs.open("test.tex");
|
2011-02-13 21:41:44 +00:00
|
|
|
writeLaTeXSource(os, ...);
|
2007-01-09 19:25:40 +00:00
|
|
|
ofs.close();
|
|
|
|
\endcode is NOT equivalent to \code
|
|
|
|
odocstringstream oss;
|
2011-02-13 21:41:44 +00:00
|
|
|
otexstream os(oss, texrow);
|
|
|
|
writeLaTeXSource(os, ...);
|
2008-11-16 12:21:29 +00:00
|
|
|
ofdocstream ofs;
|
2007-01-09 19:25:40 +00:00
|
|
|
ofs.open("test.tex");
|
|
|
|
ofs << oss.str();
|
|
|
|
ofs.close();
|
|
|
|
\endcode
|
|
|
|
*/
|
2011-02-13 21:41:44 +00:00
|
|
|
void writeLaTeXSource(otexstream & os,
|
2011-10-22 15:10:43 +00:00
|
|
|
std::string const & original_path,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const &,
|
2011-10-29 20:14:48 +00:00
|
|
|
OutputWhat output = FullSource) const;
|
2001-11-26 11:08:43 +00:00
|
|
|
///
|
2006-12-04 15:46:57 +00:00
|
|
|
void makeDocBookFile(support::FileName const & filename,
|
2003-11-05 12:06:20 +00:00
|
|
|
OutputParams const & runparams_in,
|
2011-10-29 20:14:48 +00:00
|
|
|
OutputWhat output = FullSource) const;
|
2006-08-04 13:59:12 +00:00
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
void writeDocBookSource(odocstream & os, std::string const & filename,
|
2006-08-04 13:59:12 +00:00
|
|
|
OutputParams const & runparams_in,
|
2011-10-29 20:14:48 +00:00
|
|
|
OutputWhat output = FullSource) const;
|
2009-06-05 17:44:35 +00:00
|
|
|
///
|
|
|
|
void makeLyXHTMLFile(support::FileName const & filename,
|
2011-06-20 21:08:56 +00:00
|
|
|
OutputParams const & runparams_in) const;
|
2009-06-05 17:44:35 +00:00
|
|
|
///
|
|
|
|
void writeLyXHTMLSource(odocstream & os,
|
|
|
|
OutputParams const & runparams_in,
|
2011-10-29 20:14:48 +00:00
|
|
|
OutputWhat output = FullSource) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
/// returns the main language for the buffer (document)
|
2007-10-20 10:03:45 +00:00
|
|
|
Language const * language() const;
|
2003-04-24 23:19:41 +00:00
|
|
|
/// get l10n translated to the buffers language
|
2006-10-21 00:16:43 +00:00
|
|
|
docstring const B_(std::string const & l10n) const;
|
2003-04-24 23:19:41 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2001-11-07 13:22:43 +00:00
|
|
|
int runChktex();
|
2002-08-04 23:11:50 +00:00
|
|
|
/// return true if the main lyx file does not need saving
|
|
|
|
bool isClean() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
bool isDepClean(std::string const & name) const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2007-08-09 20:46:22 +00:00
|
|
|
/// whether or not disk file has been externally modified
|
|
|
|
bool isExternallyModified(CheckMethod method) const;
|
|
|
|
|
2002-08-04 23:11:50 +00:00
|
|
|
/// mark the main lyx file as not needing saving
|
|
|
|
void markClean() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
void markDepClean(std::string const & name);
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2000-07-26 13:43:16 +00:00
|
|
|
///
|
2001-05-09 09:14:50 +00:00
|
|
|
void setUnnamed(bool flag = true);
|
2000-07-26 13:43:16 +00:00
|
|
|
|
2009-09-08 01:29:07 +00:00
|
|
|
/// Whether or not a filename has been assigned to this buffer
|
2004-02-25 12:00:53 +00:00
|
|
|
bool isUnnamed() const;
|
2000-07-26 13:43:16 +00:00
|
|
|
|
2009-09-08 01:29:07 +00:00
|
|
|
/// Whether or not this buffer is internal.
|
|
|
|
///
|
|
|
|
/// An internal buffer does not contain a real document, but some auxiliary text segment.
|
|
|
|
/// It is not associated with a filename, it is never saved, thus it does not need to be
|
|
|
|
/// automatically saved, nor it needs to trigger any "do you want to save ?" question.
|
|
|
|
bool isInternal() const;
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/// Mark this buffer as dirty.
|
|
|
|
void markDirty();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2007-11-03 17:37:37 +00:00
|
|
|
/// Returns the buffer's filename. It is always an absolute path.
|
|
|
|
support::FileName fileName() const;
|
|
|
|
|
2002-01-14 23:31:23 +00:00
|
|
|
/// Returns the buffer's filename. It is always an absolute path.
|
2007-10-20 10:03:45 +00:00
|
|
|
std::string absFileName() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2002-01-14 23:31:23 +00:00
|
|
|
/// Returns the the path where the buffer lives.
|
2002-03-21 16:55:34 +00:00
|
|
|
/// It is always an absolute path.
|
2007-11-28 15:25:07 +00:00
|
|
|
std::string filePath() const;
|
2002-01-14 23:31:23 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/** A transformed version of the file name, adequate for LaTeX.
|
|
|
|
\param no_path optional if \c true then the path is stripped.
|
2000-08-07 20:58:24 +00:00
|
|
|
*/
|
2007-10-20 10:03:45 +00:00
|
|
|
std::string latexName(bool no_path = true) const;
|
1999-12-03 13:51:01 +00:00
|
|
|
|
2009-06-21 09:44:10 +00:00
|
|
|
/// Get the name and type of the log.
|
2007-11-01 22:17:22 +00:00
|
|
|
std::string logName(LogType * type = 0) const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2007-11-30 17:41:27 +00:00
|
|
|
/// Set document's parent Buffer.
|
|
|
|
void setParent(Buffer const *);
|
2008-11-16 21:28:06 +00:00
|
|
|
Buffer const * parent() const;
|
|
|
|
|
2004-03-25 10:12:44 +00:00
|
|
|
/** Get the document's master (or \c this if this is not a
|
|
|
|
child document)
|
|
|
|
*/
|
2007-10-20 10:03:45 +00:00
|
|
|
Buffer const * masterBuffer() const;
|
2004-03-25 10:12:44 +00:00
|
|
|
|
2008-07-20 17:52:55 +00:00
|
|
|
/// \return true if \p child is a child of this \c Buffer.
|
|
|
|
bool isChild(Buffer * child) const;
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2010-09-29 12:17:24 +00:00
|
|
|
/// \return true if this \c Buffer has children
|
|
|
|
bool hasChildren() const;
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2010-09-29 13:05:57 +00:00
|
|
|
/// \return a list of the direct children of this Buffer.
|
|
|
|
/// this list has no duplicates and is in the order in which
|
|
|
|
/// the children appear.
|
|
|
|
ListOfBuffers getChildren() const;
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2010-09-29 13:05:57 +00:00
|
|
|
/// \return a list of all descendents of this Buffer (children,
|
|
|
|
/// grandchildren, etc). this list has no duplicates and is in
|
|
|
|
/// the order in which the children appear.
|
|
|
|
ListOfBuffers getDescendents() const;
|
2008-07-20 17:52:55 +00:00
|
|
|
|
2010-09-29 13:05:57 +00:00
|
|
|
/// Collect all relative buffers, in the order in which they appear.
|
|
|
|
/// I.e., the "root" Buffer is first, then its first child, then any
|
|
|
|
/// of its children, etc. However, there are no duplicates in this
|
|
|
|
/// list.
|
|
|
|
/// This is "stable", too, in the sense that it returns the same
|
|
|
|
/// thing from whichever Buffer it is called.
|
|
|
|
ListOfBuffers allRelatives() const;
|
2009-12-30 18:40:18 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
/// Is buffer read-only?
|
2001-02-16 09:25:43 +00:00
|
|
|
bool isReadonly() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/// Set buffer read-only flag
|
2009-10-25 13:56:44 +00:00
|
|
|
void setReadonly(bool flag = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
/** Validate a buffer for LaTeX.
|
1999-12-16 06:43:25 +00:00
|
|
|
This validates the buffer, and returns a struct for use by
|
2000-08-07 20:58:24 +00:00
|
|
|
#makeLaTeX# and others. Its main use is to figure out what
|
2000-04-11 22:55:29 +00:00
|
|
|
commands and packages need to be included in the LaTeX file.
|
|
|
|
It (should) also check that the needed constructs are there
|
|
|
|
(i.e. that the \refs points to coresponding \labels). It
|
|
|
|
should perhaps inset "error" insets to help the user correct
|
|
|
|
obvious mistakes.
|
1999-12-16 06:43:25 +00:00
|
|
|
*/
|
2000-02-04 09:38:32 +00:00
|
|
|
void validate(LaTeXFeatures &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2010-08-10 14:26:34 +00:00
|
|
|
/// Reference information is cached in the Buffer, so we do not
|
2011-12-03 22:15:11 +00:00
|
|
|
/// have to check or read things over and over.
|
2010-08-10 14:26:34 +00:00
|
|
|
///
|
|
|
|
/// There are two caches.
|
|
|
|
///
|
|
|
|
/// One is a cache of the BibTeX files from which reference info is
|
|
|
|
/// being gathered. This cache is PER BUFFER, and the cache for the
|
|
|
|
/// master essentially includes the cache for its children. This gets
|
|
|
|
/// invalidated when an InsetBibtex is created, deleted, or modified.
|
2011-12-03 22:15:11 +00:00
|
|
|
///
|
2010-08-10 14:26:34 +00:00
|
|
|
/// The other is a cache of the reference information itself. This
|
|
|
|
/// exists only in the master buffer, and when it needs to be updated,
|
|
|
|
/// the children add their information to the master's cache.
|
2011-12-03 22:15:11 +00:00
|
|
|
|
2010-01-11 16:29:26 +00:00
|
|
|
/// Calling this method invalidates the cache and so requires a
|
|
|
|
/// re-read.
|
2010-08-10 14:12:48 +00:00
|
|
|
void invalidateBibinfoCache() const;
|
2010-08-09 17:01:51 +00:00
|
|
|
/// This invalidates the cache of files we need to check.
|
2010-08-10 14:12:48 +00:00
|
|
|
void invalidateBibfileCache() const;
|
2010-12-03 19:00:55 +00:00
|
|
|
/// Updates the cached bibliography information, checking first to see
|
|
|
|
/// whether the cache is valid. If so, we do nothing. If not, then we
|
|
|
|
/// reload all the BibTeX info.
|
2010-08-10 14:12:48 +00:00
|
|
|
/// Note that this operates on the master document.
|
2010-12-03 19:00:55 +00:00
|
|
|
void reloadBibInfoCache() const;
|
2008-04-25 20:03:03 +00:00
|
|
|
/// \return the bibliography information for this buffer's master,
|
|
|
|
/// or just for it, if it isn't a child.
|
|
|
|
BiblioInfo const & masterBibInfo() const;
|
2010-12-03 20:08:04 +00:00
|
|
|
/// collect bibliography info from the various insets in this buffer.
|
|
|
|
void collectBibKeys() const;
|
|
|
|
/// add some BiblioInfo to our cache
|
|
|
|
void addBiblioInfo(BiblioInfo const & bi) const;
|
|
|
|
/// add a single piece of bibliography info to our cache
|
|
|
|
void addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
///
|
2011-05-07 23:02:53 +00:00
|
|
|
bool citeLabelsValid() const;
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
void getLabelList(std::vector<docstring> &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2011-12-03 22:58:38 +00:00
|
|
|
/// This removes the .aux and .bbl files from the temp dir.
|
|
|
|
void removeBiblioTempFiles() const;
|
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
void changeLanguage(Language const * from, Language const * to);
|
2003-04-25 01:54:04 +00:00
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
///
|
2004-02-25 12:00:53 +00:00
|
|
|
bool isMultiLingual() const;
|
2010-02-08 17:15:00 +00:00
|
|
|
///
|
|
|
|
std::set<Language const *> getLanguages() const;
|
2000-04-10 21:40:13 +00:00
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
///
|
2003-09-09 09:47:59 +00:00
|
|
|
BufferParams & params();
|
|
|
|
BufferParams const & params() const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/** The list of paragraphs.
|
|
|
|
This is a linked list of paragraph, this list holds the
|
|
|
|
whole contents of the document.
|
1999-09-27 18:44:28 +00:00
|
|
|
*/
|
2003-09-09 09:47:59 +00:00
|
|
|
ParagraphList & paragraphs();
|
|
|
|
ParagraphList const & paragraphs() const;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/// LyX version control object.
|
2003-09-09 09:47:59 +00:00
|
|
|
LyXVC & lyxvc();
|
|
|
|
LyXVC const & lyxvc() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
/// Where to put temporary files.
|
2007-12-17 18:37:13 +00:00
|
|
|
std::string const temppath() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
2000-01-08 21:02:58 +00:00
|
|
|
/// Used when typesetting to place errorboxes.
|
2003-09-09 09:47:59 +00:00
|
|
|
TexRow const & texrow() const;
|
2008-11-16 00:12:21 +00:00
|
|
|
TexRow & texrow();
|
2003-02-08 19:18:01 +00:00
|
|
|
|
2001-09-01 21:26:34 +00:00
|
|
|
///
|
|
|
|
ParIterator par_iterator_begin();
|
|
|
|
///
|
2002-11-08 01:08:27 +00:00
|
|
|
ParConstIterator par_iterator_begin() const;
|
|
|
|
///
|
2001-09-01 21:26:34 +00:00
|
|
|
ParIterator par_iterator_end();
|
2002-11-08 01:08:27 +00:00
|
|
|
///
|
|
|
|
ParConstIterator par_iterator_end() const;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
2008-11-16 21:28:06 +00:00
|
|
|
// Position of the child buffer where it appears first in the master.
|
|
|
|
DocIterator firstChildPosition(Buffer const * child);
|
|
|
|
|
2003-10-22 13:15:18 +00:00
|
|
|
/** \returns true only when the file is fully loaded.
|
|
|
|
* Used to prevent the premature generation of previews
|
|
|
|
* and by the citation inset.
|
|
|
|
*/
|
2007-10-20 10:03:45 +00:00
|
|
|
bool isFullyLoaded() const;
|
2003-10-22 14:40:24 +00:00
|
|
|
/// Set by buffer_funcs' newFile.
|
2007-10-20 10:03:45 +00:00
|
|
|
void setFullyLoaded(bool);
|
2003-10-22 13:15:18 +00:00
|
|
|
|
2011-07-12 12:43:11 +00:00
|
|
|
/// FIXME: Needed by RenderPreview.
|
2011-07-12 13:41:42 +00:00
|
|
|
graphics::PreviewLoader * loader() const;
|
2010-10-29 20:00:51 +00:00
|
|
|
/// Update the LaTeX preview snippets associated with this buffer
|
|
|
|
void updatePreviews() const;
|
|
|
|
/// Remove any previewed LaTeX snippets associated with this buffer
|
|
|
|
void removePreviews() const;
|
|
|
|
|
2005-07-17 14:29:35 +00:00
|
|
|
/// Our main text (inside the top InsetText)
|
2007-04-29 23:33:02 +00:00
|
|
|
Text & text() const;
|
2005-07-17 14:29:35 +00:00
|
|
|
|
2007-10-20 10:03:45 +00:00
|
|
|
/// Our top InsetText
|
2007-04-29 13:39:47 +00:00
|
|
|
Inset & inset() const;
|
2003-11-28 15:08:38 +00:00
|
|
|
|
2004-04-13 06:27:29 +00:00
|
|
|
//
|
|
|
|
// Macro handling
|
|
|
|
//
|
2007-12-21 20:42:46 +00:00
|
|
|
/// Collect macro definitions in paragraphs
|
2010-07-21 21:58:54 +00:00
|
|
|
void updateMacros() const;
|
2007-12-21 20:42:46 +00:00
|
|
|
/// Iterate through the whole buffer and try to resolve macros
|
2011-05-07 11:57:08 +00:00
|
|
|
void updateMacroInstances(UpdateType) const;
|
2007-12-21 20:42:46 +00:00
|
|
|
|
2008-03-26 12:55:36 +00:00
|
|
|
/// List macro names of this buffer, the parent and the children
|
2007-12-21 20:42:46 +00:00
|
|
|
void listMacroNames(MacroNameSet & macros) const;
|
2008-03-26 12:55:36 +00:00
|
|
|
/// Collect macros of the parent and its children in front of this buffer.
|
|
|
|
void listParentMacros(MacroSet & macros, LaTeXFeatures & features) const;
|
2007-12-21 20:42:46 +00:00
|
|
|
|
|
|
|
/// Return macro defined before pos (or in the master buffer)
|
|
|
|
MacroData const * getMacro(docstring const & name, DocIterator const & pos, bool global = true) const;
|
2007-11-01 11:13:07 +00:00
|
|
|
/// Return macro defined anywhere in the buffer (or in the master buffer)
|
2007-12-21 20:42:46 +00:00
|
|
|
MacroData const * getMacro(docstring const & name, bool global = true) const;
|
|
|
|
/// Return macro defined before the inclusion of the child
|
|
|
|
MacroData const * getMacro(docstring const & name, Buffer const & child, bool global = true) const;
|
2006-10-22 10:15:23 +00:00
|
|
|
|
2010-12-20 18:15:39 +00:00
|
|
|
/// Collect user macro names at loading time
|
|
|
|
typedef std::set<docstring> UserMacroSet;
|
2010-12-21 14:52:18 +00:00
|
|
|
mutable UserMacroSet usermacros;
|
2010-12-20 18:15:39 +00:00
|
|
|
|
2007-10-13 09:04:52 +00:00
|
|
|
/// Replace the inset contents for insets which InsetCode is equal
|
2007-10-11 12:48:24 +00:00
|
|
|
/// to the passed \p inset_code.
|
2006-10-22 11:00:04 +00:00
|
|
|
void changeRefsIfUnique(docstring const & from, docstring const & to,
|
2007-10-13 09:11:10 +00:00
|
|
|
InsetCode code);
|
2007-10-11 12:48:24 +00:00
|
|
|
|
2007-10-20 10:03:45 +00:00
|
|
|
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
|
|
|
|
/// including preamble
|
2010-12-10 10:34:24 +00:00
|
|
|
void getSourceCode(odocstream & os, std::string const format,
|
2011-10-29 21:00:23 +00:00
|
|
|
pit_type par_begin, pit_type par_end, OutputWhat output) const;
|
2004-04-13 06:27:29 +00:00
|
|
|
|
2007-11-30 17:41:27 +00:00
|
|
|
/// Access to error list.
|
|
|
|
/// This method is used only for GUI visualisation of Buffer related
|
|
|
|
/// errors (like parsing or LateX compilation). This method is const
|
|
|
|
/// because modifying the returned ErrorList does not touch the document
|
|
|
|
/// contents.
|
2011-06-12 18:03:32 +00:00
|
|
|
ErrorList & errorList(std::string const & type) const;
|
2007-11-30 17:41:27 +00:00
|
|
|
|
|
|
|
/// The Toc backend.
|
|
|
|
/// This is useful only for screen visualisation of the Buffer. This
|
|
|
|
/// method is const because modifying this backend does not touch
|
|
|
|
/// the document contents.
|
|
|
|
TocBackend & tocBackend() const;
|
2007-10-18 11:51:17 +00:00
|
|
|
|
2008-04-20 03:08:11 +00:00
|
|
|
///
|
2007-10-18 11:51:17 +00:00
|
|
|
Undo & undo();
|
2008-04-20 03:08:11 +00:00
|
|
|
|
2007-10-02 18:27:20 +00:00
|
|
|
/// This function is called when the buffer is changed.
|
2010-01-08 02:03:54 +00:00
|
|
|
void changed(bool update_metrics) const;
|
2008-09-30 09:50:54 +00:00
|
|
|
///
|
2010-01-09 14:47:47 +00:00
|
|
|
void setChild(DocIterator const & dit, Buffer * child);
|
|
|
|
///
|
2008-09-30 09:50:54 +00:00
|
|
|
void updateTocItem(std::string const &, DocIterator const &) const;
|
2007-10-02 18:27:20 +00:00
|
|
|
/// This function is called when the buffer structure is changed.
|
|
|
|
void structureChanged() const;
|
|
|
|
/// This function is called when some parsing error shows up.
|
2009-06-21 12:26:41 +00:00
|
|
|
void errors(std::string const & err, bool from_master = false) const;
|
2007-10-02 18:27:20 +00:00
|
|
|
/// This function is called when the buffer busy status change.
|
2007-10-21 10:50:56 +00:00
|
|
|
void setBusy(bool on) const;
|
2007-10-02 18:27:20 +00:00
|
|
|
/// Update window titles of all users.
|
|
|
|
void updateTitles() const;
|
|
|
|
/// Reset autosave timers for all users.
|
|
|
|
void resetAutosaveTimers() const;
|
|
|
|
///
|
|
|
|
void message(docstring const & msg) const;
|
|
|
|
|
2009-02-19 00:29:04 +00:00
|
|
|
///
|
2007-10-02 18:27:20 +00:00
|
|
|
void setGuiDelegate(frontend::GuiBufferDelegate * gui);
|
2009-02-19 00:29:04 +00:00
|
|
|
///
|
2009-02-19 04:05:44 +00:00
|
|
|
bool hasGuiDelegate() const;
|
2007-10-02 18:27:20 +00:00
|
|
|
|
2011-10-27 15:50:50 +00:00
|
|
|
///
|
2011-10-27 20:00:11 +00:00
|
|
|
ExportStatus doExport(std::string const & target, bool put_in_tempdir) const;
|
2011-10-27 15:50:50 +00:00
|
|
|
///
|
2011-10-30 08:53:20 +00:00
|
|
|
ExportStatus doExport(std::string const & target, bool put_in_tempdir,
|
|
|
|
std::string & result_file) const;
|
|
|
|
///
|
2011-10-27 20:00:11 +00:00
|
|
|
ExportStatus preview(std::string const & format) const;
|
2007-11-30 17:41:27 +00:00
|
|
|
|
2011-10-27 15:50:50 +00:00
|
|
|
private:
|
2011-09-15 01:07:49 +00:00
|
|
|
/// target is a format name optionally followed by a space
|
|
|
|
/// and a destination file-name
|
2011-10-27 20:00:06 +00:00
|
|
|
ExportStatus doExport(std::string const & target, bool put_in_tempdir,
|
2010-01-10 13:25:41 +00:00
|
|
|
bool includeall, std::string & result_file) const;
|
2007-10-20 10:51:13 +00:00
|
|
|
///
|
2011-10-27 20:00:06 +00:00
|
|
|
ExportStatus doExport(std::string const & target, bool put_in_tempdir,
|
2011-10-27 15:50:50 +00:00
|
|
|
bool includeall) const;
|
2007-10-20 10:51:13 +00:00
|
|
|
///
|
2011-10-27 20:00:08 +00:00
|
|
|
ExportStatus preview(std::string const & format, bool includeall = false) const;
|
2011-10-27 15:50:50 +00:00
|
|
|
|
|
|
|
public:
|
2010-07-21 21:51:33 +00:00
|
|
|
///
|
|
|
|
bool isExporting() const;
|
2008-03-02 15:27:35 +00:00
|
|
|
|
|
|
|
///
|
2010-01-28 17:37:22 +00:00
|
|
|
typedef std::vector<std::pair<Inset *, ParIterator> > References;
|
2008-03-02 15:27:35 +00:00
|
|
|
References & references(docstring const & label);
|
|
|
|
References const & references(docstring const & label) const;
|
|
|
|
void clearReferenceCache() const;
|
|
|
|
void setInsetLabel(docstring const & label, InsetLabel const * il);
|
|
|
|
InsetLabel const * insetLabel(docstring const & label) const;
|
|
|
|
|
2009-07-09 09:48:34 +00:00
|
|
|
/// return a list of all used branches (also in children)
|
|
|
|
void getUsedBranches(std::list<docstring> &, bool const from_master = false) const;
|
|
|
|
|
2009-03-12 20:10:46 +00:00
|
|
|
/// sets the buffer_ member for every inset in this buffer.
|
|
|
|
// FIXME This really shouldn't be needed, but at the moment it's not
|
|
|
|
// clear how to do it just for the individual pieces we need.
|
|
|
|
void setBuffersForInsets() const;
|
2009-12-10 13:25:31 +00:00
|
|
|
/// Updates screen labels and some other information associated with
|
|
|
|
/// insets and paragraphs. Actually, it's more like a general "recurse
|
|
|
|
/// through the Buffer" routine, that visits all the insets and paragraphs.
|
2010-03-03 22:13:45 +00:00
|
|
|
void updateBuffer() const { updateBuffer(UpdateMaster, InternalUpdate); }
|
2009-12-10 13:25:31 +00:00
|
|
|
/// \param scope: whether to start with the master document or just
|
|
|
|
/// do this one.
|
|
|
|
/// \param output: whether we are preparing for output.
|
2010-03-03 22:13:45 +00:00
|
|
|
void updateBuffer(UpdateScope scope, UpdateType utype) const;
|
2011-12-03 22:15:11 +00:00
|
|
|
///
|
2010-03-03 22:13:45 +00:00
|
|
|
void updateBuffer(ParIterator & parit, UpdateType utype) const;
|
2008-11-16 16:43:49 +00:00
|
|
|
|
2009-06-22 16:38:11 +00:00
|
|
|
/// Spellcheck starting from \p from.
|
|
|
|
/// \p from initial position, will then points to the next misspelled
|
2009-03-28 19:02:49 +00:00
|
|
|
/// word.
|
2009-06-22 16:38:11 +00:00
|
|
|
/// \p to will points to the end of the next misspelled word.
|
|
|
|
/// \p word_lang will contain the found misspelled word.
|
|
|
|
/// \return progress if a new word was found.
|
2009-04-04 16:40:47 +00:00
|
|
|
int spellCheck(DocIterator & from, DocIterator & to,
|
|
|
|
WordLangTuple & word_lang, docstring_list & suggestions) const;
|
2010-03-09 03:25:47 +00:00
|
|
|
///
|
|
|
|
void checkChildBuffers();
|
2009-04-04 16:40:47 +00:00
|
|
|
|
2003-09-09 11:24:33 +00:00
|
|
|
private:
|
2011-10-30 11:43:45 +00:00
|
|
|
class MarkAsExporting;
|
|
|
|
friend class MarkAsExporting;
|
|
|
|
/// mark the buffer as busy exporting something, or not
|
|
|
|
void setExportStatus(bool e) const;
|
|
|
|
|
2010-11-18 17:50:33 +00:00
|
|
|
/// Change name of buffer. Updates "read-only" flag.
|
|
|
|
void setFileName(support::FileName const & fname);
|
2007-10-20 10:51:13 +00:00
|
|
|
///
|
2010-02-08 17:15:00 +00:00
|
|
|
void getLanguages(std::set<Language const *> &) const;
|
2010-12-03 19:00:55 +00:00
|
|
|
/// Checks whether any of the referenced bibfiles have changed since the
|
|
|
|
/// last time we loaded the cache. Note that this does NOT update the
|
|
|
|
/// cached information.
|
|
|
|
void checkIfBibInfoCacheIsValid() const;
|
2010-08-09 17:01:51 +00:00
|
|
|
/// Update the list of all bibfiles in use (including bibfiles
|
|
|
|
/// of loaded child documents).
|
|
|
|
void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
2010-08-09 17:14:45 +00:00
|
|
|
/// Return the list with all bibfiles in use (including bibfiles
|
|
|
|
/// of loaded child documents).
|
2011-12-03 22:15:11 +00:00
|
|
|
support::FileNameList const &
|
2010-08-09 17:14:45 +00:00
|
|
|
getBibfilesCache(UpdateScope scope = UpdateMaster) const;
|
2010-09-29 13:05:57 +00:00
|
|
|
///
|
|
|
|
void collectChildren(ListOfBuffers & children, bool grand_children) const;
|
2003-09-09 11:24:33 +00:00
|
|
|
|
2011-08-24 19:10:40 +00:00
|
|
|
/// noncopyable
|
|
|
|
Buffer(Buffer const &);
|
|
|
|
void operator=(Buffer const &);
|
|
|
|
|
2003-09-09 11:24:33 +00:00
|
|
|
/// Use the Pimpl idiom to hide the internals.
|
|
|
|
class Impl;
|
|
|
|
/// The pointer never changes although *pimpl_'s contents may.
|
2007-11-30 17:46:49 +00:00
|
|
|
Impl * const d;
|
1999-09-27 18:44:28 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
#endif
|