]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNewline.h
* Inset: Prepare for an eventual merge of updateLabels() and addToToc()
[lyx.git] / src / insets / InsetNewline.h
index 9abeb78ced63e71cf2eb1fd2ece2b53521d80ea2..7e5ee37bbf8cfe88c46abf6bd45cbf8b69d5ce07 100644 (file)
 
 
 #include "Inset.h"
+#include "support/gettext.h"
 
 
 namespace lyx {
 
-class InsetNewline : public InsetOld {
+class InsetNewline : public Inset {
 public:
 
        InsetNewline() {}
 
-       InsetBase::Code lyxCode() const { return InsetBase::NEWLINE_CODE; }
+       InsetCode lyxCode() const { return NEWLINE_CODE; }
 
-       bool metrics(MetricsInfo &, Dimension &) const;
+       void metrics(MetricsInfo &, Dimension &) const;
 
        virtual void draw(PainterInfo & pi, int x, int y) const;
 
@@ -37,16 +38,44 @@ public:
 
        virtual void read(Buffer const &, Lexer & lex);
 
-       virtual void write(Buffer const & buf, std::ostream & os) const;
+       virtual void write(Buffer const &, std::ostream & os) const;
        /// We don't need \begin_inset and \end_inset
        virtual bool directWrite() const { return true; }
        /// is this equivalent to a space (which is BTW different from
        // a line separator)?
        bool isSpace() const;
+
+       virtual docstring insetLabel() const { return docstring(); }
+
+       virtual std::string getLyXName() const { return "\\newline"; }
+
+       virtual std::string getCmdName() const { return "\\\\"; }
+
+       virtual ColorCode ColorName() const { return Color_eolmarker; }
+
+private:
+       virtual Inset * clone() const
+       {
+               return new InsetNewline;
+       }
+};
+
+class InsetLinebreak : public InsetNewline {
+public:
+       InsetLinebreak() {}
+
+       docstring insetLabel() const { return _("line break"); }
+
+       std::string getLyXName() const { return "\\linebreak"; }
+
+       std::string getCmdName() const { return "\\linebreak{}"; }
+
+       ColorCode ColorName() const { return Color_pagebreak; }
+
 private:
-       virtual std::auto_ptr<InsetBase> doClone() const
+       virtual Inset * clone() const
        {
-               return std::auto_ptr<InsetBase>(new InsetNewline);
+               return new InsetLinebreak;
        }
 };