2003-03-12 19:16:42 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetNewline.h
|
2003-03-12 19:16:42 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
|
|
|
* \author John Levon
|
|
|
|
*
|
2003-08-23 00:17:00 +00:00
|
|
|
* Full author contact details are available in file CREDITS.
|
2003-03-12 19:16:42 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSET_NEWLINE_H
|
|
|
|
#define INSET_NEWLINE_H
|
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
#include "Inset.h"
|
2003-03-12 19:16:42 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
class InsetNewlineParams
|
|
|
|
{
|
2008-03-26 08:10:01 +00:00
|
|
|
public:
|
|
|
|
/// The different kinds of spaces we support
|
|
|
|
enum Kind {
|
|
|
|
///
|
|
|
|
NEWLINE,
|
|
|
|
///
|
|
|
|
LINEBREAK
|
|
|
|
};
|
|
|
|
///
|
|
|
|
InsetNewlineParams() : kind(NEWLINE) {}
|
|
|
|
///
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
|
|
|
Kind kind;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-15 00:02:41 +00:00
|
|
|
class InsetNewline : public Inset
|
|
|
|
{
|
2003-03-12 19:16:42 +00:00
|
|
|
public:
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-26 08:10:01 +00:00
|
|
|
InsetNewline();
|
|
|
|
///
|
2019-09-17 21:06:18 +00:00
|
|
|
explicit InsetNewline(InsetNewlineParams par) : Inset(0)
|
2009-11-08 15:53:21 +00:00
|
|
|
{ params_.kind = par.kind; }
|
2008-03-27 22:26:24 +00:00
|
|
|
///
|
2020-06-22 21:11:40 +00:00
|
|
|
RowFlags rowFlags() const { return BreakAfter | RowAfter; }
|
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
static void string2params(std::string const &, InsetNewlineParams &);
|
|
|
|
///
|
|
|
|
static std::string params2string(InsetNewlineParams const &);
|
|
|
|
private:
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2007-10-13 09:04:52 +00:00
|
|
|
InsetCode lyxCode() const { return NEWLINE_CODE; }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
|
|
|
///
|
2011-02-10 20:02:48 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
|
|
|
size_t max_length = INT_MAX) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-06-08 21:27:49 +00:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2019-05-09 23:35:40 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2008-03-15 00:02:41 +00:00
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
|
|
|
void write(std::ostream & os) const;
|
2004-02-20 10:32:44 +00:00
|
|
|
/// is this equivalent to a space (which is BTW different from
|
2008-02-23 03:48:57 +00:00
|
|
|
/// a line separator)?
|
2008-03-26 08:10:01 +00:00
|
|
|
bool isSpace() const { return true; }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-26 08:10:01 +00:00
|
|
|
ColorCode ColorName() const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2011-10-29 14:48:55 +00:00
|
|
|
std::string contextMenuName() const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-02-29 20:16:04 +00:00
|
|
|
Inset * clone() const { return new InsetNewline(*this); }
|
2008-03-26 08:10:01 +00:00
|
|
|
///
|
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
///
|
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
|
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetNewlineParams params_;
|
2007-11-25 18:34:37 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-03-12 19:16:42 +00:00
|
|
|
#endif // INSET_NEWLINE_H
|