2000-02-25 12:06:15 +00:00
|
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
|
/**
|
|
|
|
|
* \file insetert.h
|
|
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
|
* Licence details can be found in the file COPYING.
|
2002-03-21 17:09:55 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* \author J<EFBFBD>rgen Vigna
|
|
|
|
|
* \author Lars Gullik Bj<EFBFBD>nnes
|
2000-02-25 12:06:15 +00:00
|
|
|
|
*
|
2002-09-25 14:26:13 +00:00
|
|
|
|
* Full author contact details are available in file CREDITS
|
2000-02-25 12:06:15 +00:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef INSETERT_H
|
|
|
|
|
#define INSETERT_H
|
|
|
|
|
|
|
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
|
#include "insetcollapsable.h"
|
2002-05-29 16:21:03 +00:00
|
|
|
|
|
2001-07-24 22:08:49 +00:00
|
|
|
|
/** A collapsable text inset for LaTeX insertions.
|
2002-03-21 17:09:55 +00:00
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
|
To write full ert (including styles and other insets) in a given
|
2001-10-31 15:19:49 +00:00
|
|
|
|
space.
|
|
|
|
|
|
|
|
|
|
Note that collapsed_ encompasses both the inline and collapsed button
|
2002-03-21 17:09:55 +00:00
|
|
|
|
versions of this inset.
|
2000-02-25 12:06:15 +00:00
|
|
|
|
*/
|
2002-02-20 14:55:17 +00:00
|
|
|
|
|
|
|
|
|
class Language;
|
|
|
|
|
|
2000-03-08 13:52:57 +00:00
|
|
|
|
class InsetERT : public InsetCollapsable {
|
2000-02-25 12:06:15 +00:00
|
|
|
|
public:
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
|
enum ERTStatus {
|
|
|
|
|
Open,
|
|
|
|
|
Collapsed,
|
|
|
|
|
Inlined
|
|
|
|
|
};
|
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
InsetERT(BufferParams const &, bool collapsed = false);
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2003-05-26 09:13:55 +00:00
|
|
|
|
InsetERT(InsetERT const &);
|
2001-07-27 12:03:36 +00:00
|
|
|
|
///
|
2003-05-26 09:13:55 +00:00
|
|
|
|
Inset * clone(Buffer const &) const;
|
|
|
|
|
///
|
2002-03-03 20:25:07 +00:00
|
|
|
|
InsetERT(BufferParams const &,
|
|
|
|
|
Language const *, string const & contents, bool collapsed);
|
2001-07-08 12:52:16 +00:00
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
|
~InsetERT();
|
|
|
|
|
///
|
2001-07-27 12:03:36 +00:00
|
|
|
|
Inset::Code lyxCode() const { return Inset::ERT_CODE; }
|
|
|
|
|
///
|
2001-07-24 22:08:49 +00:00
|
|
|
|
void read(Buffer const * buf, LyXLex & lex);
|
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
void write(Buffer const * buf, std::ostream & os) const;
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
string const editMessage() const;
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
bool insertInset(BufferView *, Inset *);
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2003-03-12 19:16:42 +00:00
|
|
|
|
bool insetAllowed(Inset::Code code) const { return code == Inset::NEWLINE_CODE; }
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
void setFont(BufferView *, LyXFont const &,
|
2002-03-21 17:09:55 +00:00
|
|
|
|
bool toggleall = false, bool selectall = false);
|
2000-06-28 13:35:52 +00:00
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
|
EDITABLE editable() const;
|
|
|
|
|
///
|
2003-05-23 08:59:47 +00:00
|
|
|
|
int latex(Buffer const *, std::ostream &,
|
|
|
|
|
LatexRunParams const &) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
int ascii(Buffer const *,
|
2002-03-21 17:09:55 +00:00
|
|
|
|
std::ostream &, int linelen = 0) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2001-07-24 15:07:09 +00:00
|
|
|
|
int linuxdoc(Buffer const *, std::ostream &) const;
|
|
|
|
|
///
|
2002-06-18 15:44:30 +00:00
|
|
|
|
int docbook(Buffer const *, std::ostream &, bool mixcont) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
|
///
|
2001-08-18 15:01:09 +00:00
|
|
|
|
void validate(LaTeXFeatures &) const {}
|
|
|
|
|
///
|
2002-08-13 17:43:40 +00:00
|
|
|
|
RESULT localDispatch(FuncRequest const &);
|
2001-07-27 12:03:36 +00:00
|
|
|
|
///
|
|
|
|
|
bool checkInsertChar(LyXFont &);
|
2001-07-31 09:53:40 +00:00
|
|
|
|
///
|
|
|
|
|
// this are needed here because of the label/inlined functionallity
|
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
|
bool needFullRow() const { return status_ == Open; }
|
|
|
|
|
///
|
|
|
|
|
bool isOpen() const { return status_ == Open || status_ == Inlined; }
|
|
|
|
|
///
|
2001-10-31 15:19:49 +00:00
|
|
|
|
bool inlined() const { return status_ == Inlined; }
|
|
|
|
|
///
|
|
|
|
|
ERTStatus status() const { return status_; }
|
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
|
void open(BufferView *);
|
|
|
|
|
///
|
2001-08-07 15:07:36 +00:00
|
|
|
|
void close(BufferView *) const;
|
2001-07-31 09:53:40 +00:00
|
|
|
|
///
|
2003-02-08 19:18:01 +00:00
|
|
|
|
bool allowSpellcheck() const { return false; }
|
2002-08-06 22:38:44 +00:00
|
|
|
|
|
2002-08-13 14:40:38 +00:00
|
|
|
|
WordLangTuple const
|
|
|
|
|
selectNextWordToSpellcheck(BufferView *, float &) const;
|
2001-09-24 14:29:27 +00:00
|
|
|
|
///
|
2003-05-19 17:03:12 +00:00
|
|
|
|
void dimension(BufferView *, LyXFont const &, Dimension &) const;
|
2001-07-31 09:53:40 +00:00
|
|
|
|
///
|
2003-03-17 01:34:36 +00:00
|
|
|
|
void draw(BufferView *, const LyXFont &, int , float &) const;
|
2001-10-31 15:19:49 +00:00
|
|
|
|
/// set the status of the inset
|
2001-08-07 15:07:36 +00:00
|
|
|
|
void status(BufferView *, ERTStatus const st) const;
|
2001-08-06 14:55:02 +00:00
|
|
|
|
///
|
|
|
|
|
bool showInsetDialog(BufferView *) const;
|
2002-01-20 16:49:37 +00:00
|
|
|
|
///
|
2002-02-20 14:55:17 +00:00
|
|
|
|
void getDrawFont(LyXFont &) const;
|
|
|
|
|
///
|
2002-01-20 16:49:37 +00:00
|
|
|
|
bool forceDefaultParagraphs(Inset const *) const {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2002-03-05 14:55:20 +00:00
|
|
|
|
///
|
|
|
|
|
int getMaxWidth(BufferView *, UpdatableInset const *) const;
|
2002-05-31 12:17:28 +00:00
|
|
|
|
///
|
2003-03-20 14:13:49 +00:00
|
|
|
|
void update(BufferView *, bool =false);
|
2001-07-27 12:03:36 +00:00
|
|
|
|
|
2001-07-24 10:13:19 +00:00
|
|
|
|
private:
|
2002-08-19 10:11:13 +00:00
|
|
|
|
///
|
|
|
|
|
void lfunMousePress(FuncRequest const &);
|
|
|
|
|
///
|
|
|
|
|
// the bool return is used to see if we opened a dialog so that we can
|
|
|
|
|
// check this from an outer inset and open the dialog of the outer inset
|
|
|
|
|
// if that one has one!
|
|
|
|
|
///
|
|
|
|
|
bool lfunMouseRelease(FuncRequest const &);
|
|
|
|
|
///
|
|
|
|
|
void lfunMouseMotion(FuncRequest const &);
|
2001-07-24 10:13:19 +00:00
|
|
|
|
///
|
|
|
|
|
void init();
|
2001-07-24 22:08:49 +00:00
|
|
|
|
///
|
|
|
|
|
string const get_new_label() const;
|
2001-07-25 19:45:21 +00:00
|
|
|
|
///
|
2001-08-07 15:07:36 +00:00
|
|
|
|
void setButtonLabel() const;
|
2001-07-31 09:53:40 +00:00
|
|
|
|
///
|
|
|
|
|
void set_latex_font(BufferView *);
|
2001-10-31 15:19:49 +00:00
|
|
|
|
/// update status on button
|
|
|
|
|
void updateStatus(BufferView *, bool = false) const;
|
2001-08-06 14:55:02 +00:00
|
|
|
|
|
|
|
|
|
///
|
2001-08-07 15:07:36 +00:00
|
|
|
|
mutable ERTStatus status_;
|
2000-02-25 12:06:15 +00:00
|
|
|
|
};
|
|
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
|
|
|
|
|
|
#include "mailinset.h"
|
|
|
|
|
|
|
|
|
|
class InsetERTMailer : public MailInset {
|
|
|
|
|
public:
|
|
|
|
|
///
|
|
|
|
|
InsetERTMailer(InsetERT & inset);
|
|
|
|
|
///
|
2003-03-10 13:33:39 +00:00
|
|
|
|
virtual InsetBase & inset() const { return inset_; }
|
2003-02-25 14:51:38 +00:00
|
|
|
|
///
|
|
|
|
|
virtual string const & name() const { return name_; }
|
|
|
|
|
///
|
|
|
|
|
virtual string const inset2string() const;
|
|
|
|
|
///
|
|
|
|
|
static void string2params(string const &, InsetERT::ERTStatus &);
|
|
|
|
|
///
|
2003-03-07 14:08:10 +00:00
|
|
|
|
static string const params2string(InsetERT::ERTStatus);
|
2003-02-25 14:51:38 +00:00
|
|
|
|
private:
|
|
|
|
|
///
|
2003-03-07 14:08:10 +00:00
|
|
|
|
static string const name_;
|
2003-02-25 14:51:38 +00:00
|
|
|
|
///
|
|
|
|
|
InsetERT & inset_;
|
|
|
|
|
};
|
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
|
#endif
|