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
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
#include "InsetCollapsible.h"
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
2002-05-29 16:21:03 +00:00
|
|
|
|
2017-10-16 08:03:05 +00:00
|
|
|
/** A collapsible 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;
|
|
|
|
|
2018-04-02 02:40:00 +00:00
|
|
|
namespace support {
|
|
|
|
class TempFile;
|
|
|
|
}
|
|
|
|
|
2017-10-16 08:12:21 +00:00
|
|
|
class InsetERT : public InsetCollapsible {
|
2000-02-25 12:06:15 +00:00
|
|
|
public:
|
2001-08-06 14:55:02 +00:00
|
|
|
///
|
2009-11-08 15:53:21 +00:00
|
|
|
InsetERT(Buffer *, CollapseStatus status = Open);
|
2018-04-02 02:40:00 +00:00
|
|
|
///
|
|
|
|
InsetERT(InsetERT const &);
|
|
|
|
///
|
|
|
|
InsetERT & operator=(InsetERT const &);
|
2001-07-08 12:52:16 +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);
|
2010-03-28 20:12:24 +00:00
|
|
|
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenuName() const
|
|
|
|
{ return "context-ert"; }
|
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
|
|
|
///
|
2011-03-28 22:33:04 +00:00
|
|
|
docstring layoutName() 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
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) 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
|
|
|
///
|
2009-11-19 21:52:18 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-06-06 04:20:57 +00:00
|
|
|
///
|
2001-08-18 15:01:09 +00:00
|
|
|
void validate(LaTeXFeatures &) 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;
|
2018-04-02 02:40:00 +00:00
|
|
|
///
|
|
|
|
bool editable() const;
|
|
|
|
///
|
|
|
|
bool descendable(BufferView const &) const;
|
2008-03-05 00:21:05 +00:00
|
|
|
///
|
|
|
|
Inset * clone() const { return new InsetERT(*this); }
|
2001-07-24 10:13:19 +00:00
|
|
|
///
|
2009-02-25 22:35:41 +00:00
|
|
|
docstring const buttonLabel(BufferView const & bv) const;
|
2003-11-07 09:40:49 +00:00
|
|
|
///
|
|
|
|
bool allowSpellCheck() const { return false; }
|
2018-04-02 02:40:00 +00:00
|
|
|
///
|
2018-07-10 05:11:59 +00:00
|
|
|
bool insetAllowed(InsetCode /* code */) const { return false; }
|
|
|
|
///
|
2018-04-02 02:40:00 +00:00
|
|
|
unique_ptr<support::TempFile> tempfile_;
|
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
|