1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
2003-05-22 18:59:10 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file buffer.h
|
|
|
|
|
* 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
|
|
|
|
*
|
2003-05-22 18:59:10 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>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
|
|
|
|
|
2006-07-15 22:43:37 +00:00
|
|
|
|
#include "errorlist.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "InsetList.h"
|
|
|
|
|
|
2005-07-17 14:29:35 +00:00
|
|
|
|
#include "dociterator.h"
|
2006-03-23 20:11:06 +00:00
|
|
|
|
#include "ParagraphList_fwd.h"
|
2005-07-17 14:29:35 +00:00
|
|
|
|
|
2006-12-01 20:09:08 +00:00
|
|
|
|
#include "support/filename.h"
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include "support/limited_stack.h"
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "support/types.h"
|
2006-09-09 11:16:28 +00:00
|
|
|
|
#include "support/docstring.h"
|
2006-10-19 21:00:33 +00:00
|
|
|
|
#include "support/docstream.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2003-04-24 23:19:41 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2004-09-26 14:19:47 +00:00
|
|
|
|
#include <boost/signal.hpp>
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include <iosfwd>
|
2006-04-15 11:46:17 +00:00
|
|
|
|
#include <string>
|
2003-09-06 18:38:02 +00:00
|
|
|
|
#include <map>
|
|
|
|
|
#include <utility>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2003-09-09 11:24:33 +00:00
|
|
|
|
class BufferParams;
|
2003-09-06 18:38:02 +00:00
|
|
|
|
class ErrorItem;
|
2003-09-21 23:00:47 +00:00
|
|
|
|
class FuncRequest;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
class InsetBase;
|
2004-03-18 12:53:43 +00:00
|
|
|
|
class InsetText;
|
2003-09-09 11:24:33 +00:00
|
|
|
|
class LyXFont;
|
|
|
|
|
class LyXLex;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class LyXRC;
|
2003-11-28 15:08:38 +00:00
|
|
|
|
class LyXText;
|
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;
|
2004-01-26 10:13:15 +00:00
|
|
|
|
class OutputParams;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
class ParConstIterator;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
class ParIterator;
|
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;
|
2005-07-17 14:29:35 +00:00
|
|
|
|
class StableDocIterator;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-08-03 18:28:11 +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.
|
2005-04-26 11:12:20 +00:00
|
|
|
|
* The buffer object owns the LyXText (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.
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
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 {
|
|
|
|
|
failure, ///< The file could not be read
|
|
|
|
|
success, ///< The file could not be read
|
|
|
|
|
wrongversion ///< The version of the file does not match ours
|
|
|
|
|
};
|
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/** Constructor
|
|
|
|
|
\param file
|
|
|
|
|
\param b optional \c false by default
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
explicit Buffer(std::string const & file, bool b = false);
|
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();
|
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/** High-level interface to buffer functionality.
|
1999-12-16 06:43:25 +00:00
|
|
|
|
This function parses a command string and executes it
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool dispatch(std::string const & command, bool * result = 0);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
|
|
/// Maybe we know the function already by number...
|
2003-09-21 23:00:47 +00:00
|
|
|
|
bool dispatch(FuncRequest const & func, bool * result = 0);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Load the autosaved file.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
void loadAutoSaveFile();
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
2007-01-13 18:29:50 +00:00
|
|
|
|
/// read a new document from a string
|
|
|
|
|
bool readString(std::string const &);
|
2003-03-12 05:46:35 +00:00
|
|
|
|
/// load a new file
|
2006-12-17 12:12:17 +00:00
|
|
|
|
bool readFile(support::FileName const & filename);
|
2003-09-02 08:26:20 +00:00
|
|
|
|
|
2003-03-12 02:39:12 +00:00
|
|
|
|
/// read the header, returns number of unknown tokens
|
|
|
|
|
int readHeader(LyXLex & lex);
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/** Reads a file without header.
|
2001-02-16 09:25:43 +00:00
|
|
|
|
\param par if != 0 insert the file.
|
|
|
|
|
\return \c false if file is not completely read.
|
2000-08-07 20:58:24 +00:00
|
|
|
|
*/
|
2004-08-14 18:41:27 +00:00
|
|
|
|
bool readDocument(LyXLex &);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2001-07-08 12:52:16 +00:00
|
|
|
|
///
|
2004-03-25 09:16:36 +00:00
|
|
|
|
void insertStringAsLines(ParagraphList & plist,
|
2006-10-21 00:16:43 +00:00
|
|
|
|
pit_type &, pos_type &,
|
|
|
|
|
LyXFont const &, docstring const &, bool);
|
2001-07-09 09:16:00 +00:00
|
|
|
|
///
|
2003-05-22 08:01:41 +00:00
|
|
|
|
ParIterator 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
|
|
|
|
|
2006-10-22 10:51:59 +00:00
|
|
|
|
/// This signal is emitted when the buffer is changed.
|
2006-11-20 14:42:18 +00:00
|
|
|
|
boost::signal<void()> changed;
|
2006-07-15 22:43:37 +00:00
|
|
|
|
/// This signal is emitted when some parsing error shows up.
|
|
|
|
|
boost::signal<void(std::string)> errors;
|
2003-07-07 08:37:02 +00:00
|
|
|
|
/// This signal is emitted when some message shows up.
|
2006-10-21 00:16:43 +00:00
|
|
|
|
boost::signal<void(docstring)> message;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// This signal is emitted when the buffer busy status change.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void(bool)> busy;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// This signal is emitted when the buffer readonly status change.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void(bool)> readonly;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// Update window titles of all users.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void()> updateTitles;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// Reset autosave timers for all users.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void()> resetAutosaveTimers;
|
2003-07-11 12:21:31 +00:00
|
|
|
|
/// This signal is emitting if the buffer is being closed.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void()> closing;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
|
2003-06-20 23:03:43 +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;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
2007-01-13 18:29:50 +00:00
|
|
|
|
/// Write document to stream. Returns \c false if unsuccesful.
|
|
|
|
|
bool write(std::ostream &) const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Write file. Returns \c false if unsuccesful.
|
2006-11-30 16:59:50 +00:00
|
|
|
|
bool writeFile(support::FileName const &) const;
|
2002-03-21 16:55:34 +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,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & original_path,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &,
|
2003-07-26 21:37:10 +00:00
|
|
|
|
bool output_preamble = true,
|
|
|
|
|
bool output_body = true);
|
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
|
2007-01-09 19:25:40 +00:00
|
|
|
|
odocfstream ofs;
|
|
|
|
|
ofs.open("test.tex");
|
|
|
|
|
writeLaTeXSource(ofs, ...);
|
|
|
|
|
ofs.close();
|
|
|
|
|
\endcode is NOT equivalent to \code
|
|
|
|
|
odocstringstream oss;
|
|
|
|
|
writeLaTeXSource(oss, ...);
|
|
|
|
|
odocfstream ofs;
|
|
|
|
|
ofs.open("test.tex");
|
|
|
|
|
ofs << oss.str();
|
|
|
|
|
ofs.close();
|
|
|
|
|
\endcode
|
|
|
|
|
*/
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void writeLaTeXSource(odocstream & os,
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & original_path,
|
2003-11-05 12:06:20 +00:00
|
|
|
|
OutputParams const &,
|
2003-07-26 21:37:10 +00:00
|
|
|
|
bool output_preamble = true,
|
|
|
|
|
bool output_body = true);
|
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,
|
2003-10-31 18:45:43 +00:00
|
|
|
|
bool only_body = false);
|
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,
|
|
|
|
|
bool only_body = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// returns the main language for the buffer (document)
|
2001-06-28 10:25:20 +00:00
|
|
|
|
Language const * getLanguage() 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
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
|
bool isBakClean() 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
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
|
void markBakClean();
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
///
|
2004-02-25 12:00:53 +00:00
|
|
|
|
bool isUnnamed() const;
|
2000-07-26 13:43:16 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Mark this buffer as dirty.
|
|
|
|
|
void markDirty();
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2002-01-14 23:31:23 +00:00
|
|
|
|
/// Returns the buffer's filename. It is always an absolute path.
|
2006-11-30 16:59:50 +00:00
|
|
|
|
std::string const fileName() 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.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const & 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
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string const getLatexName(bool no_path = true) const;
|
1999-12-03 13:51:01 +00:00
|
|
|
|
|
2006-10-22 10:15:23 +00:00
|
|
|
|
/// Get thee name and type of the log.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::pair<LogType, std::string> const getLogName() const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Change name of buffer. Updates "read-only" flag.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setFileName(std::string const & newfile);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// Name of the document's parent
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void setParentName(std::string const &);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2004-03-25 10:12:44 +00:00
|
|
|
|
/** Get the document's master (or \c this if this is not a
|
|
|
|
|
child document)
|
|
|
|
|
*/
|
|
|
|
|
Buffer const * getMasterBuffer() const;
|
2006-04-15 11:46:17 +00:00
|
|
|
|
/** Get the document's master (or \c this if this is not a
|
|
|
|
|
child document)
|
|
|
|
|
*/
|
|
|
|
|
Buffer * getMasterBuffer();
|
2004-03-25 10:12:44 +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
|
2000-04-08 17:02:02 +00:00
|
|
|
|
void setReadonly(bool flag = true);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// returns \c true if the buffer contains a LaTeX document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isLatex() const;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// returns \c true if the buffer contains a DocBook document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isDocBook() const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
/// returns \c true if the buffer contains a Wed document
|
|
|
|
|
bool isLiterate() const;
|
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
|
|
|
|
|
2003-02-18 13:25:18 +00:00
|
|
|
|
/// return all bibkeys from buffer and its childs
|
2006-12-17 10:52:04 +00:00
|
|
|
|
void fillWithBibKeys(std::vector<std::pair<std::string, docstring> > & keys) const;
|
2006-04-15 11:46:17 +00:00
|
|
|
|
/// Update the cache with all bibfiles in use (including bibfiles
|
2006-05-19 07:21:43 +00:00
|
|
|
|
/// of loaded child documents).
|
2006-04-15 11:46:17 +00:00
|
|
|
|
void updateBibfilesCache();
|
|
|
|
|
/// Return the cache with all bibfiles in use (including bibfiles
|
2006-05-19 07:21:43 +00:00
|
|
|
|
/// of loaded child documents).
|
2006-12-01 20:09:08 +00:00
|
|
|
|
std::vector<support::FileName> const & getBibfilesCache() const;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void getLabelList(std::vector<docstring> &) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void updateDocLang(Language const * nlang);
|
|
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
|
///
|
2004-02-25 12:00:53 +00:00
|
|
|
|
bool isMultiLingual() const;
|
2000-04-10 21:40:13 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Does this mean that this is buffer local?
|
2003-09-09 09:47:59 +00:00
|
|
|
|
limited_stack<Undo> & undostack();
|
|
|
|
|
limited_stack<Undo> const & undostack() const;
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
|
|
|
|
/// Does this mean that this is buffer local?
|
2003-09-09 09:47:59 +00:00
|
|
|
|
limited_stack<Undo> & redostack();
|
|
|
|
|
limited_stack<Undo> const & redostack() const;
|
2002-06-10 21:04:06 +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.
|
2003-10-06 15:43:21 +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 & texrow();
|
|
|
|
|
TexRow const & texrow() const;
|
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
|
|
|
|
|
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.
|
|
|
|
|
*/
|
|
|
|
|
bool fully_loaded() const;
|
2003-10-22 14:40:24 +00:00
|
|
|
|
/// Set by buffer_funcs' newFile.
|
|
|
|
|
void fully_loaded(bool);
|
2003-10-22 13:15:18 +00:00
|
|
|
|
|
2005-07-17 14:29:35 +00:00
|
|
|
|
/// Our main text (inside the top InsetText)
|
2003-11-28 15:08:38 +00:00
|
|
|
|
LyXText & text() const;
|
2005-07-17 14:29:35 +00:00
|
|
|
|
|
|
|
|
|
/// Our top InsetText!
|
2004-03-18 12:53:43 +00:00
|
|
|
|
InsetBase & inset() const;
|
2003-11-28 15:08:38 +00:00
|
|
|
|
|
2004-04-13 06:27:29 +00:00
|
|
|
|
//
|
|
|
|
|
// Macro handling
|
|
|
|
|
//
|
|
|
|
|
///
|
|
|
|
|
void buildMacros();
|
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
bool hasMacro(docstring const & name) const;
|
2004-04-13 06:27:29 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
MacroData const & getMacro(docstring const & name) const;
|
2004-04-13 06:27:29 +00:00
|
|
|
|
///
|
2006-10-22 10:15:23 +00:00
|
|
|
|
void insertMacro(docstring const & name, MacroData const & data);
|
|
|
|
|
|
2005-07-17 14:29:35 +00:00
|
|
|
|
///
|
|
|
|
|
void saveCursor(StableDocIterator cursor, StableDocIterator anchor);
|
|
|
|
|
///
|
|
|
|
|
StableDocIterator getCursor() const { return cursor_; }
|
|
|
|
|
///
|
|
|
|
|
StableDocIterator getAnchor() const { return anchor_; }
|
2005-07-17 23:03:01 +00:00
|
|
|
|
///
|
2006-10-22 11:00:04 +00:00
|
|
|
|
void changeRefsIfUnique(docstring const & from, docstring const & to,
|
|
|
|
|
InsetBase::Code code);
|
|
|
|
|
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
|
|
|
|
|
/// including preamble
|
2006-10-21 00:16:43 +00:00
|
|
|
|
void getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end, bool full_source);
|
2004-04-13 06:27:29 +00:00
|
|
|
|
|
2006-08-13 16:16:43 +00:00
|
|
|
|
/// errorLists_ accessors.
|
|
|
|
|
//@{
|
|
|
|
|
ErrorList const & errorList(std::string const & type) const;
|
|
|
|
|
ErrorList & errorList(std::string const & type);
|
|
|
|
|
//@}
|
2006-07-15 22:43:37 +00:00
|
|
|
|
|
2006-11-11 00:35:14 +00:00
|
|
|
|
//@{
|
|
|
|
|
TocBackend & tocBackend();
|
|
|
|
|
TocBackend const & tocBackend() const;
|
|
|
|
|
//@}
|
|
|
|
|
|
2003-09-09 11:24:33 +00:00
|
|
|
|
private:
|
|
|
|
|
/** Inserts a file into a document
|
|
|
|
|
\return \c false if method fails.
|
|
|
|
|
*/
|
2007-01-13 18:29:50 +00:00
|
|
|
|
ReadStatus readFile(LyXLex &, support::FileName const & filename,
|
|
|
|
|
bool fromString = false);
|
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.
|
|
|
|
|
boost::scoped_ptr<Impl> const pimpl_;
|
2005-07-17 14:29:35 +00:00
|
|
|
|
|
|
|
|
|
/// Save the cursor Position on Buffer switch
|
|
|
|
|
/// this would not be needed if every Buffer would have
|
|
|
|
|
/// it's BufferView, this should be FIXED in future.
|
|
|
|
|
StableDocIterator cursor_;
|
|
|
|
|
StableDocIterator anchor_;
|
2006-05-19 07:21:43 +00:00
|
|
|
|
/// A cache for the bibfiles (including bibfiles of loaded child
|
|
|
|
|
/// documents), needed for appropriate update of natbib labels.
|
2007-01-08 13:36:01 +00:00
|
|
|
|
mutable std::vector<support::FileName> bibfilesCache_;
|
2006-07-15 22:43:37 +00:00
|
|
|
|
|
2006-08-13 16:16:43 +00:00
|
|
|
|
/// Container for all sort of Buffer dependant errors.
|
|
|
|
|
std::map<std::string, ErrorList> errorLists_;
|
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
|