2003-10-27 12:41:26 +00:00
|
|
|
// -*- C++ -*-
|
|
|
|
/**
|
2007-04-25 01:24:38 +00:00
|
|
|
* \file InsetLine.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.
|
|
|
|
*
|
2010-09-17 01:28:08 +00:00
|
|
|
* \author Abdelrazak Younes
|
2008-11-14 15:58:50 +00:00
|
|
|
* \author André Pönitz
|
2010-09-07 00:41:00 +00:00
|
|
|
* \author Uwe Stöhr
|
2003-10-27 12:41:26 +00:00
|
|
|
*
|
|
|
|
* Full author contact details are available in file CREDITS.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef INSET_LINE_H
|
|
|
|
#define INSET_LINE_H
|
|
|
|
|
|
|
|
|
2010-09-07 00:41:00 +00:00
|
|
|
#include "InsetCommand.h"
|
2003-10-27 12:41:26 +00:00
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
namespace lyx {
|
|
|
|
|
2010-09-07 00:41:00 +00:00
|
|
|
class LaTeXFeatures;
|
|
|
|
|
2010-09-16 10:14:46 +00:00
|
|
|
class InsetLine : public InsetCommand
|
|
|
|
{
|
2003-10-27 12:41:26 +00:00
|
|
|
public:
|
2010-09-07 00:41:00 +00:00
|
|
|
InsetLine(Buffer * buf, InsetCommandParams const &);
|
2010-09-16 10:14:46 +00:00
|
|
|
|
|
|
|
/// InsetCommand inherited methods.
|
|
|
|
//@{
|
2010-09-07 00:41:00 +00:00
|
|
|
docstring screenLabel() const;
|
|
|
|
static ParamInfo const & findInfo(std::string const &);
|
|
|
|
static std::string defaultCommand() { return "rule"; };
|
2010-09-15 12:43:07 +00:00
|
|
|
static bool isCompatibleCommand(std::string const & s)
|
2010-09-16 10:14:46 +00:00
|
|
|
{ return s == "rule"; }
|
|
|
|
//@}
|
2010-09-15 12:43:07 +00:00
|
|
|
|
2010-09-07 00:41:00 +00:00
|
|
|
private:
|
2010-09-16 10:14:46 +00:00
|
|
|
|
|
|
|
/// Inset inherited methods.
|
|
|
|
//@{
|
|
|
|
InsetCode lyxCode() const { return LINE_CODE; }
|
|
|
|
Dimension const dimension(BufferView const &) const;
|
|
|
|
int docbook(odocstream &, OutputParams const &) const;
|
|
|
|
/// Does nothing at the moment.
|
|
|
|
docstring xhtml(XHTMLStream &, OutputParams const &) const;
|
|
|
|
bool hasSettings() const { return true; }
|
2007-09-21 20:39:47 +00:00
|
|
|
void metrics(MetricsInfo &, Dimension &) const;
|
2003-10-27 12:41:26 +00:00
|
|
|
void draw(PainterInfo & pi, int x, int y) const;
|
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-02-27 20:43:16 +00:00
|
|
|
int plaintext(odocstream &, OutputParams const &) const;
|
2010-09-07 00:41:00 +00:00
|
|
|
void doDispatch(Cursor & cur, FuncRequest & cmd);
|
|
|
|
bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const;
|
2008-02-29 20:16:04 +00:00
|
|
|
Inset * clone() const { return new InsetLine(*this); }
|
2010-09-16 10:14:46 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/// cached line height and offset.
|
|
|
|
/// These value are independent of the BufferView size and thus
|
|
|
|
/// can be shared between views.
|
|
|
|
//@{
|
2010-09-16 07:36:20 +00:00
|
|
|
mutable int height_;
|
|
|
|
mutable int offset_;
|
2010-09-16 10:14:46 +00:00
|
|
|
//@}
|
2003-10-27 12:41:26 +00:00
|
|
|
};
|
|
|
|
|
2006-10-21 00:16:43 +00:00
|
|
|
|
|
|
|
} // namespace lyx
|
|
|
|
|
2003-10-27 12:41:26 +00:00
|
|
|
#endif // INSET_NEWLINE_H
|