]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetNote.h
Loop refactoring
[lyx.git] / src / insets / InsetNote.h
index 050ee435b9c2177cfdc7d3d5becd0efb36ba2d7b..aeab8f038b282084ec43a7636b4ffacfd500efb0 100644 (file)
@@ -9,16 +9,16 @@
  * Full author contact details are available in file CREDITS.
  */
 
-#ifndef INSETNOTE_H
-#define INSETNOTE_H
+#ifndef INSET_NOTE_H
+#define INSET_NOTE_H
 
-#include "InsetCollapsable.h"
-#include "MailInset.h"
+#include "InsetCollapsible.h"
 
 
 namespace lyx {
 
-class InsetNoteParams {
+class InsetNoteParams
+{
 public:
        enum Type {
                Note,
@@ -36,87 +36,78 @@ public:
 };
 
 
-/** The PostIt note inset, and other annotations
+/////////////////////////////////////////////////////////////////////////
+//
+// InsetNote
+//
+/////////////////////////////////////////////////////////////////////////
 
-*/
-class InsetNote : public InsetCollapsable {
+/// The PostIt note inset, and other annotations
+class InsetNote : public InsetCollapsible
+{
 public:
        ///
-       InsetNote(Buffer const &, std::string const &);
+       InsetNote(Buffer *, std::string const &);
        ///
        ~InsetNote();
        ///
-       docstring editMessage() const;
+       static std::string params2string(InsetNoteParams const &);
        ///
-       InsetCode lyxCode() const { return NOTE_CODE; }
+       static void string2params(std::string const &, InsetNoteParams &);
        ///
-       docstring name() const;
+       InsetNoteParams const & params() const { return params_; }
+private:
        ///
-       virtual DisplayType display() const;
+       InsetCode lyxCode() const override { return NOTE_CODE; }
        ///
-       void write(std::ostream &) const;
+       docstring layoutName() const override;
+       /** returns false if, when outputting LaTeX, font changes should
+           be closed before generating this inset. This is needed for
+           insets that may contain several paragraphs */
+       bool inheritFont() const override { return params_.type == InsetNoteParams::Note; }
+       /// Is the content of this inset part of the output document?
+       bool producesOutput() const override
+               { return params_.type == InsetNoteParams::Greyedout; }
        ///
-       void read(Lexer & lex);
+       bool allowSpellCheck() const override;
        ///
-       void setButtonLabel();
-       /// show the note dialog
-       bool showInsetDialog(BufferView * bv) const;
+       FontInfo getFont() const override;
        ///
-       bool isMacroScope() const;
+       void write(std::ostream &) const override;
        ///
-       int latex(odocstream &, OutputParams const &) const;
+       void read(Lexer & lex) override;
+       /// show the note dialog
+       bool showInsetDialog(BufferView * bv) const override;
        ///
-       int plaintext(odocstream &, OutputParams const &) const;
+       bool isMacroScope() const override;
        ///
-       int docbook(odocstream &, OutputParams const &) const;
+       void latex(otexstream &, OutputParams const &) const override;
        ///
-       void validate(LaTeXFeatures &) const;
+       int plaintext(odocstringstream & ods, OutputParams const & op,
+                     size_t max_length = INT_MAX) const override;
        ///
-       InsetNoteParams const & params() const { return params_; }
+       void docbook(XMLStream &, OutputParams const &) const override;
        ///
-       bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const;
-       // Update the counters of this inset and of its contents
-       void updateLabels(ParIterator const &);
+       docstring xhtml(XMLStream &, OutputParams const &) const override;
        ///
-       void addToToc(ParConstIterator const &) const;
-protected:
-       InsetNote(InsetNote const &);
+       void validate(LaTeXFeatures &) const override;
        ///
-       virtual void doDispatch(Cursor & cur, FuncRequest & cmd);
-private:
-       friend class InsetNoteParams;
+       bool getStatus(Cursor &, FuncRequest const &, FuncStatus &) const override;
+       ///
+       void doDispatch(Cursor & cur, FuncRequest & cmd) override;
        ///
-       Inset * clone() const;
+       Inset * clone() const override { return new InsetNote(*this); }
        /// used by the constructors
        void init();
        ///
-       InsetNoteParams params_;
-};
-
-
-class InsetNoteMailer : public MailInset {
-public:
-       ///
-       InsetNoteMailer(InsetNote & inset);
-       ///
-       virtual Inset & inset() const { return inset_; }
-       ///
-       virtual std::string const & name() const { return name_; }
-       ///
-       virtual std::string const inset2string(Buffer const &) const;
-       ///
-       static std::string const params2string(InsetNoteParams const &);
+       std::string contextMenuName() const override;
        ///
-       static void string2params(std::string const &, InsetNoteParams &);
+       friend class InsetNoteParams;
 
-private:
        ///
-       static std::string const name_;
-       ///
-       InsetNote & inset_;
+       InsetNoteParams params_;
 };
 
-
 } // namespace lyx
 
-#endif
+#endif // INSET_NOTE_H