2003-06-20 12:46:28 +00:00
|
|
|
|
// -*- C++ -*-
|
|
|
|
|
/* \file buffer_funcs.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2003-06-20 12:46:28 +00:00
|
|
|
|
* \author Alfredo Braunstein
|
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-06-20 12:46:28 +00:00
|
|
|
|
*/
|
|
|
|
|
|
2003-06-24 20:42:15 +00:00
|
|
|
|
#ifndef BUFFER_FUNCS_H
|
|
|
|
|
#define BUFFER_FUNCS_H
|
|
|
|
|
|
2005-02-25 11:55:36 +00:00
|
|
|
|
#include "lyxlayout_ptr_fwd.h"
|
2006-10-20 20:30:00 +00:00
|
|
|
|
#include "support/docstring.h"
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
|
#include <string>
|
|
|
|
|
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
namespace lyx {
|
|
|
|
|
|
2006-12-02 16:07:15 +00:00
|
|
|
|
namespace support { class FileName; }
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
2003-06-20 12:46:28 +00:00
|
|
|
|
class Buffer;
|
2004-12-27 16:30:27 +00:00
|
|
|
|
class DocIterator;
|
2003-06-24 20:42:15 +00:00
|
|
|
|
class ErrorList;
|
2004-12-27 16:30:27 +00:00
|
|
|
|
class TeXErrors;
|
2006-04-07 22:16:09 +00:00
|
|
|
|
class ParIterator;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
/**
|
2003-09-09 18:27:24 +00:00
|
|
|
|
* Loads a LyX file \c filename into \c Buffer
|
2003-06-20 12:46:28 +00:00
|
|
|
|
* and \return success status.
|
|
|
|
|
*/
|
2006-12-02 16:07:15 +00:00
|
|
|
|
bool loadLyXFile(Buffer *, support::FileName const & filename);
|
2003-06-20 12:46:28 +00:00
|
|
|
|
|
|
|
|
|
/* Make a new file (buffer) with name \c filename based on a template
|
|
|
|
|
* named \c templatename
|
|
|
|
|
*/
|
2003-10-06 15:43:21 +00:00
|
|
|
|
Buffer * newFile(std::string const & filename, std::string const & templatename,
|
2003-06-20 12:46:28 +00:00
|
|
|
|
bool isNamed = false);
|
2003-06-24 20:42:15 +00:00
|
|
|
|
|
|
|
|
|
///return the format of the buffer on a string
|
2006-04-09 00:26:19 +00:00
|
|
|
|
std::string const bufferFormat(Buffer const & buffer);
|
2006-08-13 16:16:43 +00:00
|
|
|
|
|
|
|
|
|
/// Fill in the ErrorList with the TeXErrors
|
|
|
|
|
void bufferErrors(Buffer const &, TeXErrors const &, ErrorList &);
|
2003-06-24 20:42:15 +00:00
|
|
|
|
|
2004-12-27 16:30:27 +00:00
|
|
|
|
/// Count the number of words in the text between these two iterators
|
|
|
|
|
int countWords(DocIterator const & from, DocIterator const & to);
|
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
/// update labels at "iter".
|
2006-04-07 22:16:09 +00:00
|
|
|
|
/**
|
2006-04-16 14:19:25 +00:00
|
|
|
|
A full updateLabels(Buffer const &) will be called if not possible.
|
2006-04-07 22:16:09 +00:00
|
|
|
|
*/
|
2006-11-13 16:53:49 +00:00
|
|
|
|
void updateLabels(Buffer const & buf, ParIterator & it, bool childonly = false);
|
2006-04-07 22:16:09 +00:00
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
/// update labels between "from" and "to" if possible.
|
|
|
|
|
/**
|
|
|
|
|
A full updateLabels(Buffer const &) will be called if not possible.
|
|
|
|
|
*/
|
|
|
|
|
void updateLabels(Buffer const & buf,
|
2006-11-13 16:53:49 +00:00
|
|
|
|
ParIterator & from, ParIterator & to, bool childonly = false);
|
2005-02-25 11:55:36 +00:00
|
|
|
|
|
2006-04-16 14:19:25 +00:00
|
|
|
|
/// updates all counters
|
2006-11-13 16:53:49 +00:00
|
|
|
|
void updateLabels(Buffer const &, bool childonly = false);
|
2004-12-27 16:30:27 +00:00
|
|
|
|
|
2007-03-12 11:23:41 +00:00
|
|
|
|
///
|
|
|
|
|
void checkBufferStructure(Buffer &, ParIterator const &);
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
|
2003-06-24 20:42:15 +00:00
|
|
|
|
#endif // BUFFER_FUNCS_H
|