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,
|
|
|
|
///
|
|
|
|
CLEARDOUBLEPAGE
|
|
|
|
};
|
|
|
|
///
|
|
|
|
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-25 09:26:03 +00:00
|
|
|
///
|
|
|
|
InsetNewpageParams params() const { return params_; }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2007-11-23 02:10:00 +00:00
|
|
|
InsetCode lyxCode() const { return NEWPAGE_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
|
|
|
///
|
2003-10-27 12:41:26 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
Introduce a wrapper class for odocstream to help ensuring that no
blank lines may be inadvertently output. This is achieved by using two
special iomanip-like variables (breakln and safebreakln) in the lyx::
namespace. When they are inserted in the stream, a newline is output
only if not already at the beginning of a line. The difference between
breakln and safebreakln is that, if needed, the former outputs '\n'
and the latter "%\n".
In future, the new class will also be used for counting the number of
newlines issued. Even if the infractrure for doing that is already in
place, the counting is essentially still done the old way.
There are still places in the code where the functionality of the
class could be used, most probably. ATM, it is used for InsetTabular,
InsetListings, InsetFloat, and InsetText.
The Comment and GreyedOut insets required a special treatment and a
new InsetLayout parameter (Display) has been introduced. The default
for Display is "true", meaning that the corresponding latex
environment is of "display" type, i.e., it stands on its own, whereas
"false" means that the contents appear inline with the text. The
latter is the case for both Comment and GreyedOut insets.
Mostly, the only visible effects on latex exports should be the
disappearing of some redundant % chars and the appearing/disappearing
of null {} latex groups after a comment or lyxgreyedout environments
(they are related to the presence or absence of a space immediately
after those environments), as well as the fact that math environments
are now started on their own lines.
As a last thing, only the latex code between \begin{document} and
\end{document} goes through the new class, the preamble being directly
output through odocstream, as usual.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37360 a592a061-630c-0410-9148-cb99ea01b6c8
2011-01-29 02:41:13 +00:00
|
|
|
int latex(otexstream &, OutputParams const &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2009-11-25 22:00:29 +00:00
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
2009-06-05 17:48:14 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
void read(Lexer & lex);
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-02-27 20:43:16 +00:00
|
|
|
void write(std::ostream & os) const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2007-05-18 14:32:29 +00:00
|
|
|
DisplayType display() const { return AlignCenter; }
|
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
|
|
|
///
|
2010-11-29 21:27:25 +00:00
|
|
|
docstring contextMenuName() const;
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-02-29 20:17:28 +00:00
|
|
|
Inset * clone() const { return new InsetNewpage(*this); }
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
2008-03-15 00:02:41 +00:00
|
|
|
///
|
2008-03-25 09:26:03 +00:00
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
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
|