2003-10-27 12:41:26 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-11-23 02:10:00 +00:00
|
|
|
* \file InsetNewpage.h
|
2003-10-27 12:41:26 +00:00
|
|
|
* This file is part of LyX, the document processor.
|
|
|
|
* Licence details can be found in the file COPYING.
|
|
|
|
*
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2003-10-27 12:41:26 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
2007-11-23 02:10:00 +00:00
|
|
|
#ifndef INSET_NEWPAGE_H
|
|
|
|
#define INSET_NEWPAGE_H
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2007-04-29 13:39:47 +00:00
|
|
|
#include "Inset.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2008-03-27 22:26:24 +00:00
|
|
|
class InsetNewpageParams
|
|
|
|
{
|
2008-03-25 09:26:03 +00:00
|
|
|
public:
|
|
|
|
/// The different kinds of spaces we support
|
|
|
|
enum Kind {
|
|
|
|
///
|
|
|
|
NEWPAGE,
|
|
|
|
///
|
|
|
|
PAGEBREAK,
|
|
|
|
///
|
|
|
|
CLEARPAGE,
|
|
|
|
///
|
2020-10-13 17:13:59 +00:00
|
|
|
CLEARDOUBLEPAGE,
|
|
|
|
///
|
|
|
|
NOPAGEBREAK
|
2008-03-25 09:26:03 +00:00
|
|
|
};
|
|
|
|
///
|
|
|
|
InsetNewpageParams() : kind(NEWPAGE) {}
|
|
|
|
///
|
|
|
|
void write(std::ostream & os) const;
|
|
|
|
///
|
|
|
|
void read(Lexer & lex);
|
|
|
|
///
|
|
|
|
Kind kind;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2008-03-15 00:02:41 +00:00
|
|
|
class InsetNewpage : public Inset
|
|
|
|
{
|
2003-10-27 12:41:26 +00:00
|
|
|
public:
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
InsetNewpage();
|
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
explicit InsetNewpage(InsetNewpageParams const & par);
|
|
|
|
///
|
|
|
|
static void string2params(std::string const &, InsetNewpageParams &);
|
|
|
|
///
|
|
|
|
static std::string params2string(InsetNewpageParams const &);
|
|
|
|
private:
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
InsetCode lyxCode() const override { return NEWPAGE_CODE; }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void latex(otexstream &, OutputParams const &) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2013-03-08 19:52:18 +00:00
|
|
|
int plaintext(odocstringstream & ods, OutputParams const & op,
|
2020-10-01 07:42:11 +00:00
|
|
|
size_t max_length = INT_MAX) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void docbook(XMLStream &, OutputParams const &) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
docstring xhtml(XMLStream &, OutputParams const &) const override;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void read(Lexer & lex) override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void write(std::ostream & os) const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2021-07-11 22:07:59 +00:00
|
|
|
int rowFlags() const override { return (params_.kind == InsetNewpageParams::NOPAGEBREAK) ? Inline : Display; }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
docstring insetLabel() const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
ColorCode ColorName() const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
std::string contextMenuName() const override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
Inset * clone() const override { return new InsetNewpage(*this); }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd) override;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2020-10-01 07:42:11 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const override;
|
2006-10-21 00:16:43 +00:00
|
|
|
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-27 22:26:24 +00:00
|
|
|
InsetNewpageParams params_;
|
2006-11-25 15:09:01 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
} // namespace lyx
|
|
|
|
|
2007-11-23 02:10:00 +00:00
|
|
|
#endif // INSET_NEWPAGE_H
|