#include "insets/InsetCode.h"
#include "support/strfwd.h"
#include "support/types.h"
#include "insets/InsetCode.h"
#include "support/strfwd.h"
#include "support/types.h"
/// Method to check if a file is externally modified, used by
/// isExternallyModified()
/// Method to check if a file is externally modified, used by
/// isExternallyModified()
- checksum_method, ///< Use file checksum
- timestamp_method, ///< Use timestamp, and checksum if timestamp has changed
+ checksum_method, ///< Use file checksum
+ timestamp_method ///< Use timestamp, and checksum if timestamp has changed
- ///
- Buffer * clone() const;
+ /// Clones the entire structure of which this Buffer is part, starting
+ /// with the master and cloning all the children, too.
+ Buffer * cloneFromMaster() const;
+ /// Just clones this single Buffer. For autosave.
+ Buffer * cloneBufferOnly() const;
bool writeFile(support::FileName const &) const;
/// \name Functions involved in reading files/strings.
bool writeFile(support::FileName const &) const;
/// \name Functions involved in reading files/strings.
/// returns the file format number.
ReadStatus parseLyXFormat(Lexer & lex, support::FileName const & fn,
int & file_format) const;
/// Convert the LyX file to the LYX_FORMAT using
/// the lyx2lyx script and returns the filename
/// of the temporary file to be read
/// returns the file format number.
ReadStatus parseLyXFormat(Lexer & lex, support::FileName const & fn,
int & file_format) const;
/// Convert the LyX file to the LYX_FORMAT using
/// the lyx2lyx script and returns the filename
/// of the temporary file to be read
/// \name Functions involved in autosave and emergency files.
//@{
/// Save an autosave file to #filename.lyx#
/// \name Functions involved in autosave and emergency files.
//@{
/// Save an autosave file to #filename.lyx#
ReadStatus loadEmergency();
/// Get the filename of the emergency file associated with the Buffer
support::FileName getEmergencyFileName() const;
ReadStatus loadEmergency();
/// Get the filename of the emergency file associated with the Buffer
support::FileName getEmergencyFileName() const;
/// Fill in the ErrorList with the TeXErrors
void bufferErrors(TeXErrors const &, ErrorList &) const;
/// Fill in the ErrorList with the TeXErrors
void bufferErrors(TeXErrors const &, ErrorList &) const;
/// Just a wrapper for writeLaTeXSource, first creating the ofstream.
bool makeLaTeXFile(support::FileName const & filename,
std::string const & original_path,
OutputParams const &,
/// Just a wrapper for writeLaTeXSource, first creating the ofstream.
bool makeLaTeXFile(support::FileName const & filename,
std::string const & original_path,
OutputParams const &,
/** Export the buffer to LaTeX.
If \p os is a file stream, and params().inputenc is "auto" or
"default", and the buffer contains text in different languages
/** Export the buffer to LaTeX.
If \p os is a file stream, and params().inputenc is "auto" or
"default", and the buffer contains text in different languages
///
void makeDocBookFile(support::FileName const & filename,
OutputParams const & runparams_in,
///
void makeDocBookFile(support::FileName const & filename,
OutputParams const & runparams_in,
///
void writeDocBookSource(odocstream & os, std::string const & filename,
OutputParams const & runparams_in,
///
void writeDocBookSource(odocstream & os, std::string const & filename,
OutputParams const & runparams_in,
///
void writeLyXHTMLSource(odocstream & os,
OutputParams const & runparams_in,
///
void writeLyXHTMLSource(odocstream & os,
OutputParams const & runparams_in,
/// returns the main language for the buffer (document)
Language const * language() const;
/// get l10n translated to the buffers language
/// returns the main language for the buffer (document)
Language const * language() const;
/// get l10n translated to the buffers language
/// \return a list of the direct children of this Buffer.
/// this list has no duplicates and is in the order in which
/// the children appear.
ListOfBuffers getChildren() const;
/// \return a list of the direct children of this Buffer.
/// this list has no duplicates and is in the order in which
/// the children appear.
ListOfBuffers getChildren() const;
/// \return a list of all descendents of this Buffer (children,
/// grandchildren, etc). this list has no duplicates and is in
/// the order in which the children appear.
/// \return a list of all descendents of this Buffer (children,
/// grandchildren, etc). this list has no duplicates and is in
/// the order in which the children appear.
- /// returns \c true if the buffer contains a LaTeX document
- bool isLatex() const;
- /// returns \c true if the buffer contains a DocBook document
- bool isDocBook() const;
- /// returns \c true if the buffer contains a Wed document
- bool isLiterate() const;
-
/** Validate a buffer for LaTeX.
This validates the buffer, and returns a struct for use by
#makeLaTeX# and others. Its main use is to figure out what
/** Validate a buffer for LaTeX.
This validates the buffer, and returns a struct for use by
#makeLaTeX# and others. Its main use is to figure out what
void validate(LaTeXFeatures &) const;
/// Reference information is cached in the Buffer, so we do not
void validate(LaTeXFeatures &) const;
/// Reference information is cached in the Buffer, so we do not
/// being gathered. This cache is PER BUFFER, and the cache for the
/// master essentially includes the cache for its children. This gets
/// invalidated when an InsetBibtex is created, deleted, or modified.
/// being gathered. This cache is PER BUFFER, and the cache for the
/// master essentially includes the cache for its children. This gets
/// invalidated when an InsetBibtex is created, deleted, or modified.
/// The other is a cache of the reference information itself. This
/// exists only in the master buffer, and when it needs to be updated,
/// the children add their information to the master's cache.
/// The other is a cache of the reference information itself. This
/// exists only in the master buffer, and when it needs to be updated,
/// the children add their information to the master's cache.
/// whether the cache is valid. If so, we do nothing. If not, then we
/// reload all the BibTeX info.
/// Note that this operates on the master document.
/// whether the cache is valid. If so, we do nothing. If not, then we
/// reload all the BibTeX info.
/// Note that this operates on the master document.
- /// Normally, this is done (more cheaply) in updateBuffer(), but there are
- /// times when we need to force it to be done and don't need a full buffer
- /// update. This is in GuiCitation and in changeRefsIfUnique() now.
/// \return the bibliography information for this buffer's master,
/// or just for it, if it isn't a child.
BiblioInfo const & masterBibInfo() const;
/// \return the bibliography information for this buffer's master,
/// or just for it, if it isn't a child.
BiblioInfo const & masterBibInfo() const;
- BiblioInfo & masterBibInfo();
+ /// collect bibliography info from the various insets in this buffer.
+ void collectBibKeys() const;
+ /// add some BiblioInfo to our cache
+ void addBiblioInfo(BiblioInfo const & bi) const;
+ /// add a single piece of bibliography info to our cache
+ void addBibTeXInfo(docstring const & key, BibTeXInfo const & bi) const;
/// Update the LaTeX preview snippets associated with this buffer
void updatePreviews() const;
/// Remove any previewed LaTeX snippets associated with this buffer
/// Update the LaTeX preview snippets associated with this buffer
void updatePreviews() const;
/// Remove any previewed LaTeX snippets associated with this buffer
/// Collect macro definitions in paragraphs
void updateMacros() const;
/// Iterate through the whole buffer and try to resolve macros
/// Collect macro definitions in paragraphs
void updateMacros() const;
/// Iterate through the whole buffer and try to resolve macros
/// List macro names of this buffer, the parent and the children
void listMacroNames(MacroNameSet & macros) const;
/// List macro names of this buffer, the parent and the children
void listMacroNames(MacroNameSet & macros) const;
- void getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end,
- bool full_source) const;
+ void getSourceCode(odocstream & os, std::string const format,
+ pit_type par_begin, pit_type par_end, OutputWhat output) const;
- bool doExport(std::string const & format, bool put_in_tempdir,
- bool includeall, std::string & result_file) const;
+ ExportStatus doExport(std::string const & target, bool put_in_tempdir) const;
- bool doExport(std::string const & format, bool put_in_tempdir,
- bool includeall = false) const;
+ ExportStatus doExport(std::string const & target, bool put_in_tempdir,
+ std::string & result_file) const;
- bool preview(std::string const & format, bool includeall = false) const;
+ ExportStatus preview(std::string const & format) const;
+
+private:
+ /// target is a format name optionally followed by a space
+ /// and a destination file-name
+ ExportStatus doExport(std::string const & target, bool put_in_tempdir,
+ bool includeall, std::string & result_file) const;
- bool isExportableFormat(std::string const & format) const;
- /// mark the buffer as busy exporting something, or not
- void setExportStatus(bool e) const;
+ void setMathFlavor(OutputParams & op) const;
+
+public:
/// do this one.
/// \param output: whether we are preparing for output.
void updateBuffer(UpdateScope scope, UpdateType utype) const;
/// do this one.
/// \param output: whether we are preparing for output.
void updateBuffer(UpdateScope scope, UpdateType utype) const;
void updateBuffer(ParIterator & parit, UpdateType utype) const;
/// Spellcheck starting from \p from.
void updateBuffer(ParIterator & parit, UpdateType utype) const;
/// Spellcheck starting from \p from.
/// Change name of buffer. Updates "read-only" flag.
void setFileName(support::FileName const & fname);
///
/// Change name of buffer. Updates "read-only" flag.
void setFileName(support::FileName const & fname);
///
void getLanguages(std::set<Language const *> &) const;
/// Checks whether any of the referenced bibfiles have changed since the
/// last time we loaded the cache. Note that this does NOT update the
void getLanguages(std::set<Language const *> &) const;
/// Checks whether any of the referenced bibfiles have changed since the
/// last time we loaded the cache. Note that this does NOT update the
void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
/// Return the list with all bibfiles in use (including bibfiles
/// of loaded child documents).
void updateBibfilesCache(UpdateScope scope = UpdateMaster) const;
/// Return the list with all bibfiles in use (including bibfiles
/// of loaded child documents).
getBibfilesCache(UpdateScope scope = UpdateMaster) const;
///
void collectChildren(ListOfBuffers & children, bool grand_children) const;
getBibfilesCache(UpdateScope scope = UpdateMaster) const;
///
void collectChildren(ListOfBuffers & children, bool grand_children) const;
/// Use the Pimpl idiom to hide the internals.
class Impl;
/// The pointer never changes although *pimpl_'s contents may.
/// Use the Pimpl idiom to hide the internals.
class Impl;
/// The pointer never changes although *pimpl_'s contents may.