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
|
|
|
|
|
2000-02-04 09:38:32 +00:00
|
|
|
|
#include "LString.h"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "undo.h"
|
2002-05-26 19:40:17 +00:00
|
|
|
|
#include "support/limited_stack.h"
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include "lyxvc.h"
|
|
|
|
|
#include "bufferparams.h"
|
|
|
|
|
#include "texrow.h"
|
2002-08-12 00:15:19 +00:00
|
|
|
|
#include "ParagraphList.h"
|
2003-06-20 23:03:43 +00:00
|
|
|
|
#include "errorlist.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2003-04-24 23:19:41 +00:00
|
|
|
|
#include <boost/scoped_ptr.hpp>
|
2003-07-10 12:26:40 +00:00
|
|
|
|
#include <boost/signals/signal0.hpp>
|
2003-06-20 23:03:43 +00:00
|
|
|
|
#include <boost/signals/signal1.hpp>
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
2003-09-04 03:54:04 +00:00
|
|
|
|
class AuthorList;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class LyXRC;
|
|
|
|
|
class LaTeXFeatures;
|
2003-05-22 18:59:10 +00:00
|
|
|
|
class LatexRunParams;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
class Language;
|
2003-09-04 03:54:04 +00:00
|
|
|
|
class Messages;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
class ParIterator;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
class ParConstIterator;
|
2003-09-04 03:54:04 +00:00
|
|
|
|
class TeXErrors;
|
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.
|
2001-06-25 00:06:33 +00:00
|
|
|
|
This is the buffer object. It contains all the informations about
|
1999-09-27 18:44:28 +00:00
|
|
|
|
a document loaded into LyX. I am not sure if the class is complete or
|
|
|
|
|
minimal, probably not.
|
2001-02-16 09:25:43 +00:00
|
|
|
|
\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
|
|
|
|
};
|
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/** Constructor
|
|
|
|
|
\param file
|
|
|
|
|
\param b optional \c false by default
|
|
|
|
|
*/
|
2000-04-08 17:02:02 +00:00
|
|
|
|
explicit Buffer(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
|
|
|
|
|
*/
|
2002-05-30 19:49:00 +00:00
|
|
|
|
bool dispatch(string const & command, bool * result = 0);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
|
|
/// Maybe we know the function already by number...
|
2002-05-30 19:49:00 +00:00
|
|
|
|
bool dispatch(int ac, string const & argument, 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
|
|
|
|
|
2003-09-02 08:26:20 +00:00
|
|
|
|
private:
|
2003-03-12 05:46:35 +00:00
|
|
|
|
/** Inserts a file into a document
|
2001-02-16 09:25:43 +00:00
|
|
|
|
\param par if != 0 insert the file.
|
|
|
|
|
\return \c false if method fails.
|
2000-08-07 20:58:24 +00:00
|
|
|
|
*/
|
2003-09-02 08:26:20 +00:00
|
|
|
|
bool readFile(LyXLex &, string const & filename,
|
|
|
|
|
ParagraphList::iterator pit);
|
2003-03-12 05:46:35 +00:00
|
|
|
|
|
2003-09-02 08:26:20 +00:00
|
|
|
|
public:
|
2003-03-12 05:46:35 +00:00
|
|
|
|
/// load a new file
|
2003-09-02 08:26:20 +00:00
|
|
|
|
bool readFile(string const & filename);
|
|
|
|
|
|
|
|
|
|
bool readFile(string const & filename, ParagraphList::iterator pit);
|
2002-03-21 16:55:34 +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
|
|
|
|
*/
|
2003-03-12 05:46:35 +00:00
|
|
|
|
bool readBody(LyXLex &, ParagraphList::iterator pit);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
|
|
|
|
/// This parses a single token
|
2003-03-12 11:52:23 +00:00
|
|
|
|
int readParagraph(LyXLex &, string const & token,
|
|
|
|
|
ParagraphList & pars, ParagraphList::iterator & pit,
|
|
|
|
|
Paragraph::depth_type & depth);
|
2003-03-12 02:39:12 +00:00
|
|
|
|
|
2001-07-08 12:52:16 +00:00
|
|
|
|
///
|
2003-04-16 08:12:22 +00:00
|
|
|
|
void insertStringAsLines(ParagraphList::iterator &, lyx::pos_type &,
|
2003-03-04 21:40:36 +00:00
|
|
|
|
LyXFont const &, string const &);
|
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
|
|
|
|
|
2000-07-24 21:49:58 +00:00
|
|
|
|
public:
|
2003-06-20 23:03:43 +00:00
|
|
|
|
/// This signal is emitted when a parsing error shows up.
|
2003-07-07 08:37:02 +00:00
|
|
|
|
boost::signal1<void, ErrorItem> error;
|
|
|
|
|
/// This signal is emitted when some message shows up.
|
|
|
|
|
boost::signal1<void, string> message;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// This signal is emitted when the buffer busy status change.
|
2003-07-07 08:37:02 +00:00
|
|
|
|
boost::signal1<void, bool> busy;
|
2003-07-10 12:26:40 +00:00
|
|
|
|
/// This signal is emitted when the buffer readonly status change.
|
|
|
|
|
boost::signal1<void, bool> readonly;
|
|
|
|
|
/// Update window titles of all users.
|
|
|
|
|
boost::signal0<void> updateTitles;
|
|
|
|
|
/// Reset autosave timers for all users.
|
|
|
|
|
boost::signal0<void> resetAutosaveTimers;
|
2003-07-11 12:21:31 +00:00
|
|
|
|
/// This signal is emitting if the buffer is being closed.
|
|
|
|
|
boost::signal0<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
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Write file. Returns \c false if unsuccesful.
|
2002-08-01 22:26:30 +00:00
|
|
|
|
bool writeFile(string const &) const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void writeFileAscii(string const & , int);
|
2000-09-27 17:07:33 +00:00
|
|
|
|
///
|
2000-09-26 15:25:14 +00:00
|
|
|
|
void writeFileAscii(std::ostream &, int);
|
2000-09-27 17:07:33 +00:00
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
string const asciiParagraph(Paragraph const &, unsigned int linelen,
|
2002-03-21 16:55:34 +00:00
|
|
|
|
bool noparbreak = false) const;
|
2002-07-05 19:21:29 +00:00
|
|
|
|
/// Just a wrapper for the method below, first creating the ofstream.
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void makeLaTeXFile(string const & filename,
|
|
|
|
|
string const & original_path,
|
2003-05-22 18:59:10 +00:00
|
|
|
|
LatexRunParams const &,
|
2003-07-26 21:37:10 +00:00
|
|
|
|
bool output_preamble = true,
|
|
|
|
|
bool output_body = true);
|
2002-07-05 19:21:29 +00:00
|
|
|
|
///
|
|
|
|
|
void makeLaTeXFile(std::ostream & os,
|
|
|
|
|
string const & original_path,
|
2003-05-22 18:59:10 +00:00
|
|
|
|
LatexRunParams 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
|
|
|
|
///
|
2001-11-14 09:46:05 +00:00
|
|
|
|
void simpleDocBookOnePar(std::ostream &,
|
2003-04-16 08:12:22 +00:00
|
|
|
|
ParagraphList::iterator par, int & desc_on,
|
2003-05-02 10:06:07 +00:00
|
|
|
|
Paragraph::depth_type depth) const;
|
2001-11-26 11:08:43 +00:00
|
|
|
|
///
|
2003-05-02 10:06:07 +00:00
|
|
|
|
void simpleLinuxDocOnePar(std::ostream & os,
|
|
|
|
|
ParagraphList::iterator par,
|
|
|
|
|
Paragraph::depth_type depth) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-07-01 12:54:45 +00:00
|
|
|
|
void makeLinuxDocFile(string const & filename,
|
|
|
|
|
bool nice, bool only_body = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-07-01 12:54:45 +00:00
|
|
|
|
void makeDocBookFile(string const & filename,
|
|
|
|
|
bool nice, 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
|
|
|
|
|
string const B_(string const & l10n) const;
|
|
|
|
|
|
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
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
bool isDepClean(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
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void markDepClean(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
|
|
|
|
|
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
|
bool isUnnamed();
|
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.
|
2001-02-16 09:25:43 +00:00
|
|
|
|
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.
|
2002-01-14 23:31:23 +00:00
|
|
|
|
string const & filePath() const;
|
|
|
|
|
|
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
|
|
|
|
*/
|
2000-09-14 17:53:12 +00:00
|
|
|
|
string const getLatexName(bool no_path = true) const;
|
1999-12-03 13:51:01 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Get the name and type of the log.
|
|
|
|
|
std::pair<LogType, 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.
|
2000-10-12 00:11:06 +00:00
|
|
|
|
void setFileName(string const & newfile);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// Name of the document's parent
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void setParentName(string const &);
|
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 LinuxDoc document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isLinuxDoc() 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;
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/** returns \c true if the buffer contains either a LinuxDoc
|
2000-04-11 22:55:29 +00:00
|
|
|
|
or DocBook document */
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isSGML() 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
|
2003-02-18 14:37:31 +00:00
|
|
|
|
void fillWithBibKeys(std::vector<std::pair<string, string> > & keys) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
2003-06-16 11:49:38 +00:00
|
|
|
|
void getLabelList(std::vector<string> &) 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
|
|
|
|
///
|
|
|
|
|
bool isMultiLingual();
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Does this mean that this is buffer local?
|
2003-06-04 07:14:05 +00:00
|
|
|
|
limited_stack<Undo> undostack;
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
|
|
|
|
/// Does this mean that this is buffer local?
|
2003-06-04 07:14:05 +00:00
|
|
|
|
limited_stack<Undo> redostack;
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
|
|
|
|
BufferParams params;
|
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
|
|
|
|
*/
|
2002-08-12 00:15:19 +00:00
|
|
|
|
ParagraphList paragraphs;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// LyX version control object.
|
1999-09-27 18:44:28 +00:00
|
|
|
|
LyXVC lyxvc;
|
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Where to put temporary files.
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string tmppath;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/** If we are writing a nice LaTeX file or not.
|
|
|
|
|
While writing as LaTeX, tells whether we are
|
1999-09-27 18:44:28 +00:00
|
|
|
|
doing a 'nice' LaTeX file */
|
|
|
|
|
bool niceFile;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
2000-01-08 21:02:58 +00:00
|
|
|
|
/// Used when typesetting to place errorboxes.
|
|
|
|
|
TexRow texrow;
|
2003-02-08 19:18:01 +00:00
|
|
|
|
|
|
|
|
|
/// the author list for the document
|
|
|
|
|
AuthorList & authors();
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
2003-07-27 23:40:08 +00:00
|
|
|
|
bool do_writeFile(std::ostream & ofs) const;
|
|
|
|
|
|
2003-02-09 00:27:52 +00:00
|
|
|
|
typedef std::map<string, bool> DepClean;
|
|
|
|
|
|
|
|
|
|
/// need to regenerate .tex ?
|
|
|
|
|
DepClean dep_clean_;
|
2003-03-02 12:16:00 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// is save needed
|
2000-02-22 00:36:17 +00:00
|
|
|
|
mutable bool lyx_clean;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// is autosave needed
|
2000-02-22 00:36:17 +00:00
|
|
|
|
mutable bool bak_clean;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
2000-07-26 13:43:16 +00:00
|
|
|
|
/// is this a unnamed file (New...)
|
|
|
|
|
bool unnamed;
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// buffer is r/o
|
|
|
|
|
bool read_only;
|
|
|
|
|
|
|
|
|
|
/// name of the file the buffer is associated with.
|
2002-01-14 23:31:23 +00:00
|
|
|
|
string filename_;
|
|
|
|
|
|
|
|
|
|
/// The path to the document file.
|
|
|
|
|
string filepath_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2003-04-24 23:19:41 +00:00
|
|
|
|
///
|
|
|
|
|
boost::scoped_ptr<Messages> messages_;
|
2000-05-20 21:37:05 +00:00
|
|
|
|
public:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2000-05-19 16:46:01 +00:00
|
|
|
|
class inset_iterator {
|
|
|
|
|
public:
|
2000-10-12 15:17:42 +00:00
|
|
|
|
typedef std::input_iterator_tag iterator_category;
|
2003-07-25 21:20:24 +00:00
|
|
|
|
typedef InsetOld value_type;
|
2000-10-11 21:06:43 +00:00
|
|
|
|
typedef ptrdiff_t difference_type;
|
2003-07-25 21:20:24 +00:00
|
|
|
|
typedef InsetOld * pointer;
|
|
|
|
|
typedef InsetOld & reference;
|
2002-08-20 17:18:21 +00:00
|
|
|
|
typedef ParagraphList::iterator base_type;
|
|
|
|
|
|
2002-08-20 17:43:28 +00:00
|
|
|
|
///
|
|
|
|
|
inset_iterator();
|
|
|
|
|
///
|
|
|
|
|
inset_iterator(base_type p, base_type e);
|
|
|
|
|
///
|
|
|
|
|
inset_iterator(base_type p, lyx::pos_type pos, base_type e);
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2002-08-20 17:43:28 +00:00
|
|
|
|
/// prefix ++
|
|
|
|
|
inset_iterator & operator++();
|
2002-08-20 17:18:21 +00:00
|
|
|
|
/// postfix ++
|
|
|
|
|
inset_iterator operator++(int);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
reference operator*();
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
pointer operator->();
|
2002-08-04 23:11:50 +00:00
|
|
|
|
|
2000-10-11 21:06:43 +00:00
|
|
|
|
///
|
2003-05-02 10:38:18 +00:00
|
|
|
|
ParagraphList::iterator getPar() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
lyx::pos_type getPos() const;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2000-05-20 21:37:05 +00:00
|
|
|
|
friend
|
|
|
|
|
bool operator==(inset_iterator const & iter1,
|
2000-08-07 20:58:24 +00:00
|
|
|
|
inset_iterator const & iter2);
|
2000-05-19 16:46:01 +00:00
|
|
|
|
private:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2001-06-28 10:25:20 +00:00
|
|
|
|
void setParagraph();
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
ParagraphList::iterator pit;
|
|
|
|
|
///
|
|
|
|
|
ParagraphList::iterator pend;
|
2000-08-07 20:58:24 +00:00
|
|
|
|
///
|
2002-08-11 15:03:52 +00:00
|
|
|
|
InsetList::iterator it;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
};
|
2000-05-20 21:37:05 +00:00
|
|
|
|
|
2003-06-02 14:02:58 +00:00
|
|
|
|
/// return an iterator to all *top-level* insets in the buffer
|
|
|
|
|
inset_iterator inset_iterator_begin();
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2003-06-02 14:02:58 +00:00
|
|
|
|
/// return the end of all *top-level* insets in the buffer
|
|
|
|
|
inset_iterator inset_iterator_end();
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2003-06-02 14:02:58 +00:00
|
|
|
|
/// return a const iterator to all *top-level* insets in the buffer
|
|
|
|
|
inset_iterator inset_const_iterator_begin() const;
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2003-06-02 14:02:58 +00:00
|
|
|
|
/// return the const end of all *top-level* insets in the buffer
|
|
|
|
|
inset_iterator inset_const_iterator_end() const;
|
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
|
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
|
///
|
2003-07-25 21:20:24 +00:00
|
|
|
|
InsetOld * getInsetFromID(int id_arg) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
2002-08-20 17:43:28 +00:00
|
|
|
|
bool operator==(Buffer::inset_iterator const & iter1,
|
|
|
|
|
Buffer::inset_iterator const & iter2);
|
|
|
|
|
|
|
|
|
|
bool operator!=(Buffer::inset_iterator const & iter1,
|
|
|
|
|
Buffer::inset_iterator const & iter2);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|