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.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Lars Gullik Bjø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
|
|
|
|
|
2003-10-06 15:43:21 +00:00
|
|
|
#include <string>
|
|
|
|
|
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;
|
2006-04-07 22:16:09 +00:00
|
|
|
class ParIterator;
|
2003-06-20 12:46:28 +00:00
|
|
|
|
2007-06-19 16:03:47 +00:00
|
|
|
/**
|
|
|
|
* Checks and loads a LyX file \param filename.
|
|
|
|
* \retval the newly created \c Buffer pointer if successful or 0.
|
|
|
|
* \retval 0 if the \c Buffer could not be created.
|
|
|
|
*/
|
2008-12-05 15:49:07 +00:00
|
|
|
Buffer * checkAndLoadLyXFile(support::FileName const & filename,
|
|
|
|
bool acceptDirty = false);
|
2007-06-19 16:03:47 +00:00
|
|
|
|
2007-08-06 04:14:26 +00:00
|
|
|
/** Make a new file (buffer) with name \c filename based on a template
|
|
|
|
* named \c templatename
|
2003-06-20 12:46:28 +00:00
|
|
|
*/
|
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
|
|
|
|
2009-10-24 14:20:00 +00:00
|
|
|
/** Make a new unnamed file (buffer) with prefix \c prefix
|
|
|
|
* based on a template named \c templatename
|
2007-12-07 11:57:13 +00:00
|
|
|
*/
|
2009-10-24 14:20:00 +00:00
|
|
|
Buffer * newUnnamedFile(support::FileName const & path,
|
|
|
|
std::string const & prefix, std::string const & templatename = "");
|
2007-12-07 11:57:13 +00:00
|
|
|
|
2009-10-24 14:57:28 +00:00
|
|
|
/// Load the file with name \c fname, and returns the buffer. If the
|
|
|
|
/// file was already loaded it just returns the associated buffer.
|
|
|
|
Buffer * loadIfNeeded(support::FileName const & fname);
|
|
|
|
|
2004-12-27 16:30:27 +00:00
|
|
|
/// Count the number of words in the text between these two iterators
|
2011-03-18 12:50:09 +00:00
|
|
|
int countWords(DocIterator const & from, DocIterator const & to,
|
|
|
|
bool skipNoOutput = true);
|
2004-12-27 16:30:27 +00:00
|
|
|
|
2008-01-08 15:18:00 +00:00
|
|
|
/// Count the number of chars in the text between these two iterators
|
|
|
|
int countChars(DocIterator const & from, DocIterator const & to, bool with_blanks);
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2003-06-24 20:42:15 +00:00
|
|
|
#endif // BUFFER_FUNCS_H
|