1999-09-27 18:44:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* This file is part of
|
1999-12-16 06:43:25 +00:00
|
|
|
|
* ======================================================
|
2000-02-04 09:38:32 +00:00
|
|
|
|
*
|
|
|
|
|
* LyX, The Document Processor
|
|
|
|
|
* Copyright 1995 Matthias Ettrich
|
|
|
|
|
*
|
|
|
|
|
* This file is Copyleft 1996
|
|
|
|
|
* Lars Gullik Bj<EFBFBD>nnes
|
|
|
|
|
*
|
|
|
|
|
* ====================================================== */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
// Change Log:
|
1999-11-15 12:01:38 +00:00
|
|
|
|
// ===========
|
1999-09-27 18:44:28 +00:00
|
|
|
|
// 23/03/98 Heinrich Bauer (heinrich.bauer@t-mobil.de)
|
|
|
|
|
// Spots marked "changed Heinrich Bauer, 23/03/98" modified due to the
|
|
|
|
|
// following bug: dvi file export did not work after printing (or previewing)
|
|
|
|
|
// and vice versa as long as the same file was concerned. This happened
|
|
|
|
|
// every time the LyX-file was left unchanged between the two actions mentioned
|
|
|
|
|
// above.
|
|
|
|
|
|
1999-11-04 01:40:20 +00:00
|
|
|
|
#ifndef BUFFER_H
|
|
|
|
|
#define BUFFER_H
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
#ifdef __GNUG__
|
|
|
|
|
#pragma interface
|
|
|
|
|
#endif
|
|
|
|
|
|
2000-02-04 09:38:32 +00:00
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#include "BufferView.h"
|
|
|
|
|
#include "lyxvc.h"
|
|
|
|
|
#include "bufferparams.h"
|
|
|
|
|
#include "texrow.h"
|
2000-04-08 17:02:02 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
class LyXRC;
|
|
|
|
|
class TeXErrors;
|
|
|
|
|
class LaTeXFeatures;
|
|
|
|
|
|
|
|
|
|
extern void updateAllVisibleBufferRelatedPopups();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
struct DEPCLEAN {
|
|
|
|
|
///
|
|
|
|
|
bool clean;
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string master;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-01-24 18:34:46 +00:00
|
|
|
|
DEPCLEAN * next;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/** The buffer object.
|
|
|
|
|
The is is the buffer object. It contains all the informations about
|
|
|
|
|
a document loaded into LyX. I am not sure if the class is complete or
|
|
|
|
|
minimal, probably not.
|
|
|
|
|
*/
|
|
|
|
|
class Buffer {
|
|
|
|
|
public:
|
|
|
|
|
/**@name Constructors and destructor */
|
|
|
|
|
//@{
|
|
|
|
|
///
|
2000-04-08 17:02:02 +00:00
|
|
|
|
explicit Buffer(string const & file, bool b = false);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
~Buffer();
|
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/**@name Methods */
|
|
|
|
|
//@{
|
|
|
|
|
|
|
|
|
|
/** save the buffer's parameters as user default
|
1999-12-16 06:43:25 +00:00
|
|
|
|
This function saves a file user_lyxdir/templates/defaults.lyx
|
|
|
|
|
which parameters are those of the current buffer. This file
|
|
|
|
|
is used as a default template when creating a new
|
|
|
|
|
file. Returns true on success.
|
|
|
|
|
*/
|
1999-09-27 18:44:28 +00:00
|
|
|
|
bool saveParamsAsDefaults();
|
|
|
|
|
|
1999-12-10 00:07:59 +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
|
|
|
|
|
*/
|
2000-04-28 11:18:04 +00:00
|
|
|
|
bool Dispatch(string const & command);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
|
|
|
|
/// Maybe we know the function already by number...
|
2000-04-28 11:18:04 +00:00
|
|
|
|
bool Dispatch(int ac, string const & argument);
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// should be changed to work for a list.
|
2000-02-04 09:38:32 +00:00
|
|
|
|
void resize() {
|
|
|
|
|
if (users) {
|
|
|
|
|
users->resize();
|
1999-12-10 00:07:59 +00:00
|
|
|
|
}
|
2000-02-04 09:38:32 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +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
|
|
|
|
|
|
|
|
|
/// 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.
|
1999-12-16 06:43:25 +00:00
|
|
|
|
Later this func will insert the BufferView into a real list,
|
|
|
|
|
not just setting a pointer.
|
|
|
|
|
*/
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void addUser(BufferView * u) { users = u; }
|
1999-09-27 18:44:28 +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.
|
|
|
|
|
*/
|
2000-02-04 09:38:32 +00:00
|
|
|
|
void delUser(BufferView *) { users = 0; }
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void redraw() {
|
1999-12-16 06:43:25 +00:00
|
|
|
|
users->redraw();
|
|
|
|
|
users->fitCursor();
|
2000-04-26 13:57:28 +00:00
|
|
|
|
//users->updateScrollbar();
|
1999-11-15 12:01:38 +00:00
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void loadAutoSaveFile();
|
|
|
|
|
|
|
|
|
|
/** Reads a file.
|
|
|
|
|
Returns false if it fails.
|
|
|
|
|
If par is given, the file is inserted. */
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool readFile(LyXLex &, LyXParagraph * par = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** Reads a file without header.
|
|
|
|
|
Returns false, if file is not completely read.
|
|
|
|
|
If par is given, the file is inserted. */
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool readLyXformat2(LyXLex &, LyXParagraph * par = 0);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-03-01 14:13:21 +00:00
|
|
|
|
/* This parses a single LyXformat-Token */
|
|
|
|
|
bool parseSingleLyXformat2Token(LyXLex &, LyXParagraph *& par,
|
|
|
|
|
LyXParagraph *& return_par,
|
2000-04-08 17:02:02 +00:00
|
|
|
|
string const & token, int & pos,
|
2000-03-01 14:13:21 +00:00
|
|
|
|
char & depth, LyXFont &,
|
|
|
|
|
LyXParagraph::footnote_flag &,
|
|
|
|
|
LyXParagraph::footnote_kind &);
|
|
|
|
|
|
2000-02-22 00:36:17 +00:00
|
|
|
|
/** Save file
|
|
|
|
|
Takes care of auto-save files and backup file if requested.
|
|
|
|
|
Returns true if the save is successful, false otherwise.
|
|
|
|
|
*/
|
2000-03-20 14:49:54 +00:00
|
|
|
|
bool save() const;
|
2000-02-22 00:36:17 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Write file. Returns false if unsuccesful.
|
2000-02-22 00:36:17 +00:00
|
|
|
|
bool writeFile(string const &, bool) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void writeFileAscii(string const & , int);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void makeLaTeXFile(string const & filename,
|
|
|
|
|
string const & original_path,
|
1999-09-27 18:44:28 +00:00
|
|
|
|
bool nice, bool only_body = false);
|
2000-05-04 08:14:34 +00:00
|
|
|
|
//
|
|
|
|
|
// LaTeX all paragraphs from par to endpar,
|
|
|
|
|
// if endpar == 0 then to the end
|
|
|
|
|
//
|
2000-05-04 10:57:00 +00:00
|
|
|
|
void latexParagraphs(std::ostream & os, LyXParagraph *par,
|
2000-05-04 08:14:34 +00:00
|
|
|
|
LyXParagraph *endpar, TexRow & texrow);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
int runLaTeX();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
int runLiterate();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
int buildProgram();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
int runChktex();
|
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void makeLinuxDocFile(string const & filename, int column);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void makeDocBookFile(string const & filename, int column);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// returns the main language for the buffer (document)
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string GetLanguage() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
return params.language;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
bool isLyxClean() const { return lyx_clean; }
|
|
|
|
|
|
|
|
|
|
/// changed Heinrich Bauer, 23/03/98
|
2000-02-04 09:38:32 +00:00
|
|
|
|
bool isDviClean() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
bool isNwClean() const { return nw_clean; }
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
bool isBakClean() const { return bak_clean; }
|
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
bool isDepClean(string const & name) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
2000-02-22 00:36:17 +00:00
|
|
|
|
void markLyxClean() const {
|
1999-09-27 18:44:28 +00:00
|
|
|
|
if (!lyx_clean) {
|
|
|
|
|
lyx_clean = true;
|
|
|
|
|
updateTitles();
|
|
|
|
|
}
|
|
|
|
|
// if the .lyx file has been saved, we don't need an
|
|
|
|
|
// autosave
|
|
|
|
|
bak_clean = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// changed Heinrich Bauer, 23/03/98
|
|
|
|
|
void markDviClean();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void markNwClean() { nw_clean = true; }
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void markBakClean() { bak_clean = true; }
|
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
void markDepClean(string const & name);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void markDviDirty();
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void markNwDirty() { nw_clean = false; }
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void markDirty() {
|
|
|
|
|
if (lyx_clean) {
|
|
|
|
|
lyx_clean = false;
|
|
|
|
|
updateTitles();
|
|
|
|
|
}
|
|
|
|
|
dvi_clean_tmpd = false;
|
|
|
|
|
dvi_clean_orgd = false;
|
|
|
|
|
nw_clean = false;
|
|
|
|
|
bak_clean = false;
|
1999-12-07 00:44:53 +00:00
|
|
|
|
DEPCLEAN * tmp = dep_clean;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
while (tmp) {
|
|
|
|
|
tmp->clean = false;
|
|
|
|
|
tmp = tmp->next;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
///
|
1999-12-10 00:07:59 +00:00
|
|
|
|
string const & fileName() const { return filename; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-02-04 09:38:32 +00:00
|
|
|
|
/** A transformed version of the file name, adequate for LaTeX
|
|
|
|
|
The path is stripped if no_path is true (default) */
|
2000-04-08 17:02:02 +00:00
|
|
|
|
string getLatexName(bool no_path = true) const;
|
1999-12-03 13:51:01 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// Change name of buffer. Updates "read-only" flag.
|
1999-12-10 00:07:59 +00:00
|
|
|
|
void fileName(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?
|
2000-01-24 18:34:46 +00:00
|
|
|
|
bool isReadonly() const { return read_only; }
|
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
|
|
|
|
|
|
|
|
|
/// returns true if the buffer contains a LaTeX document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isLatex() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// returns true if the buffer contains a LinuxDoc document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isLinuxDoc() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// returns true if the buffer contains a DocBook document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isDocBook() const;
|
2000-04-11 22:55:29 +00:00
|
|
|
|
/** returns true if the buffer contains either a LinuxDoc
|
|
|
|
|
or DocBook document */
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isSGML() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// returns true if the buffer contains a Wed document
|
1999-11-15 12:01:38 +00:00
|
|
|
|
bool isLiterate() const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
void setPaperStuff();
|
|
|
|
|
|
|
|
|
|
/** 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-04-11 22:55:29 +00:00
|
|
|
|
makeLaTeX and others. Its main use is to figure out what
|
|
|
|
|
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
|
|
|
|
|
|
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
|
string getIncludeonlyList(char delim = ',');
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
|
string getBibkeyList(char delim = '|');
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
|
|
|
|
struct TocItem {
|
|
|
|
|
LyXParagraph *par;
|
|
|
|
|
int depth;
|
|
|
|
|
string str;
|
|
|
|
|
};
|
|
|
|
|
///
|
|
|
|
|
std::vector<std::vector<TocItem> > getTocList();
|
|
|
|
|
///
|
|
|
|
|
std::vector<string> getLabelList();
|
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. */
|
1999-11-15 12:01:38 +00:00
|
|
|
|
BufferView * getUser() const { return users; }
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
2000-04-10 21:40:13 +00:00
|
|
|
|
///
|
|
|
|
|
void ChangeLanguage(Language const * from, Language const * to);
|
|
|
|
|
///
|
|
|
|
|
bool isMultiLingual();
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
//@}
|
|
|
|
|
|
|
|
|
|
/// Does this mean that this is buffer local?
|
|
|
|
|
UndoStack undostack;
|
|
|
|
|
|
|
|
|
|
/// Does this mean that this is buffer local?
|
|
|
|
|
UndoStack redostack;
|
|
|
|
|
|
|
|
|
|
///
|
|
|
|
|
BufferParams params;
|
|
|
|
|
|
|
|
|
|
/** is a list of paragraphs.
|
|
|
|
|
*/
|
1999-11-15 12:01:38 +00:00
|
|
|
|
LyXParagraph * paragraph;
|
1999-12-10 00:07:59 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// RCS object
|
|
|
|
|
LyXVC lyxvc;
|
|
|
|
|
|
|
|
|
|
/// where the temporaries go if we want them
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string tmppath;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
///
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string filepath;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/** While writing as LaTeX, tells whether we are
|
|
|
|
|
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;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void linuxDocHandleFootnote(std::ostream & os,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
LyXParagraph * & par, int const depth);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void DocBookHandleCaption(std::ostream & os, string & inner_tag,
|
1999-09-27 18:44:28 +00:00
|
|
|
|
int const depth, int desc_on,
|
1999-12-10 00:07:59 +00:00
|
|
|
|
LyXParagraph * & par);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void DocBookHandleFootnote(std::ostream & os,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
LyXParagraph * & par, int const depth);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void sgmlOpenTag(std::ostream & os, int depth,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
string const & latexname) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void sgmlCloseTag(std::ostream & os, int depth,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
string const & latexname) const;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void LinuxDocError(LyXParagraph * par, int pos, char const * message);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void SimpleLinuxDocOnePar(std::ostream & os, LyXParagraph * par,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
int desc_on, int const depth);
|
2000-03-06 02:42:40 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void SimpleDocBookOnePar(std::ostream &, string & extra,
|
2000-03-06 02:42:40 +00:00
|
|
|
|
LyXParagraph * par, int & desc_on,
|
|
|
|
|
int const depth);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// LinuxDoc.
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void push_tag(std::ostream & os, char const * tag,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
int & pos, char stack[5][3]);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// LinuxDoc.
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void pop_tag(std::ostream & os, char const * tag,
|
1999-11-15 12:01:38 +00:00
|
|
|
|
int & pos, char stack[5][3]);
|
2000-02-29 02:19:17 +00:00
|
|
|
|
|
|
|
|
|
#if 0
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2000-04-04 00:19:15 +00:00
|
|
|
|
void RoffAsciiTable(std::ostream &, LyXParagraph * par);
|
2000-02-29 02:19:17 +00:00
|
|
|
|
#endif
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
/// is save needed
|
2000-02-22 00:36:17 +00:00
|
|
|
|
mutable bool lyx_clean;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// is autosave needed
|
2000-02-22 00:36:17 +00:00
|
|
|
|
mutable bool bak_clean;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
1999-11-15 12:01:38 +00:00
|
|
|
|
/** do we need to run LaTeX, changed 23/03/98, Heinrich Bauer
|
|
|
|
|
We have to distinguish between TeX-runs executed in the original
|
|
|
|
|
directory (in which the original LyX-file resides) and TeX-runs
|
|
|
|
|
executed in a temporary directory. The first situation is valid
|
|
|
|
|
for a dvi-export, the latter one for printing or previewing. */
|
1999-09-27 18:44:28 +00:00
|
|
|
|
bool dvi_clean_orgd;
|
|
|
|
|
bool dvi_clean_tmpd;
|
|
|
|
|
|
|
|
|
|
/// do we need to run weave/tangle
|
|
|
|
|
bool nw_clean;
|
|
|
|
|
|
|
|
|
|
/// is regenerating .tex necessary
|
1999-11-15 12:01:38 +00:00
|
|
|
|
DEPCLEAN * dep_clean;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// buffer is r/o
|
|
|
|
|
bool read_only;
|
|
|
|
|
|
|
|
|
|
/// name of the file the buffer is associated with.
|
1999-10-02 16:21:10 +00:00
|
|
|
|
string filename;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
|
|
|
|
|
/// Format number of buffer
|
|
|
|
|
float format;
|
|
|
|
|
|
|
|
|
|
/** 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:
|
|
|
|
|
buffer->lyx_gui->bufferview->updateLayoutChoice. Just ask each
|
|
|
|
|
of the buffers in the list of users to do a updateLayoutChoice.
|
|
|
|
|
*/
|
1999-11-15 12:01:38 +00:00
|
|
|
|
BufferView * users;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
|
|
|
|
|
class inset_iterator {
|
|
|
|
|
public:
|
|
|
|
|
inset_iterator() : par(0) /*, it(0)*/ {}
|
|
|
|
|
inset_iterator(LyXParagraph * paragraph) : par(paragraph) {
|
|
|
|
|
SetParagraph();
|
|
|
|
|
}
|
|
|
|
|
inset_iterator(LyXParagraph * paragraph, LyXParagraph::size_type pos);
|
|
|
|
|
inset_iterator & operator++() {
|
|
|
|
|
if (par) {
|
|
|
|
|
++it;
|
|
|
|
|
if (it == par->inset_iterator_end()) {
|
|
|
|
|
par = par->next;
|
|
|
|
|
SetParagraph();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return *this;
|
|
|
|
|
}
|
|
|
|
|
Inset * operator*() {return *it; }
|
|
|
|
|
LyXParagraph * getPar() { return par; }
|
|
|
|
|
LyXParagraph::size_type getPos() {return it.getPos(); }
|
|
|
|
|
bool operator==(inset_iterator const & iter) const {
|
|
|
|
|
return it == iter.it && par == iter.par;
|
|
|
|
|
}
|
|
|
|
|
bool operator!=(inset_iterator const & iter) const {
|
|
|
|
|
return it != iter.it || par != iter.par;
|
|
|
|
|
}
|
|
|
|
|
private:
|
|
|
|
|
void SetParagraph();
|
|
|
|
|
LyXParagraph * par;
|
|
|
|
|
LyXParagraph::inset_iterator it;
|
|
|
|
|
};
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_iterator_begin() {
|
|
|
|
|
return inset_iterator(paragraph);
|
|
|
|
|
}
|
|
|
|
|
///
|
|
|
|
|
inset_iterator inset_iterator_end() {
|
|
|
|
|
return inset_iterator();
|
|
|
|
|
}
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
1999-11-15 12:01:38 +00:00
|
|
|
|
void Buffer::setParentName(string const & name)
|
1999-09-27 18:44:28 +00:00
|
|
|
|
{
|
1999-12-16 06:43:25 +00:00
|
|
|
|
params.parentname = name;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
}
|
|
|
|
|
|
2000-05-19 16:46:01 +00:00
|
|
|
|
inline
|
|
|
|
|
bool operator==(Buffer::TocItem const & a, Buffer::TocItem const & b) {
|
|
|
|
|
return a.par == b.par && a.str == b.str;
|
|
|
|
|
// No need to compare depth.
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
inline
|
|
|
|
|
bool operator!=(Buffer::TocItem const & a, Buffer::TocItem const & b) {
|
|
|
|
|
return !(a == b);
|
|
|
|
|
// No need to compare depth.
|
|
|
|
|
}
|
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
#endif
|