2000-02-25 12:06:15 +00:00
|
|
|
// -*- C++ -*-
|
2002-09-25 14:26:13 +00:00
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetERT.h
|
2002-09-25 14:26:13 +00:00
|
|
|
* 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
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author Jürgen Vigna
|
|
|
|
* \author Lars Gullik Bjønnes
|
2000-02-25 12:06:15 +00:00
|
|
|
*
|
2003-08-23 00:17:00 +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
|
|
|
|
|
2007-04-25 01:24:38 +00:00
|
|
|
#include "InsetCollapsable.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
namespace lyx {
|
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:
|
2001-08-06 14:55:02 +00:00
|
|
|
///
|
2008-03-04 22:28:18 +00:00
|
|
|
InsetERT(Buffer const &, CollapseStatus status = Open);
|
2001-07-08 12:52:16 +00:00
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
~InsetERT();
|
2008-03-26 23:41:35 +00:00
|
|
|
///
|
2008-03-27 23:37:59 +00:00
|
|
|
static CollapseStatus string2params(std::string const &);
|
2008-03-26 23:41:35 +00:00
|
|
|
///
|
|
|
|
static std::string params2string(CollapseStatus);
|
2008-03-05 00:21:05 +00:00
|
|
|
private:
|
2001-08-06 14:55:02 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return ERT_CODE; }
|
2001-07-27 12:03:36 +00:00
|
|
|
///
|
2007-04-30 14:39:09 +00:00
|
|
|
docstring name() const { return from_ascii("ERT"); }
|
2007-04-29 12:32:14 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
docstring editMessage() const;
|
2000-06-28 13:35:52 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
bool insetAllowed(InsetCode code) const;
|
2001-08-06 14:55:02 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int latex(odocstream &, OutputParams const &) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2001-06-27 14:10:35 +00:00
|
|
|
///
|
2001-08-18 15:01:09 +00:00
|
|
|
void validate(LaTeXFeatures &) const {}
|
|
|
|
///
|
2001-08-06 14:55:02 +00:00
|
|
|
bool showInsetDialog(BufferView *) const;
|
Fix bug 4037 and related problems. The patch has been cleaned up a bit
from the one posted to the list.
The basic idea has two parts. First, we hard code an "empty layout"
(called PlainLayout, for want of a better name) in TextClass and read it
before doing anything else. It can therefore be customized by classes,
if they want---say, to make it left-aligned. Second, InsetText's are
divided into three types: (i) normal ones, that use the "default" layout
defined by the text class; (ii) highly restrictive ones, such as ERT and
(not quite an inset) table cells, which demand the empty layout; (iii)
middling ones, which default to an empty layout and use the empty layout
in place of the default. (This is so we don't get the same problem we
had with ERT in e.g. footnotes.) The type of inset is signaled by new
methods InsetText::forceEmptyLayout() and InsetText::useEmptyLayout().
(The latter might better be called: useEmptyLayoutInsteadOfDefault(),
but that's silly.) The old InsetText::forceDefaultParagraphs() has been
split into these, plus a new method InsetText::allowParagraphCustomization().
A lot of the changes just adapt to this change.
The other big change is in GuiToolbar: We want to show LyXDefault and
the "default" layout only when they're active.
There are a handful of places where I'm not entirely sure whether we
should be using forceEmptyLayout or !allowParagraphCustomization() or
both. The InsetCaption is one of these. These places, and some others,
are marked with FIXMEs, so I'd appreciate it if people would search
through the patch and let me know whether these need changing. If they
don't, the FIXMEs can be deleted.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22966 a592a061-630c-0410-9148-cb99ea01b6c8
2008-02-12 17:31:07 +00:00
|
|
|
/// should paragraph indendation be omitted in any case?
|
2008-02-27 20:43:16 +00:00
|
|
|
bool neverIndent() const { return true; }
|
2003-10-17 18:01:15 +00:00
|
|
|
///
|
2008-03-05 00:21:05 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2004-11-04 19:50:04 +00:00
|
|
|
///
|
2007-04-26 14:56:30 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetERT(*this); }
|
2001-07-24 10:13:19 +00:00
|
|
|
///
|
2003-12-12 14:02:14 +00:00
|
|
|
void setButtonLabel();
|
2003-11-07 09:40:49 +00:00
|
|
|
///
|
|
|
|
bool allowSpellCheck() const { return false; }
|
2000-02-25 12:06:15 +00:00
|
|
|
};
|
|
|
|
|
2003-02-25 14:51:38 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2000-02-25 12:06:15 +00:00
|
|
|
#endif
|