#ifndef BUFFER_H
#define BUFFER_H
-#include "DocIterator.h"
+#include "insets/InsetCode.h"
#include "support/FileName.h"
#include "support/limited_stack.h"
#include "support/docstring.h"
#include "support/docstream.h"
-#include <boost/signal.hpp>
-
#include <iosfwd>
#include <string>
#include <utility>
namespace lyx {
class BufferParams;
+class EmbeddedFiles;
class ErrorItem;
class ErrorList;
class FuncRequest;
class Inset;
-class InsetText;
class Font;
class Lexer;
class LyXRC;
class Undo;
namespace frontend {
+class GuiBufferDelegate;
class WorkAreaManager;
}
* I am not sure if the class is complete or
* minimal, probably not.
* \author Lars Gullik Bjønnes
- */
+ */
class Buffer {
public:
/// What type of log will \c getLogName() return?
/// do we have a paragraph with this id?
bool hasParWithID(int id) const;
- /// This signal is emitted when the buffer is changed.
- void changed();
-
///
frontend::WorkAreaManager & workAreaManager() const;
- /// This signal is emitted when the buffer structure is changed.
- boost::signal<void()> structureChanged;
- /// This signal is emitted when an embedded file is changed
- boost::signal<void()> embeddingChanged;
- /// This signal is emitted when some parsing error shows up.
- boost::signal<void(std::string)> errors;
- /// This signal is emitted when some message shows up.
- boost::signal<void(docstring)> message;
- /// This signal is emitted when the buffer busy status change.
- boost::signal<void(bool)> busy;
- /// This signal is emitted when the buffer readonly status change.
- boost::signal<void(bool)> readonly;
- /// Update window titles of all users.
- boost::signal<void()> updateTitles;
- /// Reset autosave timers for all users.
- boost::signal<void()> resetAutosaveTimers;
-
-
/** Save file.
Takes care of auto-save files and backup file if requested.
Returns \c true if the save is successful, \c false otherwise.
void markClean() const;
///
- void markBakClean();
+ void markBakClean() const;
///
void markDepClean(std::string const & name);
///
bool isMultiLingual() const;
- /// Does this mean that this is buffer local?
- limited_stack<Undo> & undostack();
- limited_stack<Undo> const & undostack() const;
-
- /// Does this mean that this is buffer local?
- limited_stack<Undo> & redostack();
- limited_stack<Undo> const & redostack() const;
-
///
BufferParams & params();
BufferParams const & params() const;
///
void insertMacro(docstring const & name, MacroData const & data);
- ///
+ /// Replace the inset contents for insets which InsetCode is equal
+ /// to the passed \p inset_code.
void changeRefsIfUnique(docstring const & from, docstring const & to,
- Inset::Code code);
+ InsetCode code);
+
/// get source code (latex/docbook) for some paragraphs, or all paragraphs
/// including preamble
void getSourceCode(odocstream & os, pit_type par_begin, pit_type par_end, bool full_source);
EmbeddedFiles const & embeddedFiles() const;
//@}
+ Undo & undo();
+
+ /// This function is called when the buffer is changed.
+ void changed() const;
+ /// This function is called when the buffer structure is changed.
+ void structureChanged() const;
+ /// This function is called when an embedded file is changed
+ void embeddingChanged() const;
+ /// This function is called when some parsing error shows up.
+ void errors(std::string const & err) const;
+ /// This function is called when the buffer busy status change.
+ void busy(bool on) const;
+ /// This function is called when the buffer readonly status change.
+ void readonly(bool on) const;
+ /// Update window titles of all users.
+ void updateTitles() const;
+ /// Reset autosave timers for all users.
+ void resetAutosaveTimers() const;
+ ///
+ void message(docstring const & msg) const;
+
+ void setGuiDelegate(frontend::GuiBufferDelegate * gui);
+
+ ///
+ void autoSave() const;
+ ///
+ bool writeAs(std::string const & newname = std::string());
+ ///
+ bool menuWrite();
+
private:
/** Inserts a file into a document
\return \c false if method fails.
/// A cache for the bibfiles (including bibfiles of loaded child
/// documents), needed for appropriate update of natbib labels.
mutable std::vector<support::FileName> bibfilesCache_;
+
+ frontend::GuiBufferDelegate * gui_;
};