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
|
|
|
|
|
2003-09-06 17:23:08 +00:00
|
|
|
|
#include "InsetList.h"
|
|
|
|
|
|
2005-07-17 14:29:35 +00:00
|
|
|
|
#include "dociterator.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"
|
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>
|
|
|
|
|
#include <map>
|
|
|
|
|
#include <utility>
|
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
|
|
|
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;
|
2004-03-25 09:16:36 +00:00
|
|
|
|
class ParagraphList;
|
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;
|
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
|
|
|
|
};
|
|
|
|
|
|
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
|
|
|
|
|
2003-03-12 05:46:35 +00:00
|
|
|
|
/// load a new file
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool readFile(std::string 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,
|
2004-11-24 21:53:46 +00:00
|
|
|
|
lyx::pit_type &, lyx::pos_type &,
|
2004-12-17 16:27:12 +00:00
|
|
|
|
LyXFont const &, std::string 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
|
|
|
|
|
2003-06-20 23:03:43 +00:00
|
|
|
|
/// This signal is emitted when a parsing error shows up.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void(ErrorItem)> error;
|
2003-07-07 08:37:02 +00:00
|
|
|
|
/// This signal is emitted when some message shows up.
|
2004-09-26 14:19:47 +00:00
|
|
|
|
boost::signal<void(std::string)> 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
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Write file. Returns \c false if unsuccesful.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
bool writeFile(std::string const &) const;
|
2002-03-21 16:55:34 +00:00
|
|
|
|
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-11-05 12:06:20 +00:00
|
|
|
|
void writeFileAscii(std::string const &, OutputParams const &);
|
2000-09-27 17:07:33 +00:00
|
|
|
|
///
|
2003-11-05 12:06:20 +00:00
|
|
|
|
void writeFileAscii(std::ostream &, OutputParams const &);
|
2002-07-05 19:21:29 +00:00
|
|
|
|
/// Just a wrapper for the method below, first creating the ofstream.
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void makeLaTeXFile(std::string const & filename,
|
|
|
|
|
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);
|
2002-07-05 19:21:29 +00:00
|
|
|
|
///
|
|
|
|
|
void makeLaTeXFile(std::ostream & 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
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void makeLinuxDocFile(std::string 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);
|
1999-09-27 18:44:28 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void makeDocBookFile(std::string 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);
|
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
|
2003-10-06 15:43:21 +00:00
|
|
|
|
std::string 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.
|
2003-10-06 15:43:21 +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
|
|
|
|
|
2001-02-16 09:25:43 +00:00
|
|
|
|
/// Get the 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;
|
|
|
|
|
|
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-10-06 15:43:21 +00:00
|
|
|
|
void fillWithBibKeys(std::vector<std::pair<std::string, std::string> > & keys) const;
|
2000-05-19 16:46:01 +00:00
|
|
|
|
///
|
2003-10-06 15:43:21 +00:00
|
|
|
|
void getLabelList(std::vector<std::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
|
|
|
|
///
|
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();
|
|
|
|
|
///
|
|
|
|
|
bool hasMacro(std::string const & name) const;
|
|
|
|
|
///
|
|
|
|
|
MacroData const & getMacro(std::string const & name) const;
|
|
|
|
|
///
|
|
|
|
|
void insertMacro(std::string 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
|
|
|
|
///
|
|
|
|
|
void changeRefsIfUnique(std::string const & from, std::string const & to);
|
2004-04-13 06:27:29 +00:00
|
|
|
|
|
2003-09-09 11:24:33 +00:00
|
|
|
|
private:
|
|
|
|
|
/** Inserts a file into a document
|
|
|
|
|
\return \c false if method fails.
|
|
|
|
|
*/
|
2005-11-29 15:08:35 +00:00
|
|
|
|
bool readFile(LyXLex &, std::string const & filename);
|
2003-09-09 11:24:33 +00:00
|
|
|
|
|
|
|
|
|
bool do_writeFile(std::ostream & ofs) const;
|
|
|
|
|
|
|
|
|
|
/// 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_;
|
1999-09-27 18:44:28 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif
|