2003-02-25 14:51:38 +00:00
|
|
|
// -*- C++ -*-
|
2003-03-14 00:20:42 +00:00
|
|
|
/**
|
|
|
|
* \file Kernel.h
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author Angus Leeming
|
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
#ifndef KERNEL_H
|
|
|
|
#define KERNEL_H
|
|
|
|
|
|
|
|
|
|
|
|
#include "LString.h"
|
|
|
|
|
|
|
|
|
|
|
|
class Buffer;
|
|
|
|
class BufferView;
|
|
|
|
class FuncRequest;
|
|
|
|
class LyXView;
|
|
|
|
|
|
|
|
|
2003-06-28 01:23:11 +00:00
|
|
|
/** \c Kernel is a wrapper making the LyX kernel available to the dialog.
|
2003-03-14 00:20:42 +00:00
|
|
|
* (Ie, it provides an interface to the Model part of the Model-Controller-
|
|
|
|
* View split.
|
|
|
|
* In an ideal world, it will shrink as more info is passed to the
|
|
|
|
* Dialog::show() and update() methods.
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
class Kernel {
|
|
|
|
public:
|
2003-03-14 00:20:42 +00:00
|
|
|
/// \param lv is the access point for the dialog to the LyX kernel.
|
|
|
|
Kernel(LyXView & lv);
|
|
|
|
|
|
|
|
/** This method is the primary prupose of the class. It provides
|
|
|
|
the "gateway" by which the dialog can send a request (of a
|
|
|
|
change in the data, for more information) to the kernel,
|
|
|
|
encoded as \param fr.
|
|
|
|
\param verbose Set to true if the completed action should
|
|
|
|
be displayed in the minibuffer.
|
|
|
|
*/
|
|
|
|
void dispatch(FuncRequest const & fr, bool verbose = false) const;
|
|
|
|
|
|
|
|
/** The dialog has received a request from the user
|
|
|
|
(who pressed the "Restore" buuton) to update contents.
|
|
|
|
It must, therefore, ask the kernel to provide this information.
|
|
|
|
\param name is used as an identifier by the kernel
|
|
|
|
when the information is posted.
|
|
|
|
*/
|
|
|
|
void updateDialog(string const & name) const;
|
|
|
|
|
|
|
|
/** A request from the Controller that future changes to the data
|
|
|
|
* stored by the dialog are not applied to the inset currently
|
|
|
|
* connected to the dialog. Instead, they will be used to generate
|
|
|
|
* a new inset at the cursor position.
|
|
|
|
*/
|
|
|
|
void disconnect(string const & name) const;
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/// Simple wrapper functions to Buffer methods.
|
|
|
|
bool isBufferAvailable() const;
|
|
|
|
bool isBufferReadonly() const;
|
|
|
|
//@}
|
|
|
|
|
|
|
|
//@{
|
|
|
|
/** \enum DocTypes is used to flag the different kinds of buffer
|
|
|
|
* without making the kernel header files available to the
|
|
|
|
* dialog's Controller or View.
|
|
|
|
*/
|
2003-02-25 14:51:38 +00:00
|
|
|
enum DocTypes {
|
|
|
|
LATEX,
|
|
|
|
LITERATE,
|
|
|
|
LINUXDOC,
|
|
|
|
DOCBOOK
|
|
|
|
};
|
2003-03-14 00:20:42 +00:00
|
|
|
/// The type of the current buffer.
|
|
|
|
DocTypes docType() const;
|
|
|
|
//@}
|
2003-02-25 14:51:38 +00:00
|
|
|
|
2003-03-14 00:20:42 +00:00
|
|
|
|
|
|
|
//@{
|
|
|
|
/** Unpleasantly public internals of the LyX kernel.
|
|
|
|
* We should aim to reduce/remove these from the interface.
|
2003-02-25 14:51:38 +00:00
|
|
|
*/
|
|
|
|
LyXView & lyxview() { return lyxview_; }
|
|
|
|
LyXView const & lyxview() const { return lyxview_; }
|
2003-03-14 00:20:42 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
Buffer * buffer();
|
|
|
|
Buffer const * buffer() const;
|
2003-03-14 00:20:42 +00:00
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
BufferView * bufferview();
|
|
|
|
BufferView const * bufferview() const;
|
2003-03-14 00:20:42 +00:00
|
|
|
//@}
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
LyXView & lyxview_;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#endif // KERNEL_H
|