X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Finsets%2FInsetLine.h;h=f518297445dd1b70d0145246c1a215fe1dc15b24;hb=131f4b92bac3ecb75b47c266dfa3d8543bd4d578;hp=5016eeda07b7e70b95280b39fb5aaa780e3792fb;hpb=39e79d8602920eefe36e898c9f415afb979521b2;p=lyx.git diff --git a/src/insets/InsetLine.h b/src/insets/InsetLine.h index 5016eeda07..f518297445 100644 --- a/src/insets/InsetLine.h +++ b/src/insets/InsetLine.h @@ -4,7 +4,9 @@ * This file is part of LyX, the document processor. * Licence details can be found in the file COPYING. * - * \author André Pönitz + * \author Abdelrazak Younes + * \author André Pönitz + * \author Uwe Stöhr * * Full author contact details are available in file CREDITS. */ @@ -13,45 +15,53 @@ #define INSET_LINE_H -#include "Inset.h" +#include "InsetCommand.h" namespace lyx { -class InsetLine : public InsetOld { -public: +class LaTeXFeatures; - InsetLine() {} +class InsetLine : public InsetCommand +{ +public: + InsetLine(Buffer * buf, InsetCommandParams const &); - InsetBase::Code lyxCode() const { return InsetBase::LINE_CODE; } + /// InsetCommand inherited methods. + //@{ + docstring screenLabel() const; + static ParamInfo const & findInfo(std::string const &); + static std::string defaultCommand() { return "rule"; } + static bool isCompatibleCommand(std::string const & s) + { return s == "rule"; } + //@} - bool metrics(MetricsInfo &, Dimension &) const; +private: + /// Inset inherited methods. + //@{ + InsetCode lyxCode() const { return LINE_CODE; } + int docbook(odocstream &, OutputParams const &) const; + /// Does nothing at the moment. + docstring xhtml(XHTMLStream &, OutputParams const &) const; + bool hasSettings() const { return true; } + void metrics(MetricsInfo &, Dimension &) const; void draw(PainterInfo & pi, int x, int y) const; - - int latex(Buffer const &, odocstream &, - OutputParams const &) const; - - int plaintext(Buffer const &, odocstream &, - OutputParams const &) const; - - int docbook(Buffer const &, odocstream &, - OutputParams const &) const; - - void read(Buffer const &, Lexer & lex); - - void write(Buffer const & buf, std::ostream & os) const; - /// We don't need \begin_inset and \end_inset - bool directWrite() const { return true; } - - bool display() const { return true; } - /// - void validate(LaTeXFeatures & features) const; -private: - virtual std::auto_ptr doClone() const - { - return std::auto_ptr(new InsetLine); - } + void latex(otexstream &, OutputParams const &) const; + int plaintext(odocstringstream & ods, OutputParams const & op, + size_t max_length = INT_MAX) const; + void doDispatch(Cursor & cur, FuncRequest & cmd); + bool getStatus(Cursor & cur, FuncRequest const & cmd, FuncStatus &) const; + Inset * clone() const { return new InsetLine(*this); } + //@} + + /// cached line height and offset. + /// These value are independent of the BufferView size and thus + /// can be shared between views. + //@{ + mutable int height_; + mutable int offset_; + //@} };