1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
2002-03-21 16:55:34 +00:00
|
|
|
|
* ======================================================
|
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
2000-02-04 09:38:32 +00:00
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
|
*
|
|
|
|
|
* This file is Copyleft 1996
|
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* ====================================================== */
|
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"
|
2001-06-25 00:06:33 +00:00
|
|
|
|
#include "paragraph.h"
|
2003-02-08 19:18:01 +00:00
|
|
|
|
#include "author.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
2002-05-26 19:40:17 +00:00
|
|
|
|
#include <boost/shared_ptr.hpp>
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
2001-06-25 00:06:33 +00:00
|
|
|
|
class BufferView;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
class LyXRC;
|
|
|
|
|
class TeXErrors;
|
|
|
|
|
class LaTeXFeatures;
|
2000-10-10 12:36:36 +00:00
|
|
|
|
class Language;
|
2001-09-01 21:26:34 +00:00
|
|
|
|
class ParIterator;
|
2002-11-08 01:08:27 +00:00
|
|
|
|
class ParConstIterator;
|
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
|
|
|
|
|
2002-03-21 16:55:34 +00:00
|
|
|
|
///
|
2000-07-14 14:57:20 +00:00
|
|
|
|
void resizeInsets(BufferView *);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Update window titles of all users.
|
2000-02-22 00:36:17 +00:00
|
|
|
|
void updateTitles() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Reset autosave timers for all users.
|
2000-02-22 00:36:17 +00:00
|
|
|
|
void resetAutosaveTimers() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** Adds the BufferView to the users list.
|
2001-02-16 09:25:43 +00:00
|
|
|
|
Later this func will insert the \c BufferView into a real list,
|
1999-12-16 06:43:25 +00:00
|
|
|
|
not just setting a pointer.
|
|
|
|
|
*/
|
2001-02-16 09:25:43 +00:00
|
|
|
|
void addUser(BufferView * u);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/** Removes the #BufferView# from the users list.
|
1999-12-16 06:43:25 +00:00
|
|
|
|
Since we only can have one at the moment, we just reset it.
|
|
|
|
|
*/
|
2001-02-16 09:25:43 +00:00
|
|
|
|
void delUser(BufferView *);
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2001-02-16 09:25:43 +00:00
|
|
|
|
void redraw();
|
1999-09-27 18:44:28 +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
|
|
|
|
|
|
|
|
|
/** Reads a file.
|
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
|
|
|
|
*/
|
2002-09-25 12:19:13 +00:00
|
|
|
|
bool readFile(LyXLex &, string const &, Paragraph * par = 0);
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
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
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
|
bool readLyXformat2(LyXLex &, Paragraph * par = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/// This parses a single LyXformat-Token.
|
2001-06-25 00:06:33 +00:00
|
|
|
|
bool parseSingleLyXformat2Token(LyXLex &, Paragraph *& par,
|
|
|
|
|
Paragraph *& return_par,
|
2000-04-08 17:02:02 +00:00
|
|
|
|
string const & token, int & pos,
|
2002-03-21 16:55:34 +00:00
|
|
|
|
Paragraph::depth_type & depth,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
LyXFont &);
|
2001-07-08 12:52:16 +00:00
|
|
|
|
///
|
2001-11-27 10:34:16 +00:00
|
|
|
|
void insertStringAsLines(Paragraph *&, lyx::pos_type &,
|
2001-07-23 09:11:14 +00:00
|
|
|
|
LyXFont const &, string const &) const;
|
2001-07-09 09:16:00 +00:00
|
|
|
|
///
|
|
|
|
|
Paragraph * getParFromID(int id) const;
|
2000-07-24 21:49:58 +00:00
|
|
|
|
private:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/// Parse a single inset.
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void readInset(LyXLex &, Paragraph *& par, int & pos, LyXFont &);
|
2000-07-24 21:49:58 +00:00
|
|
|
|
public:
|
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,
|
2002-07-05 19:21:29 +00:00
|
|
|
|
bool nice,
|
|
|
|
|
bool only_body = false,
|
|
|
|
|
bool only_preamble = false);
|
|
|
|
|
///
|
|
|
|
|
void makeLaTeXFile(std::ostream & os,
|
|
|
|
|
string const & original_path,
|
|
|
|
|
bool nice,
|
|
|
|
|
bool only_body = false,
|
|
|
|
|
bool only_preamble = false);
|
2000-08-07 20:58:24 +00:00
|
|
|
|
/** LaTeX all paragraphs from par to endpar.
|
2001-02-16 09:25:43 +00:00
|
|
|
|
\param \a endpar if == 0 then to the end
|
2000-08-07 20:58:24 +00:00
|
|
|
|
*/
|
2001-06-25 00:06:33 +00:00
|
|
|
|
void latexParagraphs(std::ostream & os, Paragraph * par,
|
2002-05-14 14:22:11 +00:00
|
|
|
|
Paragraph * endpar, TexRow & texrow, bool moving_arg = false) const;
|
2001-11-26 11:08:43 +00:00
|
|
|
|
///
|
2001-11-14 09:46:05 +00:00
|
|
|
|
void simpleDocBookOnePar(std::ostream &,
|
2001-06-25 00:06:33 +00:00
|
|
|
|
Paragraph * par, int & desc_on,
|
|
|
|
|
Paragraph::depth_type depth) const ;
|
2001-11-26 11:08:43 +00:00
|
|
|
|
///
|
2002-03-21 16:55:34 +00:00
|
|
|
|
void simpleLinuxDocOnePar(std::ostream & os, Paragraph * par,
|
2001-11-07 13:22:43 +00:00
|
|
|
|
Paragraph::depth_type depth);
|
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);
|
2001-11-07 13:22:43 +00:00
|
|
|
|
///
|
2001-11-26 11:08:43 +00:00
|
|
|
|
void sgmlError(Paragraph * par, int pos, string const & message) const;
|
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;
|
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
|
|
|
|
|
void fillWithBibKeys(vector<pair<string, string> > & keys) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
2002-08-12 20:17:41 +00:00
|
|
|
|
std::vector<string> const getLabelList() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** This will clearly have to change later. Later we can have more
|
1999-12-16 06:43:25 +00:00
|
|
|
|
than one user per buffer. */
|
2001-02-16 09:25:43 +00:00
|
|
|
|
BufferView * getUser() 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);
|
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?
|
2002-05-26 19:40:17 +00:00
|
|
|
|
limited_stack<boost::shared_ptr<Undo> > undostack;
|
2002-06-10 21:04:06 +00:00
|
|
|
|
|
|
|
|
|
/// Does this mean that this is buffer local?
|
2002-05-26 19:40:17 +00:00
|
|
|
|
limited_stack<boost::shared_ptr<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-02-09 00:27:52 +00:00
|
|
|
|
typedef std::map<string, bool> DepClean;
|
|
|
|
|
|
|
|
|
|
/// need to regenerate .tex ?
|
|
|
|
|
DepClean dep_clean_;
|
|
|
|
|
|
2003-02-08 19:18:01 +00:00
|
|
|
|
/// the author list
|
|
|
|
|
AuthorList authorlist;
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
/// Format number of buffer
|
2001-01-11 11:06:10 +00:00
|
|
|
|
int file_format;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/** A list of views using this buffer.
|
1999-12-16 06:43:25 +00:00
|
|
|
|
Why not keep a list of the BufferViews that use this buffer?
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-12-16 06:43:25 +00:00
|
|
|
|
At least then we don't have to do a lot of magic like:
|
2000-08-07 20:58:24 +00:00
|
|
|
|
#buffer->lyx_gui->bufferview->updateLayoutChoice#. Just ask each
|
|
|
|
|
of the buffers in the list of users to do a #updateLayoutChoice#.
|
1999-12-16 06:43:25 +00:00
|
|
|
|
*/
|
1999-11-15 12:01:38 +00:00
|
|
|
|
BufferView * users;
|
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;
|
2000-10-11 21:06:43 +00:00
|
|
|
|
typedef Inset value_type;
|
|
|
|
|
typedef ptrdiff_t difference_type;
|
|
|
|
|
typedef Inset * pointer;
|
|
|
|
|
typedef Inset & 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
|
|
|
|
///
|
2002-08-20 17:18:21 +00:00
|
|
|
|
Paragraph * getPar();
|
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
|
|
|
|
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_iterator_begin() {
|
2002-08-20 17:18:21 +00:00
|
|
|
|
return inset_iterator(paragraphs.begin(), paragraphs.end());
|
2000-05-19 16:46:01 +00:00
|
|
|
|
}
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_iterator_end() {
|
|
|
|
|
return inset_iterator();
|
|
|
|
|
}
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_const_iterator_begin() const {
|
2002-08-20 17:18:21 +00:00
|
|
|
|
return inset_iterator(paragraphs.begin(), paragraphs.end());
|
2001-07-06 15:57:54 +00:00
|
|
|
|
}
|
2002-08-20 17:18:21 +00:00
|
|
|
|
|
2001-07-06 15:57:54 +00:00
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_const_iterator_end() const {
|
|
|
|
|
return inset_iterator();
|
|
|
|
|
}
|
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
|
|
|
|
///
|
|
|
|
|
Inset * 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
|